本文整理汇总了Java中com.google.maps.android.geometry.Point类的典型用法代码示例。如果您正苦于以下问题:Java Point类的具体用法?Java Point怎么用?Java Point使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Point类属于com.google.maps.android.geometry包,在下文中一共展示了Point类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getClusters
import com.google.maps.android.geometry.Point; //导入依赖的package包/类
@Override
public Set<? extends Cluster<T>> getClusters(double zoom) {
long numCells = (long) Math.ceil(256 * Math.pow(2, zoom) / GRID_SIZE);
SphericalMercatorProjection proj = new SphericalMercatorProjection(numCells);
HashSet<Cluster<T>> clusters = new HashSet<Cluster<T>>();
LongSparseArray<StaticCluster<T>> sparseArray = new LongSparseArray<StaticCluster<T>>();
synchronized (mItems) {
for (T item : mItems) {
Point p = proj.toPoint(item.getPosition());
long coord = getCoord(numCells, p.x, p.y);
StaticCluster<T> cluster = sparseArray.get(coord);
if (cluster == null) {
cluster = new StaticCluster<T>(proj.toLatLng(new Point(Math.floor(p.x) + .5, Math.floor(p.y) + .5)));
sparseArray.put(coord, cluster);
clusters.add(cluster);
}
cluster.add(item);
}
}
return clusters;
}
开发者ID:dklisiaris,项目名称:downtown,代码行数:27,代码来源:GridBasedAlgorithm.java
示例2: getTile
import com.google.maps.android.geometry.Point; //导入依赖的package包/类
@Override
public Tile getTile(int x, int y, int zoom) {
Matrix matrix = new Matrix();
float scale = (float) Math.pow(2, zoom) * mScale;
matrix.postScale(scale, scale);
matrix.postTranslate(-x * mDimension, -y * mDimension);
Bitmap bitmap = Bitmap.createBitmap(mDimension, mDimension, Bitmap.Config.ARGB_8888);
Canvas c = new Canvas(bitmap);
c.setMatrix(matrix);
for (Point p : mPoints) {
c.drawCircle((float) p.x, (float) p.y, 1, new Paint());
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 100, baos);
return new Tile(mDimension, mDimension, baos.toByteArray());
}
开发者ID:googlemaps,项目名称:android-maps-utils,代码行数:20,代码来源:TileProviderAndProjectionDemo.java
示例3: findClosestCluster
import com.google.maps.android.geometry.Point; //导入依赖的package包/类
private static Point findClosestCluster(List<Point> markers, Point point) {
if (markers == null || markers.isEmpty()) return null;
// TODO: make this configurable.
double minDistSquared = VisibleNonHierarchicalDistanceBasedAlgorithm.MAX_DISTANCE_AT_ZOOM * VisibleNonHierarchicalDistanceBasedAlgorithm.MAX_DISTANCE_AT_ZOOM;
Point closest = null;
for (Point candidate : markers) {
double dist = distanceSquared(candidate, point);
if (dist < minDistSquared) {
closest = candidate;
minDistSquared = dist;
}
}
return closest;
}
开发者ID:JohannesRudolph,项目名称:Freifunk-App,代码行数:16,代码来源:NodeClusterRenderer.java
示例4: search
import com.google.maps.android.geometry.Point; //导入依赖的package包/类
public List<T> search(LatLngBounds latLngBounds) {
Point ne = PROJECTION.toPoint(latLngBounds.northeast);
Point sw = PROJECTION.toPoint(latLngBounds.southwest);
Bounds searchBounds = new Bounds(Math.min(ne.x, sw.x), Math.max(ne.x, sw.x), Math.min(ne.y, sw.y), Math.max(ne.y, sw.y));
final List<T> items = new ArrayList<T>();
synchronized (mQuadTree) {
Collection<SpatialDataSource.QuadItem<T>> found = mQuadTree.search(searchBounds);
for (SpatialDataSource.QuadItem<T> quadItem : found) {
items.add(quadItem.getClusterItem());
}
}
return items;
}
开发者ID:JohannesRudolph,项目名称:Freifunk-App,代码行数:16,代码来源:SpatialDataSource.java
示例5: createBoundsFromSpan
import com.google.maps.android.geometry.Point; //导入依赖的package包/类
private Bounds createBoundsFromSpan(Point p, double span) {
// TODO: Use a span that takes into account the visual size of the marker, not just its LatLng.
double halfSpan = span / 2;
return new Bounds(
p.x - halfSpan, p.x + halfSpan,
p.y - halfSpan, p.y + halfSpan);
}
开发者ID:JohannesRudolph,项目名称:Freifunk-App,代码行数:8,代码来源:VisibleNonHierarchicalDistanceBasedAlgorithm.java
示例6: getVisibleBounds
import com.google.maps.android.geometry.Point; //导入依赖的package包/类
private Bounds getVisibleBounds(int zoom) {
if (mMapCenter == null) {
return new Bounds(0, 0, 0, 0);
}
Point p = mDataSource.toPoint(mMapCenter);
final double halfWidthSpan = mScreenWidth / Math.pow(2, zoom) / 256 / 2;
final double halfHeightSpan = mScreenHeight / Math.pow(2, zoom) / 256 / 2;
return new Bounds(
p.x - halfWidthSpan, p.x + halfWidthSpan,
p.y - halfHeightSpan, p.y + halfHeightSpan);
}
开发者ID:JohannesRudolph,项目名称:Freifunk-App,代码行数:15,代码来源:VisibleNonHierarchicalDistanceBasedAlgorithm.java
示例7: findClosestCluster
import com.google.maps.android.geometry.Point; //导入依赖的package包/类
private static Point findClosestCluster(List<Point> markers, Point point) {
if (markers == null || markers.isEmpty()) return null;
// TODO: make this configurable.
double minDistSquared = MAX_DISTANCE_AT_ZOOM * MAX_DISTANCE_AT_ZOOM;
Point closest = null;
for (Point candidate : markers) {
double dist = distanceSquared(candidate, point);
if (dist < minDistSquared) {
closest = candidate;
minDistSquared = dist;
}
}
return closest;
}
开发者ID:dklisiaris,项目名称:downtown,代码行数:16,代码来源:DefaultClusterRenderer.java
示例8: createBoundsFromSpan
import com.google.maps.android.geometry.Point; //导入依赖的package包/类
private Bounds createBoundsFromSpan(Point p, double span) {
// TODO: Use a span that takes into account the visual size of the marker, not just its
// LatLng.
double halfSpan = span / 2;
return new Bounds(
p.x - halfSpan, p.x + halfSpan,
p.y - halfSpan, p.y + halfSpan);
}
开发者ID:dklisiaris,项目名称:downtown,代码行数:9,代码来源:NonHierarchicalDistanceBasedAlgorithm.java
示例9: add
import com.google.maps.android.geometry.Point; //导入依赖的package包/类
/**
* Insert an item.
*/
public void add(T item) {
Point point = item.getPoint();
if (this.mBounds.contains(point.x, point.y)) {
insert(point.x, point.y, item);
}
}
开发者ID:runningcode,项目名称:CUMtd,代码行数:10,代码来源:PointQuadTree.java
示例10: remove
import com.google.maps.android.geometry.Point; //导入依赖的package包/类
/**
* Remove the given item from the set.
*
* @return whether the item was removed.
*/
public boolean remove(T item) {
Point point = item.getPoint();
if (this.mBounds.contains(point.x, point.y)) {
return remove(point.x, point.y, item);
} else {
return false;
}
}
开发者ID:runningcode,项目名称:CUMtd,代码行数:14,代码来源:PointQuadTree.java
示例11: distanceSquared
import com.google.maps.android.geometry.Point; //导入依赖的package包/类
private static double distanceSquared(Point a, Point b) {
return (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y);
}
开发者ID:JohannesRudolph,项目名称:Freifunk-App,代码行数:4,代码来源:NodeClusterRenderer.java
示例12: toPoint
import com.google.maps.android.geometry.Point; //导入依赖的package包/类
public Point toPoint(LatLng latLng) {
return PROJECTION.toPoint(latLng);
}
开发者ID:JohannesRudolph,项目名称:Freifunk-App,代码行数:4,代码来源:SpatialDataSource.java
示例13: getPoint
import com.google.maps.android.geometry.Point; //导入依赖的package包/类
@Override
public Point getPoint() {
return mPoint;
}
开发者ID:JohannesRudolph,项目名称:Freifunk-App,代码行数:5,代码来源:SpatialDataSource.java
示例14: distanceSquared
import com.google.maps.android.geometry.Point; //导入依赖的package包/类
private double distanceSquared(Point a, Point b) {
return (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y);
}
开发者ID:JohannesRudolph,项目名称:Freifunk-App,代码行数:4,代码来源:VisibleNonHierarchicalDistanceBasedAlgorithm.java
示例15: add
import com.google.maps.android.geometry.Point; //导入依赖的package包/类
/**
* Insert an item.
*/
public void add(T item) {
Point point = item.getPoint();
insert(point.x, point.y, item);
}
开发者ID:dklisiaris,项目名称:downtown,代码行数:8,代码来源:PointQuadTree.java
示例16: getPoint
import com.google.maps.android.geometry.Point; //导入依赖的package包/类
public Point getPoint() {
return mPoint;
}
开发者ID:runningcode,项目名称:CUMtd,代码行数:4,代码来源:WeightedLatLng.java
示例17: Item
import com.google.maps.android.geometry.Point; //导入依赖的package包/类
private Item(double x, double y) {
this.mPoint = new Point(x, y);
}
开发者ID:runningcode,项目名称:CUMtd,代码行数:4,代码来源:PointQuadTreeTest.java
注:本文中的com.google.maps.android.geometry.Point类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论