Exemplo n.º 1
0
        //得到路径插入中途点
        private async void InvokeJsGetPath()
        {
            var script = new string[1];

            if (_wayPoint.Count > 1)
            {
                for (var i = 1; i < _wayPoint.Count - 1; ++i)
                {
                    script[0] += "addWayPoint(" + _wayPoint.ElementAt(i).X + ", " + _wayPoint.ElementAt(i).Y + ");";
                }
                script[0] += "getPath(" + _wayPoint.ElementAt(0).X + "," + _wayPoint.ElementAt(0).Y + ","
                             + _wayPoint.ElementAt(_wayPoint.Count - 1).X + "," +
                             _wayPoint.ElementAt(_wayPoint.Count - 1).Y + ");";
                var result = await Webview1.InvokeScriptAsync("eval", script);
            }
            else
            {
                script[0] += "insertOneMark(" + _wayPoint[0].X
                             + "," + _wayPoint[0].Y +
                             ")";
                var result = await Webview1.InvokeScriptAsync("eval", script);

                _pathPoint.Add(_wayPoint[0]);
            }
            //Debug.WriteLine("rerutn"+result);
        }
Exemplo n.º 2
0
        //
        public StreetViewPage()
        {
            InitializeComponent();
            // 进入全屏模式
            ApplicationView.GetForCurrentView().TryEnterFullScreenMode();

            /*var localFolder = ApplicationData.Current.LocalFolder;
             * Debug.WriteLine(localFolder.Path);
             * var existingFile = localFolder.TryGetItemAsync("Test.html");
             * if (existingFile == null)
             * {
             *  Debug.WriteLine("null");
             * }*/
            var uri = new Uri("ms-appx-web:///Web/Test.html");

            Webview1.Navigate(uri);
            BackButtonControl.OnBackButtonClicked += () =>
            {
                var rootFrame = Window.Current.Content as Frame;
                ApplicationView.GetForCurrentView().ExitFullScreenMode();
                rootFrame?.GoBack();
            };
            ProgressRingGrid.Visibility = Visibility.Visible;
            ProgressRingGrid.Show();
        }
Exemplo n.º 3
0
 public GenerateAndSendReportPage()
 {
     this.InitializeComponent();
     Send.IsChecked = true;
     GenerateReport();
     Webview1.NavigateToString(htmlOUT);
 }
Exemplo n.º 4
0
 //嵌入移动
 private async void InvokeJsMove(string x, string y, string heading)
 {
     string[] script =
     {
         "setStreetViewPositon(" + x
         + "," + y
         + "," + heading
         + ")"
     };
     await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() =>
     {
         var result = await Webview1.InvokeScriptAsync("eval", script);
         StreetViewControl(result);
     });
 }
Exemplo n.º 5
0
        //测试点击label
        private void TestClick(int nodeNum, int wayNum)
        {
            var completed  = false;
            var delay      = TimeSpan.FromSeconds(0.5);
            var delayTimer = ThreadPoolTimer.CreateTimer
                             // ReSharper disable once ImplicitlyCapturedClosure
                                 (source => { completed = true; }, delay, async source =>
            {
                await Dispatcher.RunAsync(
                    CoreDispatcherPriority.High,
                    async() =>
                {
                    if (!completed)
                    {
                        return;
                    }
                    string[] args = { "getClick()" };
                    var result    = await Webview1.InvokeScriptAsync("eval", args);
                    if (result == "click")
                    {
                        _tmpNodeNum        = nodeNum;                     //保护现场
                        _tmpWayNum         = wayNum;                      //保护现场
                        var thisPointPhoto = new List <ImageViewModel>(); //得出改点的图片
                        var list           = _clusteringResult.ElementAt(wayNum - 1);
                        //Debug.WriteLine("click" + (wayNum - 1));
                        for (var i = 0; i < list.Count; ++i)
                        {
                            thisPointPhoto.Add(_test[list.ElementAt(i)]);
                        }
                        StreetGalleryControl.StreetImageListViewModel.AddImages(thisPointPhoto);
                        StreetGalleryControl.SetBackground();
                        StreetGalleryControl.Shown = true;

                        //if (nodeNum<_pathPoint.Count)
                        //    ShowPath(nodeNum, wayNum);
                        //else InvokeJsEnd();//结束
                    }
                    else
                    {
                        TestClick(nodeNum, wayNum);
                    }
                    // Timer completed.
                });
            });
        }
Exemplo n.º 6
0
 private async void InvokeJsStart(string x, string y)
 {
     /*string[] script = { "panorama=new google.maps.StreetViewPanorama("+
      * "document.getElementById('street-view'),"+
      * "{position: { lat: "+x+", lng:"+y+"},"+
      * "pov: { heading: 90, pitch: 0},"+
      * "});" };*/
     string[] script =
     {
         "firstSetPanorama(" + x + "," + y + ");"
     };
     await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() =>
     {
         await Webview1.InvokeScriptAsync("eval", new[] { "setIsGetPath()" });
         var result = await Webview1.InvokeScriptAsync("eval", script);
         Debug.WriteLine("first" + result);
     });
 }
Exemplo n.º 7
0
 private void DelayGetPath()
 {
     var delay      = TimeSpan.FromSeconds(2);
     var delayTimer = ThreadPoolTimer.CreateTimer
                          (async source =>
     {
         await Dispatcher.RunAsync(
             CoreDispatcherPriority.High,
             async() =>
         {
             var result = await Webview1.InvokeScriptAsync("eval", new[] { "getNetCheck()" });
             Debug.WriteLine(result);
             if (result.Equals("Y"))
             {
                 InvokeJsGetPath();     //得出路径
             }
             else
             {
                 Debug.WriteLine("network wrong!");
             }
         });
     }, delay);
 }
Exemplo n.º 8
0
        //嵌入朝向
        private void InvokeJsHeading(int tmpNodeNum)
        {
            Debug.WriteLine("insert label");
            var delay      = TimeSpan.FromSeconds(2);
            var delayTimer = ThreadPoolTimer.CreateTimer
                                 (async source =>
            {
                await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() =>
                {
                    string[] insertMessage =
                    {
                        "insertMark(" +
                        _pathPoint[tmpNodeNum].X +
                        "," + _pathPoint[tmpNodeNum].Y +
                        "," + tmpNodeNum + ")"
                    };
                    var result = await Webview1.InvokeScriptAsync("eval", insertMessage);

                    /*string[] args = {"setMarkHeading()"};
                     * result = await Webview1.InvokeScriptAsync("eval", args); //镜头转换,待改善
                     * Debug.WriteLine("result" + result);*/
                });
            }, delay);
        }
Exemplo n.º 9
0
        //测试得到路径
        private void TestGetPath()
        {
            var completed  = false;
            var delay      = TimeSpan.FromSeconds(0.5);
            var delayTimer = ThreadPoolTimer.CreateTimer
                             // ReSharper disable once ImplicitlyCapturedClosure
                                 (source => { completed = true; }, delay, async source =>
            {
                await Dispatcher.RunAsync(
                    CoreDispatcherPriority.High,
                    async() =>
                {
                    if (!completed)
                    {
                        return;
                    }
                    string[] args = { "testIsGetPath()" };
                    var result    = await Webview1.InvokeScriptAsync("eval", args);
                    if (result == "Y")
                    {
                        _hasPath = true;
                        await Webview1.InvokeScriptAsync("eval", new[] { "setIsGetPath()" });
                        var tmp       = await Webview1.InvokeScriptAsync("eval", new[] { "getPathPoint()" });
                        var pathArray = tmp.Split('\n');
                        //Debug.WriteLine("path point length" + pathArray.Length);

                        /*HashSet<int> deletePoint = new HashSet<int>();//稀疏掉的数组
                         * if (pathArray.Length > 80) //稀疏点
                         * {
                         *  var interval = pathArray.Length / ((pathArray.Length - 80 + 1) * 1.0);
                         *  var cot = interval;
                         *  while (cot < pathArray.Length)
                         *  {
                         *      deletePoint.Add((int) cot);
                         *      cot += interval;
                         *  }
                         *  if (deletePoint.Contains(pathArray.Length)) deletePoint.Remove(pathArray.Length);
                         * }
                         * int cotNum = 0;*/
                        for (var i = 0; i < pathArray.Length; ++i)
                        {
                            if (pathArray[i].Length >= 3)
                            {
                                var pointArray = pathArray[i].Split(',');
                                var lat        = Convert.ToDouble(pointArray[0]);
                                var lng        = Convert.ToDouble(pointArray[1]);
                                _pathPoint.Add(new Point(lat, lng));
                            }
                        }
                        //Debug.WriteLine("path point length(after relax)" + _pathPoint.Count);
                        //for (int i = 0; i < _pathPoint.Count; ++i) Debug.WriteLine(_pathPoint.ElementAt(i));
                        //嵌入_waypoint点
                        InsertWayPoint();
                        //for (int i = 0; i < _pathPoint.Count; ++i) Debug.WriteLine(i + " " + _pathPoint.ElementAt(i));
                        StartWalk();
                    }
                    else
                    {
                        TestGetPath();
                    }
                    // Timer completed.
                });
            });
        }
Exemplo n.º 10
0
 //移动结束
 private async void InvokeJsEnd()
 {
     await Webview1.InvokeScriptAsync("eval", new[] { "streetShowEnd()" });
 }