久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<small id='8Tfuq'></small><noframes id='8Tfuq'>

  • <legend id='8Tfuq'><style id='8Tfuq'><dir id='8Tfuq'><q id='8Tfuq'></q></dir></style></legend>
      <bdo id='8Tfuq'></bdo><ul id='8Tfuq'></ul>
      <i id='8Tfuq'><tr id='8Tfuq'><dt id='8Tfuq'><q id='8Tfuq'><span id='8Tfuq'><b id='8Tfuq'><form id='8Tfuq'><ins id='8Tfuq'></ins><ul id='8Tfuq'></ul><sub id='8Tfuq'></sub></form><legend id='8Tfuq'></legend><bdo id='8Tfuq'><pre id='8Tfuq'><center id='8Tfuq'></center></pre></bdo></b><th id='8Tfuq'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='8Tfuq'><tfoot id='8Tfuq'></tfoot><dl id='8Tfuq'><fieldset id='8Tfuq'></fieldset></dl></div>

        <tfoot id='8Tfuq'></tfoot>
      1. Android 地理圍欄(多邊形)

        Android Geofencing (Polygon)(Android 地理圍欄(多邊形))

              <tbody id='s6xnZ'></tbody>

          1. <tfoot id='s6xnZ'></tfoot>
              <legend id='s6xnZ'><style id='s6xnZ'><dir id='s6xnZ'><q id='s6xnZ'></q></dir></style></legend>
            1. <i id='s6xnZ'><tr id='s6xnZ'><dt id='s6xnZ'><q id='s6xnZ'><span id='s6xnZ'><b id='s6xnZ'><form id='s6xnZ'><ins id='s6xnZ'></ins><ul id='s6xnZ'></ul><sub id='s6xnZ'></sub></form><legend id='s6xnZ'></legend><bdo id='s6xnZ'><pre id='s6xnZ'><center id='s6xnZ'></center></pre></bdo></b><th id='s6xnZ'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='s6xnZ'><tfoot id='s6xnZ'></tfoot><dl id='s6xnZ'><fieldset id='s6xnZ'></fieldset></dl></div>

              <small id='s6xnZ'></small><noframes id='s6xnZ'>

                <bdo id='s6xnZ'></bdo><ul id='s6xnZ'></ul>
                  本文介紹了Android 地理圍欄(多邊形)的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  如何從多個地理位置(經(jīng)緯度值)創(chuàng)建多邊形地理圍欄.此外,如何跟蹤用戶是進入這個地理圍欄區(qū)域還是在 android 上退出這個區(qū)域.

                  How to create Polygon Geofence from multiple geo locations(long,lat values) . Also how to track user is entering into this geofence region or exiting from this region on android.

                  推薦答案

                  地理圍欄只是一個組成多邊形的緯度/經(jīng)度點的數(shù)組.獲得緯度/經(jīng)度點列表后,您可以使用點內多邊形檢查來查看某個位置是否在多邊形內.

                  A geofence is simply an array of lat/long points that form a polygon. Once you have a list of lat/long points, you can use a point-inside-polygon check to see if a location is within the polygon.

                  這是我在自己的項目中用于對非常大的凹多邊形(20K+ 頂點)執(zhí)行多邊形點檢查的代碼:

                  This is code I have used in my own projects to perform point-in-polygon checks for very large concave polygons (20K+ vertices):

                  public class PolygonTest
                  {
                      class LatLng
                      {
                          double Latitude;
                          double Longitude;
                  
                          LatLng(double lat, double lon)
                          {
                              Latitude = lat;
                              Longitude = lon;
                          }
                      }
                  
                      bool PointIsInRegion(double x, double y, LatLng[] thePath)
                      {
                          int crossings = 0;
                  
                          LatLng point = new LatLng (x, y);
                          int count = thePath.length;
                          // for each edge
                          for (var i=0; i < count; i++) 
                          {
                              var a = thePath [i];
                              var j = i + 1;
                              if (j >= count) 
                              {
                                  j = 0;
                              }
                              var b = thePath [j];
                              if (RayCrossesSegment(point, a, b)) 
                              {
                                  crossings++;
                              }
                          }
                          // odd number of crossings?
                          return (crossings % 2 == 1);
                      }
                  
                      bool RayCrossesSegment(LatLng point, LatLng a, LatLng b)
                      {
                          var px = point.Longitude;
                          var py = point.Latitude;
                          var ax = a.Longitude;
                          var ay = a.Latitude;
                          var bx = b.Longitude;
                          var by = b.Latitude;
                          if (ay > by)
                          {
                              ax = b.Longitude;
                              ay = b.Latitude;
                              bx = a.Longitude;
                              by = a.Latitude;
                          }
                              // alter longitude to cater for 180 degree crossings
                          if (px < 0) { px += 360; };
                          if (ax < 0) { ax += 360; };
                          if (bx < 0) { bx += 360; };
                  
                          if (py == ay || py == by) py += 0.00000001;
                          if ((py > by || py < ay) || (px > Math.max(ax, bx))) return false;
                          if (px < Math.min(ax, bx)) return true;
                  
                          var red = (ax != bx) ? ((by - ay) / (bx - ax)) : float.MAX_VALUE;
                          var blue = (ax != px) ? ((py - ay) / (px - ax)) : float.MAX_VALUE;
                          return (blue >= red);
                      }
                  }
                  

                  就程序流程而言,您需要后臺服務進行位置更新,然后針對您的緯度/經(jīng)度多邊形數(shù)據(jù)執(zhí)行此檢查,以查看該位置是否在內部.

                  In terms of program flow, you will want a background service to do location updates and then perform this check against your lat/long polygon data to see if the location is inside.

                  這篇關于Android 地理圍欄(多邊形)的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯(lián)系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Help calculating X and Y from Latitude and Longitude in iPhone(幫助從 iPhone 中的緯度和經(jīng)度計算 X 和 Y)
                  Get user#39;s current location using GPS(使用 GPS 獲取用戶的當前位置)
                  IllegalArgumentException thrown by requestLocationUpdate()(requestLocationUpdate() 拋出的 IllegalArgumentException)
                  How reliable is LocationManager#39;s getLastKnownLocation and how often is it updated?(LocationManager 的 getLastKnownLocation 有多可靠,多久更新一次?)
                  CLLocation returning negative speed(CLLocation 返回負速度)
                  How to detect Location Provider ? GPS or Network Provider(如何檢測位置提供者?GPS 或網(wǎng)絡提供商)

                    <i id='GCiNO'><tr id='GCiNO'><dt id='GCiNO'><q id='GCiNO'><span id='GCiNO'><b id='GCiNO'><form id='GCiNO'><ins id='GCiNO'></ins><ul id='GCiNO'></ul><sub id='GCiNO'></sub></form><legend id='GCiNO'></legend><bdo id='GCiNO'><pre id='GCiNO'><center id='GCiNO'></center></pre></bdo></b><th id='GCiNO'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='GCiNO'><tfoot id='GCiNO'></tfoot><dl id='GCiNO'><fieldset id='GCiNO'></fieldset></dl></div>
                    <legend id='GCiNO'><style id='GCiNO'><dir id='GCiNO'><q id='GCiNO'></q></dir></style></legend>

                        <small id='GCiNO'></small><noframes id='GCiNO'>

                          <tbody id='GCiNO'></tbody>
                          <bdo id='GCiNO'></bdo><ul id='GCiNO'></ul>
                        • <tfoot id='GCiNO'></tfoot>

                            主站蜘蛛池模板: 综合伊人| 91视频麻豆| 色婷婷综合久久久中字幕精品久久 | 天天躁日日躁狠狠很躁 | 91av免费看| 婷婷免费视频 | 久久精品亚洲一区 | 337p日本欧洲亚洲大胆精蜜臀 | 国产亚洲精品成人av久久ww | 黄色片视频 | 成人精品一区二区三区 | 紧缚调教一区二区三区视频 | 伊人青青久久 | 免费av在线网站 | 99精品视频在线观看免费播放 | www久久久 | 色接久久| 欧美综合在线观看 | 国产精品久久久久久久久免费桃花 | 久久久久久一区 | 欧美最猛黑人xxxx黑人 | 夜操| 欧美一区日韩一区 | 美女久久 | 日韩在线中文 | 国产丝袜一区二区三区免费视频 | 天天干天天爱天天爽 | 中文二区| 日韩字幕| 成人在线视频一区 | 亚洲成人精品 | av中文字幕在线观看 | 夜久久 | 黄色视频a级毛片 | 欧美日韩电影一区 | 日韩欧美在 | 欧美一二三区 | 第四色影音先锋 | 一二区视频 | 欧美国产日韩在线观看 | 99久久精品免费看国产四区 |