/[zanavi_public1]/navit/navit/navit.c
ZANavi

Diff of /navit/navit/navit.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 30 Revision 31
134int draw_polylines_fast = 0; // default: 0 134int draw_polylines_fast = 0; // default: 0
135int limit_order_corrected = 4; // remain at this order level for drawing streets etc. 135int limit_order_corrected = 4; // remain at this order level for drawing streets etc.
136int shift_order = 0; // shift order level (for displaying objects) by this values (should only be bigger than zero!!) 136int shift_order = 0; // shift order level (for displaying objects) by this values (should only be bigger than zero!!)
137int global_search_street_size_factor = 1; // make search radius for streets bigger 137int global_search_street_size_factor = 1; // make search radius for streets bigger
138int disable_map_drawing = 0; // dont draw the map and dont read data from file (hopefully saving resources) 138int disable_map_drawing = 0; // dont draw the map and dont read data from file (hopefully saving resources)
139int enable_water_from_relations = 1; // do you want to draw water where the "tags" come from osm-"relations"
140int hold_drawing = 0; // 0 -> draw normal , 1 -> dont do any drawing 139int hold_drawing = 0; // 0 -> draw normal , 1 -> dont do any drawing
141int global_stop_demo_vehicle = 0; // 0 -> demo vehicle can move, 1 -> demo vehicle stands still 140int global_stop_demo_vehicle = 0; // 0 -> demo vehicle can move, 1 -> demo vehicle stands still
141int global_show_route_rectangles = 0; // 1 -> show route rectangles, 0 -> dont show route rectangles
142int global_traffic_light_delay = 0; // 0 -> dont account for traffic lights in route, >0 -> calc a delay for each traffic light
143int global_draw_multipolygons = 1; // 0 -> dont draw lines and triangles from multipolygons, 1 -> draw them
144
145GHashTable *global_transform_hash = NULL;
146GHashTable *global_transform_hash2 = NULL;
142 147
143long long draw_lines_count_2 = 0; 148long long draw_lines_count_2 = 0;
144long long draw_lines_count_3 = 0; 149long long draw_lines_count_3 = 0;
145long long draw_lines_count_4 = 0; 150long long draw_lines_count_4 = 0;
146 151
147int mapdraw_time[11 + 5]; // time to draw map on screen (in 1/1000 of a second) [add 5, just in case we inc it 2 times at same time because of threads] 152int mapdraw_time[11 + 5]; // time to draw map on screen (in 1/1000 of a second) [add 5, just in case we inc it 2 times at same time because of threads]
148int cur_mapdraw_time_index = 0; 153int cur_mapdraw_time_index = 0;
149 154
150int route_status_previous = 0; 155int route_status_previous = 0;
156long long global_route_memory_size = 0;
151 157
152void navit_add_mapset(struct navit *this_, struct mapset *ms) 158void navit_add_mapset(struct navit *this_, struct mapset *ms)
153{ 159{
154#ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT 160#ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT
155 dbg(0,"+#+:enter\n"); 161 dbg(0,"+#+:enter\n");
1688{ 1694{
1689#ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT 1695#ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT
1690 dbg(0,"+#+:enter\n"); 1696 dbg(0,"+#+:enter\n");
1691#endif 1697#endif
1692 1698
1699 dbg(0, "+#+:enter\n");
1700
1693 struct navit *this_=g_new0(struct navit, 1); 1701 struct navit *this_=g_new0(struct navit, 1);
1694 struct pcoord center; 1702 struct pcoord center;
1695 struct coord co; 1703 struct coord co;
1696 struct coord_geo g; 1704 struct coord_geo g;
1697 enum projection pro = projection_mg; 1705 enum projection pro = projection_mg;
1728 transform_from_geo(pro, &g, &co); 1736 transform_from_geo(pro, &g, &co);
1729 center.x = co.x; 1737 center.x = co.x;
1730 center.y = co.y; 1738 center.y = co.y;
1731 center.pro = pro; 1739 center.pro = pro;
1732 1740
1741 transform_init();
1742
1733 //DBG dbg(0, "setting center from xmlfile [hardcoded]\n"); 1743 //DBG dbg(0, "setting center from xmlfile [hardcoded]\n");
1734 transform_setup(this_->trans, &center, zoom, (this_->orientation != -1) ? this_->orientation : 0); 1744 transform_setup(this_->trans, &center, zoom, (this_->orientation != -1) ? this_->orientation : 0);
1735 1745
1736 // initialze trans_cursor here 1746 // initialze trans_cursor here
1737 transform_copy(this_->trans, this_->trans_cursor); 1747 transform_copy(this_->trans, this_->trans_cursor);
1738 // initialze trans_cursor here 1748 // initialze trans_cursor here
1739 1749
1750
1751 dbg(0, "ii 001\n");
1740 this_->bookmarks = bookmarks_new(&this_->self, NULL, this_->trans); 1752 this_->bookmarks = bookmarks_new(&this_->self, NULL, this_->trans);
1753 //this_->bookmarks = NULL;
1754 dbg(0, "ii 002\n");
1741 1755
1742 this_->prevTs = 0; 1756 this_->prevTs = 0;
1743 1757
1744 for (; *attrs; attrs++) 1758 for (; *attrs; attrs++)
1745 { 1759 {
1746 navit_set_attr_do(this_, *attrs, 1); 1760 navit_set_attr_do(this_, *attrs, 1);
1747 } 1761 }
1748 this_->displaylist = graphics_displaylist_new(); 1762 this_->displaylist = graphics_displaylist_new();
1749 command_add_table(this_->attr_cbl, commands, sizeof(commands) / sizeof(struct command_table), this_); 1763 command_add_table(this_->attr_cbl, commands, sizeof(commands) / sizeof(struct command_table), this_);
1750 1764
1765 dbg(0, "ii 009\n");
1766
1751 // this_->messages = messagelist_new(attrs); 1767 // this_->messages = messagelist_new(attrs);
1752 1768
1753 ////DBG dbg(0,"111111\n"); 1769 dbg(0, "111111\n");
1754 1770
1755 return this_; 1771 return this_;
1756} 1772}
1757 1773
1758static int navit_set_gui(struct navit *this_, struct gui *gui) 1774static int navit_set_gui(struct navit *this_, struct gui *gui)
3883#ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT 3899#ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT
3884 dbg(0,"+#+:leave\n"); 3900 dbg(0,"+#+:leave\n");
3885#endif 3901#endif
3886 3902
3887 return ret; 3903 return ret;
3904}
3905
3906void displaylist_shift_order_in_map_layers(struct navit *this_, int shift_value)
3907{
3908#ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT
3909 dbg(0,"+#+:enter\n");
3910#endif
3911
3912 GList *l;
3913 struct layout *lay;
3914 GList *l2;
3915 struct layer *layer;
3916 GList *ig;
3917 struct itemgra *itemgr;
3918 GList *elements;
3919 struct element *e;
3920
3921 // loop through all the layouts
3922 l = this_->layouts;
3923 while (l)
3924 {
3925 lay = l->data;
3926 //dbg(0,"layout name=%s\n", lay->name);
3927 if (!strcmp(lay->name, "Android-Car"))
3928 {
3929 //dbg(0,"layout found\n");
3930 l2 = lay->layers;
3931 while (l2)
3932 {
3933 layer = l2->data;
3934 //dbg(0,"layer name=%s\n", layer->name);
3935 // only change the zoom of these layers
3936 if ((!strcmp(layer->name, "polygons001"))
3937 || (!strcmp(layer->name, "polygons"))
3938 || (!strcmp(layer->name, "streets"))
3939 || (!strcmp(layer->name, "streets_1"))
3940 || (!strcmp(layer->name, "streets_2"))
3941 || (!strcmp(layer->name, "route_001"))
3942 || (!strcmp(layer->name, "route_002"))
3943 )
3944 {
3945 //dbg(0,"layer found\n");
3946 ig = layer->itemgras;
3947 while (ig)
3948 {
3949 //dbg(0,"*itgr*\n");
3950 itemgr = ig->data;
3951
3952 // now shift "order"-value of itemgra by "shift_value"
3953 // ! max order == 18 !
3954 // ! min order == -2 !
3955
3956
3957 int was_shifted = 0;
3958
3959 //if (itemgr->order.min < 20)
3960 //{
3961 itemgr->order.min = itemgr->order.min - shift_value;
3962 was_shifted = 1;
3963 //}
3964 //if (itemgr->order.min < -2)
3965 //{
3966 // itemgr->order.min = -2;
3967 //}
3968 if (itemgr->order.min > 18)
3969 {
3970 itemgr->order.min = 18;
3971 }
3972
3973 // ------------------------------
3974
3975 if (itemgr->order.max < 18)
3976 {
3977 itemgr->order.max = itemgr->order.max - shift_value;
3978 was_shifted = 1;
3979 }
3980 //
3981 //if (itemgr->order.max < -2)
3982 //{
3983 // itemgr->order.max = -2;
3984 //}
3985 if (itemgr->order.max > 18)
3986 {
3987 itemgr->order.max = 18;
3988 }
3989
3990 float sv_001 = ((float) shift_value * 1.34f);
3991 float sv_002 = ((float) shift_value * 0.75f);
3992
3993 if (was_shifted == 1)
3994 {
3995 // loop thru all the elements in this "itemgra"
3996 elements = itemgr->elements;
3997 while (elements)
3998 {
3999 e = elements->data;
4000
4001 if (e->type == element_polyline)
4002 {
4003 // shift polyline width
4004 e->u.polyline.width = ((float) e->u.polyline.width / sv_001) + 0;
4005 if (e->u.polyline.width < 1)
4006 {
4007 e->u.polyline.width = 1;
4008 }
4009 }
4010
4011 if (e->type == element_circle)
4012 {
4013 // shift circle witdh
4014 e->u.circle.width = ((float) e->u.circle.width / sv_001) + 0;
4015 if (e->u.circle.width < 1)
4016 {
4017 e->u.circle.width = 1;
4018 }
4019
4020 e->u.circle.radius = ((float) e->u.circle.radius / sv_001) + 0;
4021 if (e->u.circle.radius < 1)
4022 {
4023 e->u.circle.radius = 1;
4024 }
4025 }
4026
4027 if (e->type == element_text)
4028 {
4029 // shift text size
4030 e->text_size = (float) e->text_size / sv_002;
4031 if (e->text_size < 1)
4032 {
4033 e->text_size = 1;
4034 }
4035 }
4036 elements = g_list_next(elements);
4037 }
4038 // loop thru all the elements in this "itemgra"
4039 }
4040
4041 ig = g_list_next(ig);
4042 }
4043 }
4044 l2 = g_list_next(l2);
4045 }
4046 }
4047 l = g_list_next(l);
4048 }
4049
4050#ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT
4051 dbg(0,"+#+:leave\n");
4052#endif
3888} 4053}
3889 4054
3890static int navit_add_log(struct navit *this_, struct log *log) 4055static int navit_add_log(struct navit *this_, struct log *log)
3891{ 4056{
3892#ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT 4057#ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT

Legend:
Removed from v.30  
changed lines
  Added in v.31

   
Visit the ZANavi Wiki