Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 290026 - sci-geosciences/tangogps: improving application (add kilometer grid and WGS-84 Merkator projection)
Summary: sci-geosciences/tangogps: improving application (add kilometer grid and WGS-8...
Status: RESOLVED CANTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Sci-geo Project
URL:
Whiteboard:
Keywords: Inclusion
Depends on:
Blocks:
 
Reported: 2009-10-21 15:54 UTC by Alexey Kharikovsky
Modified: 2011-07-25 13:22 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
This patch improves the tangogps (tangogps_grid_yandex.patch,8.44 KB, patch)
2009-10-21 15:59 UTC, Alexey Kharikovsky
Details | Diff
splitting previous patch (grid.patch,6.06 KB, patch)
2009-12-01 16:30 UTC, Alexey Kharikovsky
Details | Diff
splitting previous patch (yandex.patch,4.98 KB, patch)
2009-12-01 16:34 UTC, Alexey Kharikovsky
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Kharikovsky 2009-10-21 15:54:06 UTC
This patch contains converter for using WGS-84 Merkator projection tiles. The patch adding Yandex maps repository (well for Russian) and kilometer grid to tangogps.

Reproducible: Always

Steps to Reproduce:
tar -xzvf tangogps-0.9.6.tar.gz
cp tangogps_grid_yandex.patch tangogps-0.9.6/
cd tangogps-0.9.6/
patch -p1 -i tangogps_grid_yandex




diff -r -U 0 tangogps-0.9.6/src/callbacks.c tango_my/src/callbacks.c
--- tangogps-0.9.6/src/callbacks.c	2009-02-05 02:54:26.000000000 +0300
+++ tango_my/src/callbacks.c	2009-10-20 16:15:18.000000000 +0400
@@ -478,0 +479,61 @@
+//---------horiz line grid----------
+    char i, temp[2][25],temp_pow[4]="";
+    float lat[5],lon[2];
+    for (i=0;i<5;i++)
+        lat[i]=pixel2lat(global_zoom,global_y+widget->allocation.height/4*i);
+        //lat[0]=TOP,lat[1]=1/4, ...1/2, 3/4, BOTTOM
+    lon[0]=pixel2lon(global_zoom,global_x);//LEFT
+    lon[1]=pixel2lon(global_zoom,global_x+widget->allocation.width);//RIGHT
+    float grid_dimension_h[2];
+    grid_dimension_h[0]=get_distance(lat[0],lon[0],lat[0],lon[1])/4;
+    grid_dimension_h[1]=get_distance(lat[4],lon[0],lat[4],lon[1])/4;
+    if (grid_dimension_h[0]>1)
+    {
+        strcat(temp_pow," km");
+    }
+    else 
+    {
+        grid_dimension_h[0]=grid_dimension_h[0]*1000;
+        grid_dimension_h[1]=grid_dimension_h[1]*1000;
+        strcat(temp_pow," m");
+    }
+    for (i=0;i<2;i++)
+    {
+        if (grid_dimension_h[i]<10)
+            sprintf(temp[i],"%1.1f",grid_dimension_h[i]);
+        else    
+            sprintf(temp[i],"%4d",(int)grid_dimension_h[i]);
+        strcat(temp[i],temp_pow);
+    }
+
+    for (i=0;i<4;i++)
+    {
+        if (i!=0)
+            gdk_draw_line (widget->window,
+                      widget->style->black_gc,
+                      widget->allocation.width/4*i,0,
+                      widget->allocation.width/4*i,widget->allocation.height
+                      );
+        gtk_label_set_text(label_grid_h[0][i],temp[0]);    
+        gtk_label_set_text(label_grid_h[1][i],temp[1]);    
+    }
+
+//--------vert line grid-----------
+    for (i=0;i<4;i++)
+    {
+        if (i!=0)
+            gdk_draw_line (widget->window,
+                          widget->style->black_gc,
+                          0,widget->allocation.height/4*i,
+                          widget->allocation.width,widget->allocation.height/4*i
+                          );
+        grid_dimension_h[0]=get_distance(lat[i],lon[0],lat[i+1],lon[0]);
+        if (strstr(temp_pow," m")!=NULL) grid_dimension_h[0]=grid_dimension_h[0]*1000;
+        if (grid_dimension_h[0]<10)
+            sprintf(temp,"%1.1f",grid_dimension_h[0]);
+        else    
+            sprintf(temp,"%4d",(int)grid_dimension_h[0]);
+        strcat(temp,temp_pow);
+        gtk_label_set_text(label_grid_v[i],temp);    
+    }
+//-------end grid draw-------------
diff -r -U 0 tangogps-0.9.6/src/globals.h tango_my/src/globals.h
--- tangogps-0.9.6/src/globals.h	2009-02-01 18:34:06.000000000 +0300
+++ tango_my/src/globals.h	2009-09-07 14:16:52.000000000 +0400
@@ -8,0 +9 @@
+
@@ -12,0 +14,9 @@
+#define YANDEX_Rn (6378137.0)
+#define YANDEX_E (0.0818191908426)
+#define YANDEX_A (20037508.342789)
+#define YANDEX_F (53.5865938)
+#define YANDEX_AB (0.00335655146887969400)
+#define YANDEX_BB (0.00000657187271079536)
+#define YANDEX_CB (0.00000001764564338702)
+#define YANDEX_DB (0.00000000005328478445)
+
diff -r -U 0 tangogps-0.9.6/src/init.c tango_my/src/init.c
--- tangogps-0.9.6/src/init.c	2009-02-05 02:54:26.000000000 +0300
+++ tango_my/src/init.c	2009-09-11 13:49:27.000000000 +0400
@@ -481,0 +482,3 @@
+		repo_t *repo6 = g_new0(repo_t, 1);
+		repo_t *repo7 = g_new0(repo_t, 1);
+		repo_t *repo8 = g_new0(repo_t, 1);
@@ -513,0 +517,18 @@
+
+		repo6->name = g_strdup("Google Map");
+		repo6->uri  = g_strdup("http://mt1.google.com/vt/v=w2.101&hl=ru&x=%d&y=%d&z=%d");
+		repo6->dir  = g_strdup_printf("%s/Maps/googlemap",global_home_dir);
+		repo6->inverted_zoom = 1;
+		global_repo_list = g_slist_append(global_repo_list, repo6);
+
+		repo7->name = g_strdup("Yandex Sat");
+		repo7->uri  = g_strdup("http://sat01.maps.yandex.ru/tiles?l=sat&v=1.10.0&x=%d&y=%d&z=%d");
+		repo7->dir  = g_strdup_printf("%s/Maps/yandexsat",global_home_dir);
+		repo7->inverted_zoom = 1;
+		global_repo_list = g_slist_append(global_repo_list, repo7);
+
+		repo8->name = g_strdup("Yandex Map");
+		repo8->uri  = g_strdup("http://vec01.maps.yandex.ru/tiles?l=map&v=2.7.1&x=%d&y=%d&z=%d");
+		repo8->dir  = g_strdup_printf("%s/Maps/yandexmap",global_home_dir);
+		repo8->inverted_zoom = 1;
+		global_repo_list = g_slist_append(global_repo_list, repo8);
diff -r -U 0 tangogps-0.9.6/src/interface.c tango_my/src/interface.c
--- tangogps-0.9.6/src/interface.c	2009-02-05 02:54:27.000000000 +0300
+++ tango_my/src/interface.c	2009-10-20 18:46:12.349655992 +0400
@@ -45 +44,0 @@
-  GtkWidget *hbox1;
@@ -328,3 +327,18 @@
-  hbox1 = gtk_hbox_new (FALSE, 0);
-  gtk_widget_show (hbox1);
-  gtk_box_pack_start (GTK_BOX (vbox1), hbox1, TRUE, TRUE, 0);
+//---------label for grid
+    GtkWidget *draw_table=gtk_table_new(6,6,FALSE);
+    gtk_widget_show(draw_table);
+    gtk_container_add (GTK_CONTAINER(vbox1),draw_table);
+    char i;
+    for (i=1;i<5;i++)
+        {
+            label_grid_h[0][i-1]=gtk_label_new("");
+            label_grid_h[1][i-1]=gtk_label_new("");
+            label_grid_v[i-1]=gtk_label_new("");
+            gtk_table_attach (draw_table,label_grid_h[0][i-1],i,i+1,0,1,GTK_EXPAND,0,0,0);
+            gtk_table_attach (draw_table,label_grid_h[1][i-1],i,i+1,5,6,GTK_EXPAND,0,0,0);
+            gtk_table_attach (draw_table,label_grid_v[i-1],0,1,i,i+1,0,GTK_EXPAND,0,0);
+            gtk_widget_show (label_grid_h[0][i-1]);
+            gtk_widget_show (label_grid_h[1][i-1]);
+            gtk_widget_show (label_grid_v[i-1]);
+        }
+//---------label for grid
@@ -332 +346 @@
-  drawingarea1 = gtk_drawing_area_new ();
+drawingarea1 = gtk_drawing_area_new ();
@@ -334 +348 @@
-  gtk_box_pack_start (GTK_BOX (hbox1), drawingarea1, TRUE, TRUE, 0);
+  gtk_table_attach (draw_table,drawingarea1,1,5,1,5,GTK_EXPAND|GTK_FILL|GTK_SHRINK,GTK_EXPAND|GTK_FILL|GTK_SHRINK,0,0);
@@ -340 +354 @@
-  gtk_box_pack_start (GTK_BOX (hbox1), vscale1, FALSE, TRUE, 0);
+  gtk_table_attach (draw_table,vscale1,5,6,0,6,0,GTK_EXPAND|GTK_FILL,0,0);
@@ -1617 +1631 @@
-  GLADE_HOOKUP_OBJECT (window1, hbox1, "hbox1");
+  GLADE_HOOKUP_OBJECT (window1, draw_table, "draw_table");
diff -r -U 0 tangogps-0.9.6/src/interface.h tango_my/src/interface.h
--- tangogps-0.9.6/src/interface.h	2009-02-04 23:55:07.000000000 +0300
+++ tango_my/src/interface.h	2009-10-16 20:50:28.000000000 +0400
@@ -30,0 +31,2 @@
+    GtkWidget *label_grid_h[2][4];
+    GtkWidget *label_grid_v[4];
diff -r -U 0 tangogps-0.9.6/src/map_management.c tango_my/src/map_management.c
--- tangogps-0.9.6/src/map_management.c	2009-02-05 02:54:27.000000000 +0300
+++ tango_my/src/map_management.c	2009-09-11 17:46:33.000000000 +0400
@@ -146,0 +147,2 @@
+    int yandex_offset_y=0;
+    int yandex_offset_x=0;
@@ -158,4 +160,24 @@
-	
-	
-	offset_x = - pixel_x % TILESIZE;
-	offset_y = - pixel_y % TILESIZE;
+
+//--------------Yandex repository offset ------------------------
+    if (strstr(repo->name,"Yandex")!=NULL)
+	    {
+            float lat=rad2deg(pixel2lat((float)zoom,pixel_y));
+            float lon=rad2deg(pixel2lon((float)zoom,pixel_x));
+//----Shmuma autor---
+            float tmp = tan (M_PI_4 + deg2rad (lat) / 2.0);
+            float pow_tmp = pow (tan (M_PI_4 +  asin (YANDEX_E * sin (deg2rad (lat))) / 2.0), YANDEX_E);
+            int unitx = (int)((YANDEX_Rn * deg2rad (lon) + YANDEX_A) * YANDEX_F)>>(23-zoom);
+            int unity = (int)((YANDEX_A - (YANDEX_Rn * log (tmp / pow_tmp))) * YANDEX_F)>>(23-zoom);
+            yandex_offset_y = unity-pixel_y;
+            yandex_offset_x = unitx-pixel_x;
+            printf("\n\nYANDEX_OFFSET_Y = %d, YANDEX_OFFSET_X = %d\n\n\n",yandex_offset_y,yandex_offset_x);
+        }
+    else
+        {
+            yandex_offset_y = 0;
+            yandex_offset_x = 0;
+        }
+//--------------Yandex repository offset ------------------------
+
+	offset_x = - (pixel_x + yandex_offset_x) % TILESIZE;
+	offset_y = - (pixel_y + yandex_offset_y) % TILESIZE;
@@ -181,2 +203,2 @@
-	tile_x0 =  floor((float)pixel_x / (float)TILESIZE);
-	tile_y0 =  floor((float)pixel_y / (float)TILESIZE);
+	tile_x0 =  floor((float)(pixel_x + yandex_offset_x) / (float)TILESIZE);
+	tile_y0 =  floor((float)(pixel_y + yandex_offset_y) / (float)TILESIZE);
@@ -213,3 +235,3 @@
-			else
-			{
-				load_tile(
+            else
+            {
+                load_tile(
@@ -221 +243,2 @@
-			offset_yn += TILESIZE;
+            offset_yn += TILESIZE;
+
@@ -222,0 +246 @@
+        
@@ -256,2 +280,3 @@
-	printf("fill_tiles_latlon(): lat %f  %i -- lon %f  %i\n",
-	lat,pixel_y,lon,pixel_x);
+ 
+	printf("fill_tiles_latlon(): lat %f  %i -- lon %f  %i\n",lat,pixel_y,lon,pixel_x);
+
Comment 1 Alexey Kharikovsky 2009-10-21 15:59:31 UTC
Created attachment 207837 [details, diff]
This patch improves the tangogps

This patch contains converter for using WGS-84 Merkator projection tiles. The patch adding Yandex maps repository (well for Russian) and kilometer grid to tangogps.
Comment 2 Thilo Bangert (RETIRED) (RETIRED) gentoo-dev 2009-10-21 21:15:47 UTC
what is the upstream status of this patch?
Comment 3 Alexey Kharikovsky 2009-10-23 13:20:34 UTC
(In reply to comment #2)
> what is the upstream status of this patch?
> 

I am sorry, but I not understanding your question :(
Comment 4 Thilo Bangert (RETIRED) (RETIRED) gentoo-dev 2009-10-23 16:13:48 UTC
upstream is the original developer of tangogps: Marcus Bauer over at tangogps.org.

i would like to know, what he thinks of the patch. i dont want to carry a patch that upstream already has rejected (for one or the other reason) - since that is a major PITA. so the easiest way forward is for him to include the patch in a new release of tangogps - then gentoo will get it automagically.

hope this makes it more clear.
Comment 5 Alexey Kharikovsky 2009-10-23 21:36:37 UTC
(In reply to comment #4)
> upstream is the original developer of tangogps: Marcus Bauer over at
> tangogps.org.
> 
> i would like to know, what he thinks of the patch. i dont want to carry a patch
> that upstream already has rejected (for one or the other reason) - since that
> is a major PITA. so the easiest way forward is for him to include the patch in
> a new release of tangogps - then gentoo will get it automagically.
> 
> hope this makes it more clear.
> 

I write mail to Marcus many times, but he is not answer me. I have thinks what it may be interested anybody. Many users Neo FreeRunner with gentoo likes to use Yandex in our country. Therefore I make a resolve to lo place patch here.
Comment 6 Alexey Kharikovsky 2009-10-24 15:12:13 UTC
(In reply to comment #4)
> upstream is the original developer of tangogps: Marcus Bauer over at
> tangogps.org.
> 
> i would like to know, what he thinks of the patch. i dont want to carry a patch
> that upstream already has rejected (for one or the other reason) - since that
> is a major PITA. so the easiest way forward is for him to include the patch in
> a new release of tangogps - then gentoo will get it automagically.
> 
> hope this makes it more clear.
> 

I write mail to Marcus many times, but he is not answer me. I have thinks what it may be interested anybody. Many users Neo FreeRunner with gentoo likes to use Yandex in our country. Therefore I make a resolve to lo place patch here.
Comment 7 Thilo Bangert (RETIRED) (RETIRED) gentoo-dev 2009-11-25 08:59:11 UTC
your patch adds two features. split it up into to separate patches and i'll take a look again. can the grid be made optional - or is it hardcoded?

kind regards
Thilo
Comment 8 Alexey Kharikovsky 2009-12-01 16:27:57 UTC
(In reply to comment #7)
> your patch adds two features. split it up into to separate patches and i'll
> take a look again. can the grid be made optional - or is it hardcoded?
> 
> kind regards
> Thilo
> 

Yes, this features are fully independent.
Comment 9 Alexey Kharikovsky 2009-12-01 16:30:53 UTC
Created attachment 211704 [details, diff]
splitting previous patch

patch for add grid into tangogps
Comment 10 Alexey Kharikovsky 2009-12-01 16:34:20 UTC
Created attachment 211706 [details, diff]
splitting previous patch

this patch does supports for yandex repository based on WGS-84 Merkator proection tiles
Comment 11 Alexey Kharikovsky 2010-02-25 16:05:01 UTC
These features are accessible in my new project: http://tangogps.wmsite.ru/
Also feature of loading traffic information is accessible (Google traffic & yandex traffic). Looking screenshots: http://tangogps.wmsite.ru/skrinshoty-screenshots/

Sorry for the Russian-language version of a site.
Comment 12 Thilo Bangert (RETIRED) (RETIRED) gentoo-dev 2010-06-14 19:24:50 UTC
please also checkout the http://www.foxtrotgps.org project. its a community based fork of tangogps. it may be more receptable to your changes.

foxtrotgps is not in portage yet, but will likely be added as soon as they release a tarball.

thanks
Comment 13 Tomáš Chvátal (RETIRED) gentoo-dev 2011-07-24 11:50:31 UTC
Please report this patches to foxtrotgps upstream. Usually we in gentoo do not apply features patches that are not accepted upstream.

Also tangogps is going to be removed from main tree in favor of foxtrotgps.

Please reopen this bug when you get your patches accepted by the foxtrotgps. Up until then there is nothing more we should do.
Comment 14 Alexey Kharikovsky 2011-07-25 13:22:10 UTC
(In reply to comment #13)
> Please report this patches to foxtrotgps upstream. Usually we in gentoo do not
> apply features patches that are not accepted upstream.
> 
> Also tangogps is going to be removed from main tree in favor of foxtrotgps.
> 
> Please reopen this bug when you get your patches accepted by the foxtrotgps. Up
> until then there is nothing more we should do.


These patches for tangogps are outdated. By these patches, the new open source project was began. Tangogis os a fork of tangogps project. Recently tangogis was moved to google code repository (http://code.google.com/p/tangogis/). New branch at present worked and available throught svn repository. But first new branch release expected soon.