Message for Randal Ferguson

Message for Randal Ferguson

Postby Peterg » Wed Aug 16, 2006 7:54 am

Hi Randal

I have beed told that you have done some work with FW and GIS mapping systems. Can you share what and how you achieved this as I want to be able to link mapping into my applications

Regards
Peter Gardner
Peterg
 
Posts: 62
Joined: Mon Nov 28, 2005 5:36 pm
Location: Oxford UK

Postby Randal » Wed Aug 16, 2006 3:47 pm

Peter Gardner,

I have worked some with Microsoft MapPoint. Is this what you are going to use? What exactly are you wanting to do?

Regards,
Randal Ferguson
Randal
 
Posts: 260
Joined: Mon Oct 24, 2005 8:04 pm

Postby Peterg » Wed Aug 16, 2006 4:08 pm

Yes I think that I will use mappoint. Basically what I want to do is invoke the mapping system and pass locations of containers so that they can see these positioned on the map. Ideally it would be good if they could then plot a route between locations

Regards
Peter
Peterg
 
Posts: 62
Joined: Mon Nov 28, 2005 5:36 pm
Location: Oxford UK

Postby Silvio » Thu Aug 17, 2006 12:35 am

Dear Randal,
I'm interested for YOur Work...
Can U send a simple sample to invoke microsoft Mappoint to search a position to a map and print it ..?

Regards,
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Randal » Thu Aug 17, 2006 8:03 pm

Do you want to use it via ole or activex? I needed to use via activex but could not get events to work so I put it on the back burner for now.

I could give you a little sample code for using it via ole if that would help.

Regards,
Randal Ferguson
Randal
 
Posts: 260
Joined: Mon Oct 24, 2005 8:04 pm

Postby Silvio » Thu Aug 17, 2006 11:08 pm

thanks I can try via ole ...
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Peterg » Fri Aug 18, 2006 7:57 am

Randal

Yes please can I have the sample as well

Peter
Peterg
 
Posts: 62
Joined: Mon Nov 28, 2005 5:36 pm
Location: Oxford UK

Postby Antonio Linares » Fri Aug 18, 2006 8:56 am

Please upload it to www.hyperupload.com and copy the download url here so others can have it too, thanks.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42125
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Randal » Fri Aug 18, 2006 1:17 pm

Give me a little time to clean up the code and I'll post some samples.

Regards,
Randal Ferguson
Randal
 
Posts: 260
Joined: Mon Oct 24, 2005 8:04 pm

Postby Silvio » Fri Aug 18, 2006 1:30 pm

thanks very thanks
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Randal » Tue Aug 22, 2006 1:47 pm

Here is some sample code to get you started. I'm sorry it's kind of a hack job but I'd be happy to answer any questions if I can. This code works with FWH/xHarbour. You can get info on all the methods and data using the link below.

http://msdn.microsoft.com/library/defau ... OMOMap.asp


#INCLUDE "fivewin.CH"
#INCLUDE "commands.ch"

#define CRLF Chr( 13 ) + Chr( 10 )

#DEFINE geoDelimiterComma 44
#DEFINE geoDelimiterDefault 0
#DEFINE geoDelimiterSemicolon 59
#DEFINE geoDelimiterTab 9

#DEFINE geoDisplayBalloon 2
#DEFINE geoDisplayName 1
#DEFINE geoDisplayNone 0

STATIC oWndMap
STATIC oMapPoint

/*
This version calls mappoint via ole and actually opens an instance of the mappoint application
*/

PROCEDURE MapPoint()

LOCAL oMapDS
LOCAL oRecordSet
LOCAL oRoute
LOCAL oWaypoints
LOCAL aFields := {}, i
LOCAL hWnd

TRY
oMapPoint := GetActiveObject( "MapPoint.Application" )
CATCH
TRY
oMapPoint := CreateObject( "MapPoint.Application" )
CATCH
Msginfo( "Map Point not avialable." )
// For some reason, using ole2TxtError causes gpf!
* Msginfo( "ERROR! MapPoint not avialable. [" + Ole2TxtError()+ "]" )
RETURN NIL
END
END

oMapPoint:NewMap(1)
oMapPoint:Toolbars:Item("Standard"):Visible := .T.
oMapPoint:Toolbars:Item("Navigation"):Visible := .T.
oMapPoint:Toolbars:Item("Drawing"):Visible := .T.
oMapPoint:Toolbars:Item("Location and Scale"):Visible := .T.
oMapPoint:PaneState := 1 // Turn on legend for route planer

// These two only valid for mappoint application object, not a control object
oMapPoint:Visible := .T.
oMapPoint:UserControl := 1 // Give control to user

oWndMap:oClient = oMapPoint // To fill the entire window surface

// Import data - automatically adds a dataset object to the datasets collection
// There doesn't seem to be a way to create an empty dataset
// Importing seems to be the fastest way. Using FindAddressResults is way to slow...
// You can use a .csv or .Txt file. Have to specify a delimiter if using .txt
* oMapPoint:ActiveMap:DataSets:ImportData("merge.csv")
oMapPoint:ActiveMap:DataSets:ImportData("merge.txt", , ,geoDelimiterComma) // Have to specify geoDelimiterComma

* msginfo( oMapPoint:ActiveMap:DataSets:Count, "DataSets Count" )
* msginfo( oMapPoint:ActiveMap:Path, "DataSets Path" )

// Use the Item property of the DataSets object to access each DataSet objects. Can use index or name as subscript

// Set the pushpin symbol
oMapPoint:ActiveMap:DataSets:Item(1):Symbol := 1
* oMapPoint:ActiveMap:DataSets:Item(2):Symbol := 2

// Set the name of the DataSet
oMapPoint:ActiveMap:DataSets:Item(1):Name := "1"
* oMapPoint:ActiveMap:DataSets:Item(2):Name := "Route 2"

// Choose which fields to display in balloon. Defaults to name and address. Below uses all fields passing the fields collection object
FOR i := 1 TO oMapPoint:ActiveMap:DataSets:Item(1):Fields:Count
aadd( aFields,oMapPoint:ActiveMap:DataSets:Item(1):Fields[i] )
NEXT
oMapPoint:ActiveMap:DataSets:Item(1):SetFieldsVisibleInBalloon( aFields )

// Zoom to the datasets on map
oMapPoint:ActiveMap:DataSets:ZoomTo()

// Display the balloon for the first address
oMapPoint:ActiveMap:DataSets:Item(1):QueryAllRecords:Pushpin:BalloonState = geoDisplayBalloon

// Return RecordSet for DataSet
oRecordSet := oMapPoint:ActiveMap:DataSets:Item(1):QueryAllRecords

// Initialize counter subscript
i := 1
// Add WayPoints for each record in the RecordSet
DO WHILE !oRecordSet:EOF
// Add WayPoint for each location in the recordset
oMapPoint:ActiveMap:ActiveRoute:WayPoints:Add(oRecordSet:Location)
// Set the PreferredArrival time
* oMapPoint:ActiveMap:ActiveRoute:WayPoints:Item(1):PreferredArrival := oRecordSet:Fields:Item(8):Value
// Set start time for route. Although I can't read datetime data type the value can be set.
// Have to set here because there is no way to simply move to the last record in the recordset.
// The recordset is in the opposite order that the records are imported.
* IF !empty( oRecordSet:Fields:Item(8):Value )
* MSGINFO( MapTime( oRecordSet:Fields:Item(9):Value ), i )
* oMapPoint:ActiveMap:ActiveRoute:DriverProfile:StartTime := MapTime( oRecordSet:Fields:Item(9):Value )
* ENDIF
oRecordSet:MoveNext()
i++
ENDDO

// Return a Waypoints collection object
oWaypoints := oMapPoint:ActiveMap:ActiveRoute:Waypoints
// Loop thru WayPoints collection setting StopTime for each stop
* FOR i := 1 TO oWaypoints:Count
* oWaypoints:Item(i):StopTime := .125 // 3 hrs 3/24 = .125
* NEXT

// Sample code adding a pushpin using FindResults method
// Add a new pushpin set
/* oMapPoint:ActiveMap:DataSets:AddPushpinSet("NewSet 1")
oMapPoint:ActiveMap:DataSets:AddPushpinSet("NewSet 2")
// Creates a FindResults Collection object with one location object
do while !eof()
oLoc := oMapPoint:ActiveMap:FindAddressResults( alltrim(Customer->addr1), alltrim(Customer->city), alltrim(Customer->state), alltrim(Customer->zip), )
oMapPoint:ActiveMap:AddPushpin( oLoc:Item(1), alltrim( Customer->name) )
dbskip()
enddo
oMapPoint:ActiveMap:DataSets:ZoomTo()
oLoc := oMapPoint:ActiveMap:FindAddressResults("123 main st", "houston", "TX", "77074", )
oMapPoint:ActiveMap:AddPushpin( oLoc:Item(1), "John Smith" ) */

RETURN NIL
Randal
 
Posts: 260
Joined: Mon Oct 24, 2005 8:04 pm

Postby Peterg » Tue Aug 22, 2006 2:44 pm

Thankls Randal will give it a try


Peter
Peterg
 
Posts: 62
Joined: Mon Nov 28, 2005 5:36 pm
Location: Oxford UK

Postby Silvio » Tue Aug 22, 2006 4:51 pm

randal
this sample could run with Ocx microsoft map point ?
I found it at http://msdn.microsoft.com/library/defau ... pPoint.asp

Regards
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Randal » Tue Aug 22, 2006 8:12 pm

Silvio wrote:randal
this sample could run with Ocx microsoft map point ?
I found it at http://msdn.microsoft.com/library/defau ... pPoint.asp

Regards


Mappoint OCX allows you to turn on the Standard, Navigation, Drawing, Location and Scale toolbars. However I could not get FWH to respond to any mouse clicks on any of the options available on the toolbars.

You'll notice that Excel, Word, and other OCX's expose a default toolbar you can click on and the activex handles the events. I haven't been able to make this work with Mappoint.

Regards,
Randal Ferguson
Randal
 
Posts: 260
Joined: Mon Oct 24, 2005 8:04 pm

Postby Silvio » Mon Jan 29, 2007 1:23 pm

Randal
where i can download Mappoint control activex ?
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 23 guests