slide1 n.
Download
Skip this Video
Download Presentation
PWB 505: Using MS MapPoint in PowerBuilder

Loading in 2 Seconds...

play fullscreen
1 / 26

PWB 505: Using MS MapPoint in PowerBuilder - PowerPoint PPT Presentation


  • 158 Views
  • Uploaded on

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.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'PWB 505: Using MS MapPoint in PowerBuilder' - tad-pitts


Download Now 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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
slide1

PWB 505: Using MS MapPoint in PowerBuilder

Arthur Hefti

CEO

arthur@catsoft.ch

17. August 2004

content overview
Content Overview
  • Speaker introduction
  • Why GIS data
  • MS MapPoint control in PowerBuilder
  • OLE automation with MS MapPoint
  • Presentation of a service application
speaker introduction
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
why gis data
Why GIS Data
  • Planning a route
    • Service technician
    • Sales person
  • Tracking position
    • Delivery of goods
  • Driving instructions
    • Detailed directions
important objects
Important Objects
  • MapPoint control
  • Map object
  • Pushpins
  • Route
    • Directions
    • WayPoints
  • DataSet
    • FindResults collection
    • Location object
mappoint control
MapPoint Control
  • Window painter ► Insert Control ► OLE ...
loading map data
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()
finding locations
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” )

working with datasets and pushpins
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

the route
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()

user interaction with the map
User Interaction With The Map
  • Default behavior
    • Allow or overwrite
  • Events
    • Notification of Map Control
  • Methods
    • Managing the Map Control
default behavior
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
events
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
methods
Methods
  • Opening map data
    • NewMap()
  • Loading and saving maps
    • OpenMap()
    • SaveMap()
  • Closing
    • CloseMap()
ole automation with mappoint
OLE Automation With MapPoint
  • Used if no visual part is needed
  • Calculation of distance or driving time
  • Getting directions
preparing the map
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

calculate distance and driving time
Calculate Distance And Driving Time
  • Initialize route
  • Create route
  • Calculate the route
  • Return distance
initialize route
Initialize Route
  • Initialize route

loo_Route = ioo_Map.ActiveRoute

loo_Route.Clear()

loo_WayPoints = loo_Route.WayPoints

create route
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 )

calculate the route
Calculate The Route
  • Calculate and catch a possible runtime error

TRY

loo_Route.Calculate()

CATCH (OLERuntimeError err)

MessageBox( “Error”, “Calculating Route”, StopSign! )

END TRY

get distance or driving time
Get Distance Or Driving Time
  • Create route

ll_Distance = loo_Route.Distance

ll_DrivingTime = Long( loo_Route.DrivingTime * 24 * 60 )

get directions
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

key figures for demo application
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
ad