Plug-ins User Guide

Version 5.2 | Published March 20, 2024 ©

NavCom

images/download/thumbnails/57216864/ncom_ico.png

The NavCom plug-in controls the Navigator plug-in. The plug-in is an example showing how to externally control the Navigator plug-in when special applications should be used to control the scene. An example for a special case where external control of the Navigator plug-in is required is Elections. When using Viz 3.x scripting, complicated logic and commands can be used with the NavCom plug-in.

Note: This plug-in is located in: Plugins -> Container plug-ins -> Maps_Adv

NavCom Properties

Commands

The Commands tab is used for communicating with the Navigator plug-in in means of sending formatted commands and receiving formatted responses from the Navigator plug-in.

The Command text field is where you enter the command. The NavCom plug-in receives predefined, fixed syntax, commands and returns a reply from the Navigator plug-in. The Response field contains the reply returned from the Navigator plug-in. The format of the reply is defined in the Advanced tab. The Immediate Response option defines whether the command is sent while typing (every change to the command field sends the command to Navigator), or only after pressing the Execute Command button.

The following is a list of commands, example commands and return values:

  • Mouse To Lon Lat: Converts screen coordinates to Long/Lat values from the map. This needs the Navigator plug-in.

    • Command: MTLL x y

    • Response: lon lat

      MTLL 360 288 -116.998 38.088


  • Mouse To Region: Returns the region name in which the given screen coordinates reside. This command requires the Navigator plug-in.

    • Command: MTR x y

    • Response: CountryID "Country Name" RegionID "Region Name" SubRegionID "Sub Region Name"

      MTR 360 288 1000000000003600 "United States of America" 1000000000038901 "Texas" 1000000000111302 "Atascosa County"

      All Fly To commands require the Navigator and the NavFinder plug-in. Also set the Navigator plug-in’s Interactive Anim setting to On.

  • Fly To Region ID: Triggers a Navigator animation from the current location to the sent region (RegionID).

    • Command: FTRID RegionID

      FTRID 81000000000F8285


  • Fly To Country: Triggers a Navigator animation from the current location to the sent country (country name).

    • Command: FTC "country name"

      FTC "united states of America"


  • Fly To Region: Triggers a Navigator animation from the current location to the sent region (Region name).

    • Command: FTR "country" "Region"

      FTR "united states of America" "Texas"


  • Fly To Sub Region: Triggers a Navigator animation from the current location to the sent sub region (by name).

    • Command: FTSR "country" "Region" "Sub Region"

      FTSR "united states of America" "Texas" "young county"


  • Fly To Lon Lat Level: Triggers a Navigator animation from the current location to the sent level area (country, region, or sub region) that the long/lat data resides in.

    • Command: FTLLL lon lat level

      FTLLL -116.998 38.088 1

      Note: Levels are: 0 = Country, 1 = Region, 2 = Sub Region


  • Search database: Searches the map database and as a response generates an XML. This command requires a running Viz World server.

    • Command: SMDB <query>

  • Search web: Searches the web and as a response generates an XML. This command requires a running Viz World server.

    • Command: SWEB <query>

  • Search All: Searches both resources (map database and web) and as a response generates an XML. This command requires a running Viz World server.

    • Command: SALL <query>

    • Shared memory reply: WS_REPLY

  • Nearby: Searches locations in the vicinity of the coordinates of your “mouse” and as a response generates an XML. This command requires a running Viz World server. This command requires the Navigator plug-in.

    • Command: NEARBY [mouse-x] [mouse-y]

    • Shared memory reply: NAV_NEARBY_REPLY

      Shared Navigation memory of the Navigator plug-in can be activated by setting Publish Geo Data to Bounding box or Location. If Bounding box is selected you get, in addition to Bounding box data, Center and Distance data. If Location is selected you get, in addition to the Location data, all the others. If None is selected, no data is shared. All can be used with scripting to define e.g. the administration levels the script should fetch from the shared data and consequently display it on screen. For interactive scenes such as touch screens this can be used for adding graphics to maps based on your selection (thereby avoiding over-populating the map with information). For testing you can enable the interactive mode by clicking the E button in Viz Artist’s Scene Editor.

  • Navigation location: Shared data holding the current geographic location(s) of the Navigator plug-in. To enable it, select Publish Geo Data’s Location option. The data is updated when the camera is not moving. Navigation location also generates an XML with the current geographic location(s) (in the same format as SMDB, SWEB, SALL and NEARBY). This requires a running Viz World Server.

    • Name: NAV_LOCATION_DATA

  • Navigation bounding box: Shared memory data holding the current (frame by frame) geographic bounding box (lat lon) of the Navigator plug-in. To enable it, select Publish Geo Data’s Bounding box or Location option.

    • Reply: NAV_BB_DATA

  • Navigation center: Shared memory data holding the current (frame by frame) geographic center of the Navigator plug-in. To enable it, select Publish Geo Data’s Bounding box or Location option.

    • Reply: NAV_CENTER_DATA

  • Navigation distance: Shared memory with the current distance to world of the Navigator plug-in. To enable it, select Publish Geo Data’s Bounding box or Location option.

    • Reply: NAV_DISTANCE_DATA

  • Navigation direction: Shared memory with the current pan and tilt direction of the Navigator plug-in. To enable it, select Publish Geo Data’s Bounding box or Location option.

    • Reply: NAV_DIRECTION_DATA

Control

The Control tab is used to directly control the Navigator plug-in by changing the values of the parameters.

  • Longitude: Sets the longitude value for the Navigator plug-in. The Navigator camera moves to the specified longitude value.

  • Latitude: Sets the latitude value for the Navigator plug-in. The Navigator camera moves to the specified latitude value.

  • Distance: Sets the Navigator distance from the map. The Navigator camera moves to the specified distance value.

  • Pan: Sets the pan value of the Navigator camera.

  • Tilt: Sets the tilt value of the Navigator camera.

  • Interactive Mode: Defines the interactive behavior of Viz.

    • None: Disables interactive mode.

    • Editor: Enables interactive mode during scene editing.

    • On Air: Enables interactive mode when Viz Engine is in On Air mode.

    • Always: Enables interactive mode during scene editing and when Viz Engine is in On Air mode.

  • Minimum Distance: Sets the minimum distance from the map in Viz units.

  • Zoom Center: Used in interactive mode.

    • Position: Zooms the map to center on the position of the fingers.

    • Center: Zooms to the center of the map.

  • Momentum Mode: Sets how much friction should be applied to the momentum when set to Linear.

    Note: The Navigator control parameters affect the Navigator immediately.

Advanced

The Advanced tab is used for defining the NavCom plug-in’s general behavior patterns.

  • Shape File Support: Defines whether the NavCom plug-in includes shape objects information in the response. The Shape objects must reside under the NavCom container.

    • Disabled: Does not return shape object information.

    • Limited: Scans the shape files below the container. When a command is received, the NavCom plug-in returns information about the shapes that overlap the requested data in the command in the response string.

    • Only: Scans the shape files below the container. When a command is received, the NavCom plug-in returns only the information about the shapes that overlap the requested data in the command in the response string.

  • Limit Picking: Limits the geographical area that the NavCom plug-in performs any of the commands on. When Limit Picking is enabled the Limit to Country parameter is enabled.

    • Limit to Country: Sets the country name. If the requested data in the command does not exist for the defined country area, the command is not executed. Only commands relating to points within the country area are executed.

  • Shared Memory Prefix: Distinguishes between the data sent to each plug-in when using more than one NavCom plug-in in the scene, and when using scripting to send and receive information from these plug-ins. In each NavCom plug-in, set the Shared Memory Prefix to a different prefix (up to four).

  • Protocol Mode: Defines the data displayed in the Response field.

    • Full: Includes data on names and IDs for countries, regions and sub-regions.

    • Name: Includes data on names for the countries, regions and sub-regions.

    • ID: Includes only ID data (as defined in the Viz World Server) for the countries, regions and sub-regions.

  • Protocol Separator: Defines the separating character between the Response data. The defined separator is used between country and region, region and sub-region, and so on.

  • Use Quotes: Defines whether the response string is quoted or not.

  • Suffix FIPS: Used for USA regions and sub-regions.

  • Publish Geo Data: Allows you to publish navigation data to shared memory based on your interaction with the graphics scene (e.g. touchscreen or mouse). Shared Navigation memory can be activated by setting to Bounding box or Location. See the available Navigation data under the Commands section.

    • Bounding box: Sends Center and Distance data in addition to Bounding box data.

    • Location: Sends all the others in addition to the Location data.

    • None: Does not share data.

  • Execute Command: Executes the defined command when pressed.

  • Initialize: Rescans the shape objects if the shape objects under the NavCom container are changed. This button is used when using shape file support.

NavCom Scripting

Viz 3.X scripting ability is a powerful tool for implementing complex logic into a scene. In a Navigator scene, NavCom can be used in the scripts to enable such advanced Navigator operations. The following script example demonstrates how to send and receive data from the Navigator plug-in through to the NavCom plug-in.

Example: Script example: main.txt

dim level as Integer
dim ignore as Integer
dim CurCountry as string
dim CurCountryId as string
dim CurState as string
dim CurStateId as string
dim CurCounty as string
dim CurCountyId as string
 
Sub UpdateCurrent(temp As String)
dim position as Integer
dim temp2 as String
println temp
CurCountryId = temp.left(16)
position = temp.Find("\"")
temp = temp.GetSubstring(position+1,temp.Length-(position+1) )
temp2 = temp position = temp2.Find("\"")
CurCountry = temp2.Left(position)
println "<" & CurCountryId & "><" & CurCountry & ">"
position = temp.Find("\"")
temp = temp.GetSubstring(position+2,temp.Length-(position+2) )
CurStateId = temp.left(16)
position = temp.Find("\"")
temp = temp.GetSubstring(position+1,temp.Length-(position+1) )
temp2 = temp
position = temp2.Find("\"")
CurState = temp2.Left(position)
println "<" & CurStateId & "><" & CurState & ">"
position = temp.Find("\"")
temp = temp.GetSubstring(position+2,temp.Length-(position+2) )
CurCountyId = temp.left(16)
position = temp.Find("\"")
temp = temp.GetSubstring(position+1,temp.Length-(position+1) )
temp2 = temp
position = temp2.Find("\"")
CurCounty = temp2.Left(position)
println "<" & CurCountyId & "><" & CurCounty & ">"
End Sub
 
Sub OnInit()
ignore = 0
level = 1
if Scene.Map.ContainsKey("MTR") = false Then
Scene.Map.CreateKey("MTR")
End If
if Scene.Map.ContainsKey("FTRID") = false Then
Scene.Map.CreateKey("FTRID")
End If
if Scene.Map.ContainsKey("FTC") = false Then
Scene.Map.CreateKey("FTC")
End If
if Scene.Map.ContainsKey("FTR") = false Then
Scene.Map.CreateKey("FTR")
End If
if Scene.Map.ContainsKey("FTSR") = false Then
Scene.Map.CreateKey("FTSR")
End If
if Scene.Map.ContainsKey("FTLLL") = false Then
Scene.Map.CreateKey("FTLLL")
End If
if Scene.Map.ContainsKey("MTR_REPLY") = false Then
Scene.Map.CreateKey("MTR_REPLY")
End If
if Scene.Map.ContainsKey("FTRID_REPLY") = false Then
Scene.Map.CreateKey("FTRID_REPLY")
End If
Scene.Map.RegisterChangedCallback("MTR_REPLY")
System.Map.RegisterChangedCallback("REGION_L")
End Sub
 
Sub OnSharedMemoryVariableChanged(map As SharedMemory, mapKey As String)
println mapKey
dim temp as String
If mapKey = "REGION_L" Then
println "ignore pre"
ignore = 1
else If mapKey = "MTR_REPLY" Then
temp = Scene.Map["MTR_REPLY"]
UpdateCurrent(temp)
println System.Map["REGION_L"]
if System.Map["REGION_L"] = "1" then
Scene.Map["FTRID"] = CurCountryId
elseif System.Map["REGION_L"] = "2" then
Scene.Map["FTRID"] = CurStateId
elseif System.Map["REGION_L"] = "3" then
Scene.Map["FTRID"] = CurCountyId
End If
End If
If mapKey = "MTLL_REPLY" Then
println Scene.Map["MTLL_REPLY"]
End If
End Sub
 
sub OnLButtonDown()
dim temp as String
if System.MouseX < (System.RenderWindowWidth: 120 ) then
Scene.Map["MTR"] = (String)
System.MouseX & " " & (String)System.MouseY
end if
end sub