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
  #11 (permalink)  
Old 12-23-2009, 08:20 AM
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 SarahWard,

In the 'ScaledMaps' program there is no dedicated unit system.
It's up to the user to select the right coordintate units and to enter the correct values for the upper left and lower right corner or reference lines.

When you scale a map you can select the unit type.
Selecting 'degrees' can mean UMT units.
Setting the UMT values for the upper left and lower right corner your map is scaled in UMT units.
If you look at the 'ShowScaledMap' program in the Graphics Tutorial it's an example of a same map image with 2 different scales. The scales are defined by the coordinate values of the upper left and lower right corner.

The 'ScaledMaps' program assumes that your map image is oriented north-south. It's intended for relative small maps, there is no calculation of the longitude difference in the upper and lower border.

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

Hi William

You say you are able to set a pixel. Do you mean literally setting an x/y coord pixel, or have you been able to set a gps coord on the scaled map as a pixel?
Reply With Quote
  #13 (permalink)  
Old 12-24-2009, 10:11 PM
Basic4ppc Veteran
 
Join Date: Jan 2009
Location: Bayern, Germany
Posts: 489
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Hi Sarah Ward

sad reply...

meaning literally I can set an x/y pixel on Form or Image. Still working on setting a gps coord on the map as a pixel itself. Setting gps coord is still out of bounce.

Best regards and Merry Xmas / Happy New Year.

William

Last edited by wm.chatman : 12-24-2009 at 10:13 PM.
Reply With Quote
  #14 (permalink)  
Old 12-25-2009, 08:47 PM
derez's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Posts: 918
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default

You want it like this image ? The red dashed line is the result of a GPS recording, driving on a new road which is not marked yet on the map.
Attached Images
File Type: jpg cut1864.jpg (96.4 KB, 32 views)
__________________
David Erez
Ramat Hasharon, Israel

Last edited by derez : 12-25-2009 at 08:50 PM.
Reply With Quote
  #15 (permalink)  
Old 12-25-2009, 09:08 PM
Basic4ppc Veteran
 
Join Date: Jan 2009
Location: Bayern, Germany
Posts: 489
Awards Showcase
Beta Tester 
Total Awards: 1
Default

its nice that you can code such functions...
Reply With Quote
  #16 (permalink)  
Old 12-26-2009, 05:29 PM
Senior Member
 
Join Date: Nov 2009
Posts: 153
Default

Quote:
Originally Posted by derez View Post
You want it like this image ? The red dashed line is the result of a GPS recording, driving on a new road which is not marked yet on the map.
Absolutely David

I need the code that takes the lat/long coord and makes it a map plottable x/y coord on the scaledmap display. If you have achieved that then I would be most grateful for the alghorthymn that does the coverting part. I would like to add a front end to Klaus's excellent mapscale software.

Sarah
Reply With Quote
  #17 (permalink)  
Old 12-26-2009, 07:57 PM
derez's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Posts: 918
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default

Sarah
Here it is. Explanations in the code.

Code:
tempx = point(0).geo_long ' this holds the longitude of present position
tempy = point(0).geo_lat   ' and this - the latitiude
 
left = (tempx - x1 )* mapwidth /(x2-x1) - center_x/zoom 
top  = (tempy - y1 )* mapheight/(y2-y1) - center_y/zoom 

' (x1,y1) and (x2,y2) are the coordinates of the corners of the map used.
'
mapwidth is the map width in pixels.
'
 center_x and center_y are  175 - the middle of the clipboard image.
'
 zoom is 1 for original size, 1.25 means 125% zoom in, 0.8 means 125% zoom-out etc.

IWZ = IW/zoom  
' IW = 350, its a clipboard image size
IHZ = IH/zoom    ' IH = 350

bmx.New1(AppPath & 
"\images\350.jpg"' clears previous map from bmx, the picture is a blank one. bmx is a bitmapEx object.
drawer.New2(bmx.Value)          ' re-declare the drawer to the new image, drawer is a drawerEx object.

If left < 0 Then
    mw = IWZ + left 
    destx = - left*zoom
    startx = 
0
Else 
    mw = 
Min(mapwidth - left, iwz)
    destx = 
0
    startx = left
End If
If top < 0 Then
    mh = IHZ + top
    desty = -top*zoom
    starty = 
0
Else
    mh = 
Min(mapheight - top,ihz)
    desty = 
0
    starty = top
End If

If mw >= 1 AND mh >= 1 Then 
    tmap1.New2(mw,mh)  
' tmap is a bitmapEx object
    tmap1.Value = jpeg.LoadArea(mapname,startx,starty,mw,mh)
    mapdst.New1(destx,desty,tmap1.Width*zoom,tmap1.Height*zoom) 
' mapdst and mapsrc are rectangleEx objects.
    mapsrc.New1(0,0,tmap1.Width,tmap1.Height)
    drawer.DrawImage(tmap1.Value,mapsrc.Value,mapdst.Value,
False)


            src.New1(
55,40,240,268)  ' size of a form, from the center of bmx
            dst.new1(0,0,240,268' a form size
            drx.DrawImage(bmx.Value,src.Value,dst.Value,False' drx is a drawerEx object which draws on the form.
End If
notes:
1. the code is taken from few subs, some lines need to be done only once,others for every new position.
2. The use of a clipboard with size of 350x350 is to enable rotation of the map before copying to the form, without loosing the corners. Rotation is not in the code above.
3. The map drawn on the form is a moving map, the present position is the center of the form (draw a circle or something there on the forelayer).

I hope I forgot no crucial elements. Try to play with it, and when you're ready I'll show you the path drawing part as well.
__________________
David Erez
Ramat Hasharon, Israel

Last edited by derez : 12-26-2009 at 08:00 PM.
Reply With Quote
  #18 (permalink)  
Old 12-26-2009, 08:18 PM
Basic4ppc Veteran
 
Join Date: Jan 2009
Location: Bayern, Germany
Posts: 489
Awards Showcase
Beta Tester 
Total Awards: 1
Default

thanks for sharing!

derez, your great.

BTW: Klaus has a Draw Circle function already coded, can this be used?

Best regards.

William
Reply With Quote
  #19 (permalink)  
Old 12-26-2009, 08:38 PM
derez's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Posts: 918
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default

William
You don't need that one, just (from the help):

Quote:
Form1.ForeLayer = True
Form1.FCircle (100, 120, 40, cYellow) ' Empty yellow circle

or

Form1.FCircle (200, 30, 10, 0, 255, 0, F) ' Filled green circle

or

Form1.FCircle (150,150, 30, Button1.Color) ' Empty circle with the color of Button1
__________________
David Erez
Ramat Hasharon, Israel
Reply With Quote
  #20 (permalink)  
Old 12-26-2009, 08:58 PM
Basic4ppc Veteran
 
Join Date: Jan 2009
Location: Bayern, Germany
Posts: 489
Awards Showcase
Beta Tester 
Total Awards: 1
Default

as always, I just try the wrong things...
place code into frmMain, right!?

BTW: the code you posted #17, where do I need to place? frmMainLoad?

Best regards.

Limited Knowledge

Last edited by wm.chatman : 12-26-2009 at 09:39 PM.
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:09 PM.


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