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


Java Point类代码示例

本文整理汇总了Java中org.oscim.core.Point的典型用法代码示例。如果您正苦于以下问题:Java Point类的具体用法?Java Point怎么用?Java Point使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: onItemLongPress

import org.oscim.core.Point; //导入依赖的package包/类
@Override
public boolean onItemLongPress(int index, MarkerItem item) {
    if (mLocationState != LocationState.DISABLED && mLocationState != LocationState.ENABLED)
        return false;
    Object uid = item.getUid();
    if (uid != null) {
        Waypoint waypoint = (Waypoint) uid;
        if (waypoint.locked) {
            Toast.makeText(this, R.string.msgPlaceLocked, Toast.LENGTH_SHORT).show();
            return true;
        }
    }
    mActiveMarker = item;
    // For better experience get delta from marker position and finger press
    // and consider it when moving marker
    Point point = new Point();
    mMap.viewport().toScreenPoint(item.getPoint(), point);
    deltaX = (float) (downX - point.x);
    deltaY = (float) (downY - point.y);
    // Shift map to reveal marker tip position
    mMap.getEventLayer().enableMove(false);
    mMap.animator().animateTo(MAP_POSITION_ANIMATION_DURATION / 2, mMap.viewport().fromScreenPoint(mMap.getWidth() / 2, mMap.getHeight() / 2 + 3 * mFingerTipSize), 1, true);
    return true;
}
 
开发者ID:andreynovikov,项目名称:trekarta,代码行数:25,代码来源:MainActivity.java

示例2: onInputEvent

import org.oscim.core.Point; //导入依赖的package包/类
@Override
public void onInputEvent(Event event, MotionEvent motionEvent) {
    if ((motionEvent.getAction() == MotionEvent.ACTION_CANCEL || motionEvent.getAction() == MotionEvent.ACTION_UP) && currentlyDraggedItem != null) {
        currentlyDraggedItem.onDragStop();
        currentlyDraggedItem = null;
    }
    if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
        dragLastX = motionEvent.getX();
        dragLastY = motionEvent.getY();
    }
    if (motionEvent.getAction() == MotionEvent.ACTION_MOVE && currentlyDraggedItem != null) {
        Point out = new Point();
        mapView.map().viewport().toScreenPoint(GmsMapsTypeHelper.fromLatLng(currentlyDraggedItem.getPosition()), out);
        out.x += mapView.getWidth() / 2;
        out.y += mapView.getHeight() / 2;
        float mx = motionEvent.getX() - dragLastX;
        float my = motionEvent.getY() - dragLastY;
        currentlyDraggedItem.setPosition(GmsMapsTypeHelper.toLatLng(mapView.map().viewport().fromScreenPoint((float) out.getX() + mx, (float) out.getY() + my)));
        currentlyDraggedItem.onDragProgress();
        dragLastX += mx;
        dragLastY += my;
    }
}
 
开发者ID:microg,项目名称:android_packages_apps_GmsCore,代码行数:24,代码来源:BackendMap.java

示例3: toScreenPoint

import org.oscim.core.Point; //导入依赖的package包/类
/**
 * Get the screen pixel for map coordinates
 * 
 * @param out Point projected to screen coordinate
 */
public synchronized void toScreenPoint(double x, double y, Point out) {

	double cs = mPos.scale * Tile.SIZE;
	double cx = mPos.x * cs;
	double cy = mPos.y * cs;

	mv[0] = (float) (x * cs - cx);
	mv[1] = (float) (y * cs - cy);

	mv[2] = 0;
	mv[3] = 1;

	mViewProjMatrix.prj(mv);

	out.x = (mv[0] * (mWidth / 2));
	out.y = -(mv[1] * (mHeight / 2));
}
 
开发者ID:opensciencemap,项目名称:vtm,代码行数:23,代码来源:Viewport.java

示例4: onGesture

import org.oscim.core.Point; //导入依赖的package包/类
@Override
public boolean onGesture(Gesture gesture, MotionEvent event) {
    Point point = new Point();
    mMap.viewport().fromScreenPoint(event.getX(), event.getY(), point);
    int tileX = (int) (point.getX() / TILE_SCALE);
    int tileY = (int) (point.getY() / TILE_SCALE);
    if (tileX < 0 || tileX > 127 || tileY < 0 || tileY > 127)
        return false;
    Index.MapStatus mapStatus = mMapIndex.getNativeMap(tileX, tileY);
    if (gesture instanceof Gesture.LongPress) {
        if (mapStatus.downloading != 0L)
            mMapIndex.selectNativeMap(tileX, tileY, Index.ACTION.CANCEL);
        else if (mapStatus.created > 0)
            mMapIndex.selectNativeMap(tileX, tileY, Index.ACTION.REMOVE);
        return true;
    }
    if (gesture instanceof Gesture.Tap || gesture instanceof Gesture.DoubleTap) {
        if (mapStatus.downloading != 0L)
            return true;
        if (mMapIndex.hasDownloadSizes()) {
            if (mapStatus.downloadSize == 0L)
                return true;
        }
        mMapIndex.selectNativeMap(tileX, tileY, Index.ACTION.DOWNLOAD);
        return true;
    }
    return false;
}
 
开发者ID:andreynovikov,项目名称:trekarta,代码行数:29,代码来源:MapCoverageLayer.java

示例5: add

import org.oscim.core.Point; //导入依赖的package包/类
/**
 * Insert an item.
 */
public void add(final T item) {

	final Point point = item.getPoint();

	if (this.mBounds.contains(point.x, point.y)) {
		insert(point.x, point.y, item);
	}
}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:12,代码来源:PointQuadTree.java

示例6: remove

import org.oscim.core.Point; //导入依赖的package包/类
/**
 * Remove the given item from the set.
 *
 * @return whether the item was removed.
 */
public boolean remove(final T item) {
	final Point point = item.getPoint();
	if (this.mBounds.contains(point.x, point.y)) {
		return remove(point.x, point.y, item);
	} else {
		return false;
	}
}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:14,代码来源:PointQuadTree.java

示例7: createBoundsFromSpan

import org.oscim.core.Point; //导入依赖的package包/类
private Bounds createBoundsFromSpan(final Point p, final double span) {

		// TODO: Use a span that takes into account the visual size of the marker, not just its
		// GeoPoint.
		final double halfSpan = span / 2;

		return new Bounds(
				p.x - halfSpan,
				p.x + halfSpan,
				p.y - halfSpan,
				p.y + halfSpan);
	}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:13,代码来源:DistanceClustering.java

示例8: fromScreenLocation

import org.oscim.core.Point; //导入依赖的package包/类
@Override
public LatLng fromScreenLocation(IObjectWrapper obj) throws RemoteException {
    Point point = GmsMapsTypeHelper
            .fromPoint((android.graphics.Point) ObjectWrapper.unwrap(obj));
    return GmsMapsTypeHelper
            .toLatLng(viewport.fromScreenPoint((float) point.x, (float) point.y));
}
 
开发者ID:microg,项目名称:android_packages_apps_GmsCore,代码行数:8,代码来源:ProjectionImpl.java

示例9: applyRotation

import org.oscim.core.Point; //导入依赖的package包/类
private Point applyRotation(double mx, double my) {
	if (mPos.bearing == 0) {
		mMovePoint.x = mx;
		mMovePoint.y = my;
	} else {
		double rad = Math.toRadians(mPos.bearing);
		double rcos = Math.cos(rad);
		double rsin = Math.sin(rad);
		mMovePoint.x = mx * rcos + my * rsin;
		mMovePoint.y = mx * -rsin + my * rcos;
	}
	return mMovePoint;
}
 
开发者ID:opensciencemap,项目名称:vtm,代码行数:14,代码来源:ViewController.java

示例10: fromScreenPoint

import org.oscim.core.Point; //导入依赖的package包/类
/**
 * Get the map position for x,y in screen coordinates.
 * 
 * @param x screen coordinate
 * @param y screen coordinate
 */
public synchronized void fromScreenPoint(double x, double y, Point out) {
	// scale to -1..1
	float mx = (float) (1 - (x / mWidth * 2));
	float my = (float) (1 - (y / mHeight * 2));

	unproject(-mx, my, getDepth(-my), mu, 0);

	double cs = mPos.scale * Tile.SIZE;
	double cx = mPos.x * cs;
	double cy = mPos.y * cs;

	double dx = cx + mu[0];
	double dy = cy + mu[1];

	dx /= cs;
	dy /= cs;

	while (dx > 1)
		dx -= 1;
	while (dx < 0)
		dx += 1;

	if (dy > 1)
		dy = 1;
	else if (dy < 0)
		dy = 0;

	out.x = dx;
	out.y = dy;
}
 
开发者ID:opensciencemap,项目名称:vtm,代码行数:37,代码来源:Viewport.java

示例11: bezier3

import org.oscim.core.Point; //导入依赖的package包/类
/**
 * from http://paulbourke.net/geometry/bezier/index.html
 * Three control point Bezier interpolation
 * mu ranges from 0 to 1, start to end of the curve
 */
public static Point bezier3(Point p1, Point p2, Point p3, double mu) {
	double mum1, mum12, mu2;
	Point p = new Point();

	mu2 = mu * mu;
	mum1 = 1 - mu;
	mum12 = mum1 * mum1;
	p.x = p1.x * mum12 + 2 * p2.x * mum1 * mu + p3.x * mu2;
	p.y = p1.y * mum12 + 2 * p2.y * mum1 * mu + p3.y * mu2;
	//p.z = p1.z * mum12 + 2 * p2.z * mum1 * mu + p3.z * mu2;

	return (p);
}
 
开发者ID:opensciencemap,项目名称:vtm,代码行数:19,代码来源:BezierPath.java

示例12: cubicBezier

import org.oscim.core.Point; //导入依赖的package包/类
/**
 * from http://paulbourke.net/geometry/bezier/index.html
 * Four control point Bezier interpolation
 * mu ranges from 0 to 1, start to end of curve
 */
public static Point cubicBezier(Point p1, Point p2, Point p3, Point p4, double mu) {
	double mum1, mum13, mu3;
	Point p = new Point();

	mum1 = 1 - mu;
	mum13 = mum1 * mum1 * mum1;
	mu3 = mu * mu * mu;

	p.x = mum13 * p1.x + 3 * mu * mum1 * mum1 * p2.x + 3 * mu * mu * mum1 * p3.x + mu3 * p4.x;
	p.y = mum13 * p1.y + 3 * mu * mum1 * mum1 * p2.y + 3 * mu * mu * mum1 * p3.y + mu3 * p4.y;
	//p.z = mum13*p1.z + 3*mu*mum1*mum1*p2.z + 3*mu*mu*mum1*p3.z + mu3*p4.z;

	return (p);
}
 
开发者ID:opensciencemap,项目名称:vtm,代码行数:20,代码来源:BezierPath.java

示例13: BezierPathLayer

import org.oscim.core.Point; //导入依赖的package包/类
public BezierPathLayer() {
	mMapPosition.scale = 0;

	GeometryBuffer g = new GeometryBuffer(100, 1);
	g.startLine();

	Point[] pts = new Point[10];
	for (int i = 0; i < 10; i++) {
		pts[i] = new Point(i * 3, (i * i) % 3 * 4);
		pts[i].x *= 10;
		pts[i].y *= 10;
		// System.out.println(pts[i]);
		g.addPoint(pts[i]);
	}
	LineBucket ll = buckets.addLineBucket(0, new LineStyle(Color.BLUE, 2f));
	ll.addLine(g);

	List<Point> ctrl = BezierPath.cubicSplineControlPoints(pts, 0.1f);

	g.clear();
	g.startLine();
	Point p0 = pts[0];

	for (int j = 1, k = 0; j < pts.length; j++) {
		Point p1 = ctrl.get(k++);
		Point p2 = ctrl.get(k++);
		Point p3 = pts[j];
		System.out.println(">>> " + p1 + " " + p2);
		for (int i = 0; i < 10; i++) {
			double mu = (i / 10f);
			Point p = BezierPath.cubicBezier(p0, p1, p2, p3, mu);
			g.addPoint(p);
			System.out.println(mu + " " + p);
		}
		p0 = p3;
	}
	ll = buckets.addLineBucket(1, new LineStyle(Color.CYAN, 2f));
	ll.addLine(g);

}
 
开发者ID:opensciencemap,项目名称:vtm,代码行数:41,代码来源:BezierTest.java

示例14: onMapEvent

import org.oscim.core.Point; //导入依赖的package包/类
@Override
public void onMapEvent(Event e, MapPosition mapPosition) {
	if (mBubble.isOpen()) {
		GeoPoint gp = mItemWithBubble.getPoint();

		Point p = mTmpPoint;
		mMap.viewport().toScreenPoint(gp, p);

		mBubble.position((int) p.x, (int) p.y);
	}
}
 
开发者ID:opensciencemap,项目名称:vtm-app,代码行数:12,代码来源:ItemizedOverlayWithBubble.java

示例15: updateNavigationUI

import org.oscim.core.Point; //导入依赖的package包/类
private void updateNavigationUI() {
    logger.debug("updateNavigationUI()");
    boolean enabled = mLocationService != null && mLocationService.getStatus() == BaseLocationService.GPS_OK &&
            mNavigationService != null && mNavigationService.isNavigating();
    boolean changed = mGaugePanel.setNavigationMode(enabled);
    if (enabled) {
        if (mNavigationArrowView.getVisibility() == View.GONE) {
            mNavigationArrowView.setAlpha(0f);
            mNavigationArrowView.setVisibility(View.VISIBLE);
            mNavigationArrowView.animate().alpha(1f).setDuration(MAP_POSITION_ANIMATION_DURATION).setListener(null);
        }
        GeoPoint destination = mNavigationService.getWaypoint().coordinates;
        if (mNavigationLayer == null) {
            mNavigationLayer = new NavigationLayer(mMap, 0x66ffff00, 8);
            mNavigationLayer.setDestination(destination);
            Point point = mLocationOverlay.getPosition();
            mNavigationLayer.setPosition(MercatorProjection.toLatitude(point.y), MercatorProjection.toLongitude(point.x));
            mMap.layers().add(mNavigationLayer, MAP_POSITIONAL);
        } else {
            GeoPoint current = mNavigationLayer.getDestination();
            if (!destination.equals(current)) {
                mNavigationLayer.setDestination(destination);
            }
        }
    } else {
        if (mNavigationArrowView.getAlpha() == 1f) {
            mNavigationArrowView.animate().alpha(0f).setDuration(MAP_POSITION_ANIMATION_DURATION).setListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    mNavigationArrowView.setVisibility(View.GONE);
                }
            });
        }
        if (mNavigationLayer != null) {
            mMap.layers().remove(mNavigationLayer);
            mNavigationLayer = null;
        }
    }
    if (changed)
        updateMapViewArea();
}
 
开发者ID:andreynovikov,项目名称:trekarta,代码行数:42,代码来源:MainActivity.java


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