1 / 26

PWB 505: Using MS MapPoint in PowerBuilder

PWB 505: Using MS MapPoint in PowerBuilder. Arthur Hefti CEO arthur@catsoft.ch 17. August 2004. Content Overview. Speaker introduction Why GIS data MS MapPoint control in PowerBuilder OLE automation with MS MapPoint Presentation of a service application. Speaker Introduction.

tad-pitts
Download Presentation

PWB 505: Using MS MapPoint in PowerBuilder

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. PWB 505: Using MS MapPoint in PowerBuilder Arthur Hefti CEO arthur@catsoft.ch 17. August 2004

  2. Content Overview • Speaker introduction • Why GIS data • MS MapPoint control in PowerBuilder • OLE automation with MS MapPoint • Presentation of a service application

  3. Speaker Introduction • Arthur Hefti • PowerBuilder developer since 1993 • CPD Professional, CP Instructor • President Swiss PowerBuilder User Group for 5 years • CEO of CATsoft Development GmbH, Zurich, Switzerland • Custom made software development and consulting • Client / Server and Web • Web: http://www.catsoft.net or http://www.catsoft.ch • Email: arthur@catsoft.ch

  4. Why GIS Data • Planning a route • Service technician • Sales person • Tracking position • Delivery of goods • Driving instructions • Detailed directions

  5. MS MapPoint Control

  6. Important Objects • MapPoint control • Map object • Pushpins • Route • Directions • WayPoints • DataSet • FindResults collection • Location object

  7. MapPoint Control • Window painter ► Insert Control ► OLE ...

  8. Loading Map Data • Load the map into the control ioo_Map = ole_Map.Object.NewMap( 2 ) // 1 = North America, 2 = Europe • Unload at the end • ole_Map.Object.CloseMap()

  9. Finding Locations • Find the location • Returns a collection of locations including quality of the result loo_Found = ioo_Map.FindAddressResults( <Street>, <City>, <Othercity>, & <Region>, <Zip>, <Country> ) IF loo_Found.ResultsQuality = 1 /*geoFindResultGood*/ THEN loo_Location = loo_Found.Item(1) ELSE // Let the user manually select one location ..... • Add pushpins loo_Pin = ioo_Map.AddPushpin( loo_Location, “Pushpin 1” )

  10. Working With DataSets And Pushpins • Pushpins are added to the „My Pushpins“ set loo_Pin = ioo_Map.AddPushpin( loo_Location, “Pushpin 1” ) • Create your own set ioo_Tour = ioo_Map.DataSets.AddPushPinSet( "MyTour" ) • Move pushpins between DataSets loo_Pin.MoveTo( ioo_Tour ) • DataSets allow to access groups of data ioo_Tour.FieldNamesVisibleInBalloon = TRUE

  11. The Route • Get route object and reset it ioo_Route = ioo_Map.ActiveRoute loo_Route.Clear() • Get waypoint object and add pushpins loo_WayPoints = loo_Route.WayPoints loo_WayPoints.Add( loo_Pin1 ) loo_WayPoints.Add( loo_Pin2 ) • Draw the route Ioo_Route.Calculate()

  12. User Interaction With The Map • Default behavior • Allow or overwrite • Events • Notification of Map Control • Methods • Managing the Map Control

  13. Default Behavior • Right mouse button menu • Zoom • Export to Excel • Route creation • Show Pushpin Information • Left mouse button • Moving of Pushpins • Scrolling the map • Mouse wheel • Zoom

  14. Events • Various events for interaction and state changes • Most important events for user interaction • beforeclick: Display some information about clicked object(s) • beforedblclick: Execute some action • mousedown: Save mouse pointer position • Other events • afterredraw • routeaftercalculate

  15. Methods • Opening map data • NewMap() • Loading and saving maps • OpenMap() • SaveMap() • Closing • CloseMap()

  16. OLE Automation With MapPoint • Used if no visual part is needed • Calculation of distance or driving time • Getting directions

  17. Preparing The Map • Creating a new instance OleObject ioo_App, ioo_Map ioo_App = CREATE OleObject ioo_App.ConnectToNewObject( "MapPoint.Application" ) • Get active map ioo_Map = ioo_App.ActiveMap

  18. Calculate Distance And Driving Time • Initialize route • Create route • Calculate the route • Return distance

  19. Initialize Route • Initialize route loo_Route = ioo_Map.ActiveRoute loo_Route.Clear() loo_WayPoints = loo_Route.WayPoints

  20. Create Route • Find the location • Returns a collection of locations including quality of the result loo_Found = ioo_Map.FindAddressResults( ls_Street, ls_City, "", ls_Region, & ls_PostalCode, ll_CountryCode ) IF loo_Found.ResultsQuality = 1 /*geoFindResultGood*/ THEN loo_Location = loo_Found.Item(1) ... • Add pushpins loo_Pin = ioo_Map.AddPushpin( loo_Location, "Item" + String( li_Counter ) ) loo_WayPoints.Add( loo_Pin )

  21. Calculate The Route • Calculate and catch a possible runtime error TRY loo_Route.Calculate() CATCH (OLERuntimeError err) MessageBox( “Error”, “Calculating Route”, StopSign! ) END TRY

  22. Get Distance Or Driving Time • Create route ll_Distance = loo_Route.Distance ll_DrivingTime = Long( loo_Route.DrivingTime * 24 * 60 )

  23. Get Directions • Create and calculate route • Same as for getting distance and driving time • Get all direction information loo_Directions = loo_Route.Directions FOR li_Counter = 1 TO loo_Directions.Count loo_DirectionEntry = looDirections.Item( li_Counter ) ls_Dir = ls_Dir + loo_DirectionEntry.Instruction + Char(13) + Char(10) NEXT

  24. Key Figures For Demo Application • Application is used in service company • 2200 places to visit by 35 technicans in peak month • 1200 places and 10 technicans planned at the same time • Used in different locations across Switzerland • Runing in LAN and on Citrix

  25. Demo

  26. Questions?

More Related