summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--navit/CMakeLists.txt2
-rw-r--r--navit/Makefile.am2
-rw-r--r--navit/attr_def.h1
-rw-r--r--navit/navit_shipped.xml5
-rw-r--r--navit/profile_option.c61
-rw-r--r--navit/xmlconfig.c14
-rw-r--r--navit/xmlconfig.h4
7 files changed, 84 insertions, 5 deletions
diff --git a/navit/CMakeLists.txt b/navit/CMakeLists.txt
index 70f6007d9..ee59a7673 100644
--- a/navit/CMakeLists.txt
+++ b/navit/CMakeLists.txt
@@ -8,7 +8,7 @@ include_directories( "${CMAKE_CURRENT_SOURCE_DIR}/support")
set(NAVIT_SRC announcement.c atom.c attr.c cache.c callback.c command.c compass.c config_.c coord.c country.c data_window.c debug.c
event.c file.c geom.c graphics.c gui.c item.c layout.c log.c main.c map.c maps.c
linguistics.c mapset.c maptype.c menu.c messages.c bookmarks.c navit.c navigation.c osd.c param.c phrase.c plugin.c popup.c
- profile.c projection.c roadprofile.c route.c routech.c search.c speech.c start_real.c sunriset.c transform.c track.c
+ profile.c profile_option.c projection.c roadprofile.c route.c routech.c search.c speech.c start_real.c sunriset.c transform.c track.c
util.c vehicle.c vehicleprofile.c xmlconfig.c )
if(NOT USE_PLUGINS)
diff --git a/navit/Makefile.am b/navit/Makefile.am
index b7e2d7e6c..139fdde75 100644
--- a/navit/Makefile.am
+++ b/navit/Makefile.am
@@ -51,7 +51,7 @@ EXTRA_DIST = navit_shipped.xml navit.dtd
lib@LIBNAVIT@_la_SOURCES = announcement.c atom.c attr.c cache.c callback.c command.c compass.c config_.c coord.c country.c data_window.c debug.c \
event.c event_glib.h file.c geom.c graphics.c gui.c item.c layout.c log.c main.c map.c maps.c \
linguistics.c mapset.c maptype.c menu.c messages.c bookmarks.c bookmarks.h navit.c navigation.c osd.c param.c phrase.c plugin.c popup.c \
- profile.c projection.c roadprofile.c route.c routech.c search.c speech.c start_real.c transform.c track.c \
+ profile.c profile_option.c projection.c roadprofile.c route.c routech.c search.c speech.c start_real.c transform.c track.c \
util.c vehicle.c vehicleprofile.c xmlconfig.c announcement.h atom.h attr.h attr_def.h cache.h callback.h color.h command.h compass.h config_.h coord.h country.h \
android.h data.h data_window.h data_window_int.h debug.h destination.h draw_info.h endianess.h event.h \
file.h geom.h graphics.h gtkext.h gui.h item.h item_def.h keys.h log.h layer.h layout.h linguistics.h main.h map-share.h map.h\
diff --git a/navit/attr_def.h b/navit/attr_def.h
index 1527ea8db..bb3856605 100644
--- a/navit/attr_def.h
+++ b/navit/attr_def.h
@@ -441,6 +441,7 @@ ATTR(cursor)
ATTR(config)
ATTR(maps)
ATTR(layout)
+ATTR(profile_option)
ATTR2(0x0008ffff,type_object_end)
ATTR2(0x00090000,type_coord_begin)
ATTR2(0x0009ffff,type_coord_end)
diff --git a/navit/navit_shipped.xml b/navit/navit_shipped.xml
index 0035f849c..c3a19cbce 100644
--- a/navit/navit_shipped.xml
+++ b/navit/navit_shipped.xml
@@ -276,6 +276,11 @@ Waypoint</text></img>
</roadprofile>
<roadprofile item_types="roundabout" speed="10" route_weight="10"/>
<roadprofile item_types="ferry" speed="40" route_weight="40"/>
+ <profile_option name="shortest">
+ <roadprofile item_types="street_0,street_1_city,living_street,street_service,track_gravelled,track_unpaved,street_parking_lane,street_2_city,track_paved,street_3_city,street_4_city,highway_city,street_1_land,street_2_land,street_3_land,street_4_land,street_n_lanes,highway_land,ramp,roundabout,ferry" route_weight="60" />
+ </profile_option>
+ <profile_option name="avoid_tolls" flags_forward_mask="0x4000402" flags_reverse_mask="0x4000401" />
+ <profile_option name="pedantic" route_depth="18:25%,18:40000" />
</vehicleprofile>
<vehicleprofile name="car_shortest" flags="0x4000000" flags_forward_mask="0x4000002" flags_reverse_mask="0x4000001" maxspeed_handling="0" route_mode="0" static_speed="5" static_distance="25">
diff --git a/navit/profile_option.c b/navit/profile_option.c
new file mode 100644
index 000000000..a9d5a880f
--- /dev/null
+++ b/navit/profile_option.c
@@ -0,0 +1,61 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2012 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terpo of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <glib.h>
+#include "item.h"
+#include "debug.h"
+#include "xmlconfig.h"
+
+struct profile_option
+{
+ NAVIT_OBJECT
+};
+
+struct profile_option *
+profile_option_new(struct attr *parent, struct attr **attrs)
+{
+ struct profile_option *po=g_new0(struct profile_option, 1);
+ po->func=&profile_option_func;
+ navit_object_ref((struct navit_object *)po);
+ po->attrs=attr_list_dup(attrs);
+ return po;
+}
+
+void
+profile_option_destroy(struct profile_option *po)
+{
+ attr_list_free(po->attrs);
+ g_free(po);
+}
+
+struct object_func profile_option_func = {
+ attr_profile_option,
+ (object_func_new)profile_option_new,
+ (object_func_get_attr)NULL,
+ (object_func_iter_new)NULL,
+ (object_func_iter_destroy)NULL,
+ (object_func_set_attr)NULL,
+ (object_func_add_attr)NULL,
+ (object_func_remove_attr)NULL,
+ (object_func_init)NULL,
+ (object_func_destroy)profile_option_destroy,
+ (object_func_dup)NULL,
+ (object_func_ref)navit_object_ref,
+ (object_func_unref)navit_object_unref,
+};
diff --git a/navit/xmlconfig.c b/navit/xmlconfig.c
index e2b2fd2c7..27d91a992 100644
--- a/navit/xmlconfig.c
+++ b/navit/xmlconfig.c
@@ -286,6 +286,8 @@ object_func_lookup(enum attr_type type)
return &mapset_func;
case attr_navit:
return &navit_func;
+ case attr_profile_option:
+ return &profile_option_func;
case attr_osd:
return &osd_func;
case attr_trackingo:
@@ -343,7 +345,7 @@ static char *element_fixmes[]={
};
static void initStatic(void) {
- elements=g_new0(struct element_func,41); //40 is a number of elements + ending NULL element
+ elements=g_new0(struct element_func,43); //42 is a number of elements + ending NULL element
elements[0].name="config";
elements[0].parent=NULL;
@@ -543,6 +545,16 @@ static void initStatic(void) {
elements[39].parent="navit";
elements[39].func=NULL;
elements[39].type=attr_layer;
+
+ elements[40].name="profile_option";
+ elements[40].parent="vehicleprofile";
+ elements[40].func=NULL;
+ elements[40].type=attr_profile_option;
+
+ elements[41].name="roadprofile";
+ elements[41].parent="profile_option";
+ elements[41].func=NULL;
+ elements[41].type=attr_roadprofile;
}
/**
diff --git a/navit/xmlconfig.h b/navit/xmlconfig.h
index 94cae7c86..f946fef32 100644
--- a/navit/xmlconfig.h
+++ b/navit/xmlconfig.h
@@ -54,9 +54,9 @@ struct object_func {
void *(*unref)(void *);
};
-extern struct object_func map_func, mapset_func, navit_func, osd_func, tracking_func, vehicle_func, maps_func, layout_func, vehicleprofile_func, layer_func, config_func;
+extern struct object_func map_func, mapset_func, navit_func, osd_func, tracking_func, vehicle_func, maps_func, layout_func, vehicleprofile_func, layer_func, config_func, profile_option_func;
-#define HAS_OBJECT_FUNC(x) ((x) == attr_map || (x) == attr_mapset || (x) == attr_navit || (x) == attr_osd || (x) == attr_trackingo || (x) == attr_vehicle || (x) == attr_maps || (x) == attr_layout || (x) == attr_vehicleprofile || (x) == attr_layer || (x) == attr_config)
+#define HAS_OBJECT_FUNC(x) ((x) == attr_map || (x) == attr_mapset || (x) == attr_navit || (x) == attr_osd || (x) == attr_trackingo || (x) == attr_vehicle || (x) == attr_maps || (x) == attr_layout || (x) == attr_vehicleprofile || (x) == attr_layer || (x) == attr_config || (x) == attr_profile_option)
#define NAVIT_OBJECT struct object_func *func; int refcount; struct attr **attrs;
struct navit_object {