当前位置: 首页>>代码示例>>Java>>正文


Java LatLng.getLongitude方法代码示例

本文整理汇总了Java中com.mapbox.mapboxsdk.geometry.LatLng.getLongitude方法的典型用法代码示例。如果您正苦于以下问题:Java LatLng.getLongitude方法的具体用法?Java LatLng.getLongitude怎么用?Java LatLng.getLongitude使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.mapbox.mapboxsdk.geometry.LatLng的用法示例。


在下文中一共展示了LatLng.getLongitude方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isLocationInside

import com.mapbox.mapboxsdk.geometry.LatLng; //导入方法依赖的package包/类
public static boolean isLocationInside(LatLng point, ArrayList<? extends LatLng> positions) {
  boolean result = false;
  LatLng p1 = positions.get(0);
  for (int i = 1; i < positions.size(); i++) {
    LatLng p2 = positions.get(i);

    if (((p2.getLatitude() <= point.getLatitude()
          && point.getLatitude() < p1.getLatitude())
         || (p1.getLatitude() <= point.getLatitude()
             && point.getLatitude() < p2.getLatitude()))
        && (point.getLongitude() < (p1.getLongitude() - p2.getLongitude())
            * (point.getLatitude() - p2.getLatitude())
            / (p1.getLatitude() - p2.getLatitude()) + p2.getLongitude())) {
      result = !result;
    }
    p1 = p2;
  }
  return result;
}
 
开发者ID:platypusllc,项目名称:tablet,代码行数:20,代码来源:Region.java

示例2: findInteriorAngle

import com.mapbox.mapboxsdk.geometry.LatLng; //导入方法依赖的package包/类
public double findInteriorAngle(LatLng a, LatLng b) {
    //System.out.println(180/Math.PI*Math.acos(dot(a,b)/(calculateLength(a)*calculateLength(b))));
    // System.out.println("a " + calculateLength(a));
    // System.out.println("b " + calculateLength(b));
    // System.out.println("a.b: " + dot(a,b));
    // System.out.println("dot(a,b)/lengtha*lengthb : " + Math.acos(dot(a,b)/(calculateLength(a)*calculateLength(b
    //                                                                                                                ))));
    double dot = dot(a, b);
    double cross = a.getLatitude() * b.getLongitude() - a.getLongitude() * b.getLatitude();
    double output = Math.atan2(dot, cross);
    if (output < 0) {
        output += Math.PI;
    }
    if (output == 0) {
        output = Math.PI / 2;
    }
    // if (output > Math.PI/2)
    // {
    //  output = Math.PI - output;
    // }
    //return output;
    return Math.acos(dot(a, b) / (calculateLength(a) * calculateLength(b)));
}
 
开发者ID:platypusllc,项目名称:tablet,代码行数:24,代码来源:PolyArea.java

示例3: toPoint

import com.mapbox.mapboxsdk.geometry.LatLng; //导入方法依赖的package包/类
public Point toPoint(final LatLng latLng) {
  final double x = latLng.getLongitude() / 360 + .5;
  final double siny = Math.sin(Math.toRadians(latLng.getLatitude()));
  final double y = 0.5 * Math.log((1 + siny) / (1 - siny)) / -(2 * Math.PI) + .5;

  return new Point(x * mWorldWidth, y * mWorldWidth);
}
 
开发者ID:mapbox,项目名称:mapbox-plugins-android,代码行数:8,代码来源:SphericalMercatorProjection.java

示例4: OsmAnimatorUpdateListener

import com.mapbox.mapboxsdk.geometry.LatLng; //导入方法依赖的package包/类
public OsmAnimatorUpdateListener(LatLng originPos, LatLng destinationPos, MapboxMap mapboxMap) {
    this.originPos = originPos;
    this.destinationPos = destinationPos;
    this.mapboxMap = mapboxMap;
    latStep = (destinationPos.getLatitude() - originPos.getLatitude()) / STEPS_CENTER_ANIMATION;
    lngStep = (destinationPos.getLongitude() - originPos.getLongitude()) / STEPS_CENTER_ANIMATION;
}
 
开发者ID:jawg,项目名称:osm-contributor,代码行数:8,代码来源:OsmAnimatorUpdateListener.java

示例5: distance

import com.mapbox.mapboxsdk.geometry.LatLng; //导入方法依赖的package包/类
public double distance(LatLng A, LatLng B, LatLng C) {
  double ABx = B.getLongitude() - A.getLongitude();
  double ABy = B.getLatitude() - A.getLatitude();
  double num = ABx * (A.getLatitude() - C.getLatitude()) - ABy * (A.getLongitude() - C.getLongitude());
  if (num < 0)
    num = -num;
  return num;
}
 
开发者ID:platypusllc,项目名称:tablet,代码行数:9,代码来源:Region.java

示例6: pointLocation

import com.mapbox.mapboxsdk.geometry.LatLng; //导入方法依赖的package包/类
public double pointLocation(LatLng A, LatLng B, LatLng P) {
  double cp1 = (B.getLongitude() - A.getLongitude()) * (P.getLatitude() - A.getLatitude()) - (B.getLatitude() - A.getLatitude()) * (P.getLongitude() - A.getLongitude());
  if (cp1 > 0)
    return 1;
  else if (cp1 == 0)
    return 0;
  else
    return -1;
}
 
开发者ID:platypusllc,项目名称:tablet,代码行数:10,代码来源:Region.java

示例7: computeCentroid

import com.mapbox.mapboxsdk.geometry.LatLng; //导入方法依赖的package包/类
public LatLng computeCentroid(ArrayList<LatLng> vertices) {
  double tempLat = 0;
  double tempLon = 0;

  for (LatLng i : vertices) {
    tempLat += i.getLatitude();
    tempLon += i.getLongitude();
  }
  return new LatLng(tempLat / vertices.size(), tempLon / vertices.size());
}
 
开发者ID:platypusllc,项目名称:tablet,代码行数:11,代码来源:Region.java

示例8: distance

import com.mapbox.mapboxsdk.geometry.LatLng; //导入方法依赖的package包/类
public double distance(LatLng A, LatLng B, LatLng C) {
    double ABx = B.getLongitude() - A.getLongitude();
    double ABy = B.getLatitude() - A.getLatitude();
    double num = ABx * (A.getLatitude() - C.getLatitude()) - ABy * (A.getLongitude() - C.getLongitude());
    if (num < 0)
        num = -num;
    return num;
}
 
开发者ID:platypusllc,项目名称:tablet,代码行数:9,代码来源:PolyArea.java

示例9: computeCentroid

import com.mapbox.mapboxsdk.geometry.LatLng; //导入方法依赖的package包/类
public LatLng computeCentroid(ArrayList<LatLng> vertices) {
    double tempLat = 0;
    double tempLon = 0;

    for (LatLng i : vertices) {
        tempLat += i.getLatitude();
        tempLon += i.getLongitude();
    }
    return new LatLng(tempLat / vertices.size(), tempLon / vertices.size());
}
 
开发者ID:platypusllc,项目名称:tablet,代码行数:11,代码来源:PolyArea.java

示例10: findBoundingBoxForGivenLocations

import com.mapbox.mapboxsdk.geometry.LatLng; //导入方法依赖的package包/类
public BoundingBox findBoundingBoxForGivenLocations(ArrayList<LatLng> coordinates)
{
    double west = 0.0;
    double east = 0.0;
    double north = 0.0;
    double south = 0.0;

    for (int lc = 0; lc < coordinates.size(); lc++)
    {
        LatLng loc = coordinates.get(lc);
        if (lc == 0)
        {
            north = loc.getLatitude();
            south = loc.getLatitude();
            west = loc.getLongitude();
            east = loc.getLongitude();
        }
        else
        {
            if (loc.getLatitude() > north)
            {
                north = loc.getLatitude();
            }
            else if (loc.getLatitude() < south)
            {
                south = loc.getLatitude();
            }
            if (loc.getLongitude() < west)
            {
                west = loc.getLongitude();
            }
            else if (loc.getLongitude() > east)
            {
                east = loc.getLongitude();
            }
        }
    }

    // OPTIONAL - Add some extra "padding" for better map display
    double padding = 0.005;
    north = north + padding;
    south = south - padding;
    west = west - padding;
    east = east + padding;

    return new BoundingBox(north, east, south, west);
}
 
开发者ID:cammace,项目名称:iGuide,代码行数:48,代码来源:Search.java

示例11: getLawnmowerPath

import com.mapbox.mapboxsdk.geometry.LatLng; //导入方法依赖的package包/类
public static Object[] getLawnmowerPath(ArrayList<LatLng> area, double stepSize) {

        // Compute the bounding box
        area.add(area.get(0)); //adds first point to end so the final vector can be computed...
        double minLat = 360;
        double maxLat = -360;
        double minLon = 360;
        double maxLon = -360;
        Double curLat = null;
        System.out.println(area);
        for (LatLng latLon : area) {  //get list of points
            if (latLon.getLatitude() > maxLat) { //if latlong.getLatitude()...
                maxLat = latLon.getLatitude();
            } else if (latLon.getLatitude() < minLat) {
                minLat = latLon.getLatitude();
            }
            if (latLon.getLongitude() > maxLon) {
                maxLon = latLon.getLongitude();
            } else if (latLon.getLongitude() < minLon) {
                minLon = latLon.getLongitude();
            }
        }
        curLat = minLat;
        System.out.println(curLat);
        double totalLength = 0.0;
        Double leftLon = null, rightLon = null; //locations
        ArrayList<LatLng> path = new ArrayList<LatLng>(); //can just
        //be latlng
        while (curLat <= maxLat) {
            // Left to right
            leftLon = getMinLonAt(area, minLon, maxLon, curLat);
            rightLon = getMaxLonAt(area, minLon, maxLon, curLat);
            if (leftLon != null && rightLon != null) {
                path.add(new LatLng(curLat, leftLon));
                path.add(new LatLng(curLat, rightLon));
                totalLength += Math.abs((rightLon - leftLon) * LON_D_PER_M);
            } else {
                System.out.println("null");
            }
            // Right to left
            curLat = curLat+stepSize;
            if (curLat <= maxLat) {
                totalLength += stepSize;
                rightLon = getMaxLonAt(area, minLon, maxLon, curLat);
                leftLon = getMinLonAt(area, minLon, maxLon, curLat);
                if (leftLon != null && rightLon != null) {
                    path.add(new LatLng(curLat, rightLon));
                    path.add(new LatLng(curLat, leftLon));
                    totalLength += Math.abs((rightLon - leftLon) * LON_D_PER_M);
                } else {
                    System.out.println("null");
                }
            }
            curLat = curLat + stepSize;
            if (curLat <= maxLat) {
                totalLength += stepSize;
            }
        }

        return new Object[]{path, totalLength};
    }
 
开发者ID:platypusllc,项目名称:tablet,代码行数:62,代码来源:PolyArea.java

示例12: orderCCWUpRight

import com.mapbox.mapboxsdk.geometry.LatLng; //导入方法依赖的package包/类
public static ArrayList<LatLng> orderCCWUpRight(ArrayList<LatLng> list)
    {
        if (list.size() < 3)
        {
            return list;
        }
        //look for most left up point
        double minLat = 360;
        double maxLat = -360;
        double minLon = 360;
        double maxLon = -360;
        Double curLat = null;
        for (LatLng latLon : list) {  //get list of points
            if (latLon.getLatitude() > maxLat) { //if latlong.getLatitude()...
                maxLat = latLon.getLatitude();
            } else if (latLon.getLatitude() < minLat) {
                minLat = latLon.getLatitude();
            }
            if (latLon.getLongitude() > maxLon) {
                maxLon = latLon.getLongitude();
            } else if (latLon.getLongitude() < minLon) {
                minLon = latLon.getLongitude();
            }
        }
        curLat = minLat;
//        System.out.print(maxLat);
//        System.out.print(",");
//        System.out.print(maxLon);
//        System.out.println("");
        ArrayList<LatLng> reordered = new ArrayList<LatLng>();
        int start = -1;
        for (int i = 0; i < list.size(); i++)
        {
            if (list.get(i).equals(new LatLng(maxLat,maxLon)))
            {
                start = i;
//                System.out.println(i);
                break;
            }
        }
        for (int i = start; i < list.size(); i++)
        {
            reordered.add(list.get(i));
        }
        for (int i = 0; i < start; i++)
        {
            reordered.add(list.get(i));
        }
        //      System.out.println(reordered);
        return reordered;
    }
 
开发者ID:platypusllc,项目名称:tablet,代码行数:52,代码来源:PolyArea.java

示例13: dot

import com.mapbox.mapboxsdk.geometry.LatLng; //导入方法依赖的package包/类
public double dot(LatLng a, LatLng b) {
  return a.getLatitude() * b.getLatitude() + a.getLongitude() * b.getLongitude();
}
 
开发者ID:platypusllc,项目名称:tablet,代码行数:4,代码来源:Region.java

示例14: add

import com.mapbox.mapboxsdk.geometry.LatLng; //导入方法依赖的package包/类
public LatLng add(LatLng a, LatLng b) {
  return new LatLng(a.getLatitude() + b.getLatitude(), a.getLongitude() + b.getLongitude());
}
 
开发者ID:platypusllc,项目名称:tablet,代码行数:4,代码来源:Region.java

示例15: subtract

import com.mapbox.mapboxsdk.geometry.LatLng; //导入方法依赖的package包/类
public LatLng subtract(LatLng a, LatLng b) {
  return new LatLng(a.getLatitude() - b.getLatitude(), a.getLongitude() - b.getLongitude());
  //return new LatLng(b.getLatitude() - a.getLatitude(),b.getLongitude() - a.getLongitude());
}
 
开发者ID:platypusllc,项目名称:tablet,代码行数:5,代码来源:Region.java


注:本文中的com.mapbox.mapboxsdk.geometry.LatLng.getLongitude方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。