120 likes | 238 Views
How to Implement Real Time Vehicle/Asset Tracking within the Smallworld GIS Application. Presented By: Mark Field Field Consulting and Services, Inc. Requirements. Need to quickly update graphics system. In the order of less then 1 second.
E N D
How to Implement Real Time Vehicle/Asset Tracking within the Smallworld GIS Application Presented By: Mark Field Field Consulting and Services, Inc.
Requirements • Need to quickly update graphics system. • In the order of less then 1 second. • Our requirement was to show 1000+ updatable entities, • Support selection of entities. • Support multiple symbols depending on type of entity. How to Implement Real Time Vehicle/Asset Tracking within the Smallworld GIS Application
Limitations with Smallworld Core Spatial Technology™ • Slow refresh. • Approximately 5 seconds to draw basic geometry • Approximately 10 seconds to draw with rasters. • Even refreshing just bounds of 1000+ entities would be slow. • As well as distracting. • Add-on geometry drawing is limited. • Must provide data to databus in Smallworld Core Spatial Technology (CST) 4 with :geometry_to_draw or :post_render_sets How to Implement Real Time Vehicle/Asset Tracking within the Smallworld GIS Application
FCSI Solution Overview • Basic idea: DOUBLE BUFFERING • Real time technique to draw data in memory, and ‘pop’ the frame to the view. • Prevents the noticeable drawing of individual features, which contribute to “flickering.” • Double Buffering Example How to Implement Real Time Vehicle/Asset Tracking within the Smallworld GIS Application
FCSI Solution Overview • Use a memory canvas to record what has been drawn by the GIS. • Store the base memory canvas. • Draw the vehicle positions on a copy of the memory canvas. • Display the modified memory canvas to the user • Exemplar: fcsi_fast_display How to Implement Real Time Vehicle/Asset Tracking within the Smallworld GIS Application
Canvas Copying SWAF canvas after refresh is complete Copy canvas to memory_canvas Draw Geometries on memory_canvas Replace modified memory_canvas to SWAF canvas Update loop How to Implement Real Time Vehicle/Asset Tracking within the Smallworld GIS Application
Memory Canvas Details • Need to know when refresh is started. • For pre-CST 4: dependency of graphics system, (:start_refresh) • For CST 4: databus, (:fcsi_start_refresh) • Need to know when the drawing is complete. • For pre-CST 4: dependency of graphics system, (refreshed) • For CST 4: databus, (: fcsi_end_refresh) • post_render_sets doesn’t truly work • Store the window to a memory canvas using fcsi_reset_memory_canvas() • Uses memory_canvas.copy_area() • Draw vehicle geometry on the memory canvas with fcsi_draw_geoms() • Uses memory_canvas.draw() • Copy the memory canvas data to the graphics view canvas. • Uses memory_canvas.copy_area() How to Implement Real Time Vehicle/Asset Tracking within the Smallworld GIS Application
Geometry Details • Dynamic Geometry is stored in .fcsi_geoms • Styles for dynamic geometry stored in .fcsi_styles. • .fcsi_geoms[n] uses .fcsi_styles[n] style • Need to get handles to symbology. • Get handle to a symbol from the style system, or • Create symbol, or • For point symbols, can be basic sector data with line style that can be used as a point symbol. • Loop over the geometry you want to draw and use memory_canvas.draw() with style. • Any geometry and style can be drawn, points, lines, areas, etc. How to Implement Real Time Vehicle/Asset Tracking within the Smallworld GIS Application
Example Display Details • fcsi_pvd_menu exemplar • Simple example of fcsi_fast_display. • Creates/stores routes from node to node • Allows you to select a dynamic geometry • Open GUI: • fcsi_pvd_menu.open(grs) or • fcsi_pvd_menu.open(appl) • Set Manifold • Select geometry • Set Manifold • Interactively create routes using trail. • Create 2 point trail identifying start and end nodes for route. • Or randomly create routes using trail bounds • Use fcsi_get_test_paths(num) How to Implement Real Time Vehicle/Asset Tracking within the Smallworld GIS Application
Example Display Details (cont.) • Set Delay (milliseconds) • Run. • The engine loop calculates new coordinate along route by 5m. • Updates the .fcsi_geoms slot with new coordinates. • Calls fast_display.fcsi_update_view(). • Sleeps for the given delay. • Select dynamic geometry. • Pauses engine loop. • Selects closest coordinate in .fcsi_geoms list. How to Implement Real Time Vehicle/Asset Tracking within the Smallworld GIS Application
Extending Implementation • Can realistically be any process, internal or external (ACP). • Example code moves the current location 5m down trace result, but can be any type of data. • Future Updates • Pause when panning/zooming • Would need dependency of “current_state” of the application. • After new selection – recreate base memory canvas • Contact FCSI • info@field-csi.com • 407-275-9351 How to Implement Real Time Vehicle/Asset Tracking within the Smallworld GIS Application
Demonstration • This demonstration will show 1000 entities. • There are 1000 paths that have been randomly generated. • 1 path for 1 entity • Each iteration of the main loop: • Updates the position of each entity by 10 meters along each path. • Stores updated coordinate and distance in ropes • At end of all updates, display results • The road works symbol is a basic X from the style system. • Simple selection of entity will report it’s ID (position in rope). How to Implement Real Time Vehicle/Asset Tracking within the Smallworld GIS Application