Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Share Your Creations
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Share Your Creations Show your developed application to Basic4ppc community. Please include source code if possible.

Scaled Maps

Reply
 
LinkBack Thread Tools Display Modes
  #21 (permalink)  
Old 12-26-2009, 10:48 PM
Basic4ppc Veteran
 
Join Date: Jan 2009
Location: Bayern, Germany
Posts: 489
Awards Showcase
Beta Tester 
Total Awards: 1
Default

just a question.

does this need to be placed in a Sub Globals or can I place into FormLoad also?

Dim startedTrackingFlag ' flag that tells that a new tracking session has begun
Dim tracking_in_progress ' flag that tells if tracking is in progress or not

thanks

William
Reply With Quote
  #22 (permalink)  
Old 12-26-2009, 11:09 PM
Basic4ppc Veteran
 
Join Date: Jan 2009
Location: Bayern, Germany
Posts: 489
Awards Showcase
Beta Tester 
Total Awards: 1
Default

these two functions would also be of interest. I think I would be able to add into the Main App. Adding the two Forms would be no Problem. But, I know I would need Help with the code. I been working on this for some time now. What do you think?

some code works some does not yet. My Problem is to fig where to put some.


Best regards.

William
Attached Images
File Type: jpg LoadSavePos.JPG (20.0 KB, 31 views)

Last edited by wm.chatman : 12-26-2009 at 11:23 PM.
Reply With Quote
  #23 (permalink)  
Old 12-27-2009, 07:20 AM
derez's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Posts: 918
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default

William

I was answering Sarah on the question of "how to translate real coordinates to x-y pixels on the map", and by the way added the code for copying from the image of the map to the screen.

The code is not something that you can copy and paste into klaus's application, and sorry, i have no intention to try and do it.
__________________
David Erez
Ramat Hasharon, Israel
Reply With Quote
  #24 (permalink)  
Old 12-27-2009, 10:39 AM
Basic4ppc Veteran
 
Join Date: Jan 2009
Location: Bayern, Germany
Posts: 489
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Post #22 was just a thought, nothing else. I will forget about it.
the other had been only a question. I will stop posting in this Thread.

Sorry I mixt in.

Last edited by wm.chatman : 12-27-2009 at 10:52 AM.
Reply With Quote
  #25 (permalink)  
Old 12-27-2009, 01:18 PM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Fully, Switzerland
Posts: 3,827
Awards Showcase
Forum Contributer Beta Tester Competition Winner 
Total Awards: 3
Default

Hi Sarah,

The converting routines are already in the ScaledMaps program:
If you look at the lines 1479-1493.
Code:
<font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">Sub </font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2">Long_X(long)</font></font>
</font></font><font face=
"Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">  Return </font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">Int</font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2">((long-MapLong10)/ScaleX+</font></font></font></font><font face="Courier New"><font size="2"><font color="#800080"><font face="Courier New"><font size="2"><font color="#800080"><font face="Courier New"><font size="2"><font color="#800080">.5</font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2">)</font></font>
</font></font><font face=
"Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">End Sub</font></font></font>
 
</font></font></font></font></font></font><font face=
"Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">Sub </font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2">Lat_Y(lat)</font></font>
</font></font><font face=
"Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">  Return </font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">Int</font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2">((lat-MapLat10)/ScaleY+</font></font></font></font><font face="Courier New"><font size="2"><font color="#800080"><font face="Courier New"><font size="2"><font color="#800080"><font face="Courier New"><font size="2"><font color="#800080">.5</font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2">)</font></font>
</font></font><font face=
"Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">End Sub</font></font></font>
 
</font></font></font></font></font></font><font face=
"Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">Sub </font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2">X_Long(x)</font></font>
</font></font><font face=
"Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">  Return</font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2"> MapLong10+(x-ScreenX+ImageX)*ScaleX</font></font>
</font></font><font face=
"Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">End Sub</font></font></font>
 
</font></font></font></font></font></font><font face=
"Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">Sub </font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2">Y_Lat(y)</font></font>
</font></font><font face=
"Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">  Return</font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2"> MapLat10+(y-ScreenY+ImageY)*ScaleY</font></font>
</font></font><font face=
"Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">End Sub</font></font></font></font></font></font></font></font></font>
For example the routine Sub Long_X(long) converts the physical map long value to the x coordinate of the map's image in pixels.
long - MapLong0 = distance of the long coordinate from the left border of the map in physical units
(long - MapLong10)/ScaleX = distance of the x coordinate from the left border of the map's image in pixels
Int((long-MapLong10)/ScaleX+.5) rounds to an integer value

The routine Sub X_Long(x) converts the screen x coordinate to the physical long coordinate on the map.
x-ScreenX = distance of x from the screen left border, in pixels
x-ScreenX+ImageX = distance of x from the map's image left border, in pixels
(x-ScreenX+ImageX)*ScaleX = distance of long from the map's image left border, in physical units
MapLong10+(x-ScreenX+ImageX)*ScaleX = long in physical units

Screen is the display surface on the form.

MapLong10 = value of the left border of the map image, in physical units
ImageX = value of the left border of the screen, in pixels (the map image is bigger than the screen)
ScreenX = distance between the form's and the screen's left borders, in pixels

You'll find more information in the http://www.basic4ppc.com/forum/tutor...-tutorial.html in the Vector graphics chapter in the Show scaled image topic.

Best regards.
__________________
Klaus
Switzerland
Reply With Quote
  #26 (permalink)  
Old 12-27-2009, 06:31 PM
Senior Member
 
Join Date: Nov 2009
Posts: 153
Default

Hi David

Thank you for the code. Am I correct in thinking what you are doing is repositioning the map itself, rather than the 'trail' line?
Reply With Quote
  #27 (permalink)  
Old 12-27-2009, 06:35 PM
Senior Member
 
Join Date: Nov 2009
Posts: 153
Default

Klaus!

You are a hero! You already wrote the code. Thank you!

(I have read the graphics tutorial although I am familiar with most of these methods from using VB.)

Best wishes for the new year

sarah
Reply With Quote
  #28 (permalink)  
Old 12-27-2009, 09:04 PM
derez's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Posts: 918
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default

Sarah

Yes,
Quote:
3. The map drawn on the form is a moving map, the present position is the center of the form
The application is used for off-road navigation, and the map itself is moved so the actual position is in the center of the form.

The trail you see in the picture is done later by drawing on the map, after translating the lat-long to map coordinates. (it is used for adding roads to "old" maps).

I also use real time trail by "laying eggs" - drawing a small circle every few gps readings, storing the array of coordinates, and re-drawing them every cycle. This of course requires memory and time, so I limit the drawing to those that are within the frame of the screen.
__________________
David Erez
Ramat Hasharon, Israel
Reply With Quote
  #29 (permalink)  
Old 12-28-2009, 06:37 PM
Senior Member
 
Join Date: Nov 2009
Posts: 153
Default

Thanks David

That is how my thermal tracking software for glider pilots works too. Thanks for the infomation.
Reply With Quote
  #30 (permalink)  
Old 01-21-2010, 06:22 PM
Knows the basics
 
Join Date: May 2007
Posts: 95
Default ScaledMaps from Klaus

Hi Klaus,

YES, a killer source, to learn from!
What is realy missing, is the heading and meters of every line, then it is ideal for navigation purpose on the water ( I integrated this in my code and it is no big deal to do so), and beginners have a direct use for it.

Respect,

Claude Belgium
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Calling Google Maps bish0p Questions (Windows Mobile) 2 11-25-2008 03:07 PM
Display maps klaus Share Your Creations 4 11-11-2008 06:05 PM
Google Maps trckashyap Questions (Windows Mobile) 0 10-31-2008 07:34 AM


All times are GMT. The time now is 10:10 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0