×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Sep 2013
    Posts
    2

    centering problem for recursive GPS data

    I'm making a MFC video player for a device.
    Videos of the device has GPS datas in video streams.
    So, I have to display the GPS position while playing videos.

    First GPS position is well displayed.
    But, it is occuring some error on MFC application while display second GPS position.
    The error message is "access denied".

    My working HTML code is here.

    ----------------------
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    	<head>
    		<meta http-equiv="X-UA-Compatible" content="IE=7; IE=EmulateIE9; IE=EmulateIE10;"/>
    		<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    		<title>Nokia Maps API for JavaScript Example: Basic map</title>
    
    		<meta name=viewport content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    		<script type="text/javascript" charset="UTF-8" src="http://api.maps.nokia.com/2.2.4/jsl.js?with=all"></script>
    
    		<style type="text/css">
    			html {
    				overflow:hidden;
    			}
    
    			body {
    				margin: 0;
    				padding: 0;
    				overflow: hidden;
    				width: 100%;
    				height: 100%;
    				position: absolute;
    			}
    			
    			#mapContainer {
    				width: 100%;
    				height: 100%;
    				left: 0;
    				top: 0;
    				position: absolute;
    			}
    		</style>
    	</head>
        <body onload="load()" onunload="GUnload()" scroll="no" silent="true">
    		<div id="mapContainer"></div>
    		<div id="uiContainer"></div>
    		<script type="text/javascript" id="exampleJsSource">
    
    		    nokia.Settings.set("appId", "K9iGlvFS7myks8QQ8ayY");
    		    nokia.Settings.set("authenticationToken", "xiTSZv0MiOC45eksCf3VfQ");
    		    
    		    var map;
    		    function load() {
    		        var mapContainer = document.getElementById("mapContainer");
    		        map = new nokia.maps.map.Display(mapContainer, {
    		            center: [37.486954, 127.033507],
    		            zoomLevel: 12,
    		            components: [new nokia.maps.map.component.Behavior()]
    		        });
    		        addMarker();
    		    }
    
    		    function addMarker() {
    		        var standardMarker = new nokia.maps.map.StandardMarker(map.center);
    		        map.objects.add(standardMarker);
    		    }
    
    		    function setLatLag(Latitude, Longitude, bFirst) {
    		        if (Latitude < -90) { Latitude = -90; }
    		        if (Latitude > 90) { Latitude = 90; }
    
    		        if (Longitude < -180) { Longitude = -180; }
    		        if (Longitude > 180) { Longitude = 180; }
    
    		        map.set("center", { lat: Latitude, lng: Longitude });
    		        addMarker();
    
    		        if (bFirst) {
    		        }
    		    }
    
    		    function refresh() {
    
    		    }
            </script>
    	</body>
    </html>
    ----------------------

    The function setLatLag() called MFC application with GPS data.
    InvokeHelper(m_dispId, DISPATCH_METHOD, VT_VARIANT, (void*)&vtResult, parms, fLatitude, fLongitude, bFirst); <-- calling in MFC

    I don't know why errors occur.
    Last edited by jasfox; 2013-09-04 at 10:33.

  2. #2
    Nokia Developer Moderator
    Join Date
    Aug 2011
    Location
    Berlin
    Posts
    288

    Re: centering problem for recursive GPS data

    I believe this is an problem/error in your calling code, not in the API itself.

    I've added a test harness to your page which calls setLatLag() on a regular basis, markers are added to a loop South of Seoul. You will need to debug part first before trying to display things on screen using the JavaScript API.

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="X-UA-Compatible" content="IE=7; IE=EmulateIE9; IE=EmulateIE10;"/>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <title>Nokia Maps API for JavaScript Example: Basic map</title>
    
    <meta name=viewport content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <script type="text/javascript" charset="UTF-8" src="http://api.maps.nokia.com/2.2.4/jsl.js?with=all"></script>
    
    <style type="text/css">
    html {
    overflow:hidden;
    }
    
    body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    width: 100%;
    height: 100%;
    position: absolute;
    }
    
    #mapContainer {
    width: 100%;
    height: 100%;
    left: 0;
    top: 0;
    position: absolute;
    }
    </style>
    </head>
    <body onload="load()" onunload="GUnload()" scroll="no" silent="true">
    <div id="mapContainer"></div>
    <div id="uiContainer"></div>
    <script type="text/javascript" id="exampleJsSource">
    
    nokia.Settings.set("appId", "K9iGlvFS7myks8QQ8ayY");
    nokia.Settings.set("authenticationToken", "xiTSZv0MiOC45eksCf3VfQ");
    
    var map;
    function load() {
    var mapContainer = document.getElementById("mapContainer");
    map = new nokia.maps.map.Display(mapContainer, {
    center: [37.486954, 127.033507],
    zoomLevel: 12,
    components: [new nokia.maps.map.component.Behavior()]
    });
    addMarker();
    
    
    // REGULARLY CALL THE SPOOF GPS
    setInterval (panTheMap, 300);
    
    }
    
    function addMarker() {
    var standardMarker = new nokia.maps.map.StandardMarker(map.center);
    map.objects.add(standardMarker);
    }
    
    function setLatLag(Latitude, Longitude, bFirst) {
    if (Latitude < -90) { Latitude = -90; }
    if (Latitude > 90) { Latitude = 90; }
    
    if (Longitude < -180) { Longitude = -180; }
    if (Longitude > 180) { Longitude = 180; }
    
    map.set("center", { lat: Latitude, lng: Longitude });
    addMarker();
    
    if (bFirst) {
    }
    }
    
    function refresh() {
    	setLatLag(Latitude, Longitude, bFirst)
    }
    
    
    
    
    // SPOOF GPS STARTS HERE
        var incX = 1;
        var incY = 2;
        var x = 0;
        var y = 0;
     
    function panTheMap()
    {  
        
        x = x + incX;
    	if (Math.abs(x) > 20 ){
        	incX = -incX;
        }
    
    	y= y + incY;
    	if (Math.abs(y) > 20 ){
        	incY = -incY;
        }
    
     
        coord = map.pixelToGeo( map.width/2 + x, map.height/2 +  y);
        setLatLag(coord.latitude, coord.longitude, false);
    } 
    
    
    </script>
    </body>
    </html>

  3. #3
    Registered User
    Join Date
    Sep 2013
    Posts
    2

    Re: centering problem for recursive GPS data

    thanks for your comment.
    I finally solved the problem.
    My HTML container was the problem.

    I modifed my HTML container like this.
    -----------------------------------
    Code:
    <html>
      <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
        <title>Nokia Maps</title>
    	<style type="text/css">
    		body,td,th {
    			font-family: Arial, Helvetica, sans-serif;
    			font-size: 12px;
    		}
    		body {
    			background-color: #F4F5F7;
    			margin-left: 0px;
    			margin-top: 0px;
    			margin-right: 0px;
    			margin-bottom: 0px;
    			background-image: url();
    		}
    		#mapContainer {
                width: 100%;
                height: 100%;
                left: 0;
                top: 0;
                position: absolute;
            }
    	</style>
    	<script type="text/javascript" src="http://api.maps.nokia.com/2.2.4/jsl.js?with=all"></script>	
    <script language="JavaScript" type="text/javascript">
    
        ....... JavaScript code............
    
        </script> 
    </head> 
      <body onload="load()" onunload="GUnload()" scroll="no" silent="true">
    	  <div id="mapContainer" style="overflow-x:hidden; overflow-y:hidden; width:100%; height:100%;"></div> 
      </body> 
    </html>
    -------------------------------------

    I think, the mapContainer setting was wrong.
    So, MFC didn't call the Javascript functions.

    Anyway, It was solved~

    Thank you very much~~
    Last edited by jasfox; 2013-09-05 at 16:18. Reason: Formatting

Similar Threads

  1. Problem centering map
    By Davud in forum [Archived] Maps API for Javascript
    Replies: 1
    Last Post: 2012-10-04, 10:43
  2. Is vertical centering of text possible?
    By MobileVisuals in forum Mobile Java General
    Replies: 10
    Last Post: 2010-07-17, 15:40
  3. Recursive function problem
    By ram4soft in forum Symbian C++
    Replies: 5
    Last Post: 2007-09-27, 20:03
  4. Recursive variable `PATH' references itself
    By Leo393 in forum Symbian C++
    Replies: 2
    Last Post: 2007-03-22, 11:24
  5. Recursive variable `PATH' references itself
    By Leo393 in forum Symbian Tools & SDKs
    Replies: 0
    Last Post: 2007-03-16, 17:14

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •