• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ZoomEvent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: onZoom

import org.osmdroid.events.ZoomEvent; //导入依赖的package包/类
@Override
public boolean onZoom(final ZoomEvent event) {
	Activity act=getActivity();
	if (act!=null) {
		getActivity().runOnUiThread(new Runnable() {
			@Override
			public void run() {
				try {
					Log.i("Zoomer", "zoom event triggered " + event.getZoomLevel());
					//Toast.makeText(getActivity(), "Zoom is " + event.getZoomLevel(), Toast.LENGTH_SHORT).show();
				} catch (Exception ex) {
					ex.printStackTrace();
				}
			}
		});
	}
	return true;
}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:19,代码来源:SampleOsmPath.java


示例2: onZoom

import org.osmdroid.events.ZoomEvent; //导入依赖的package包/类
@Override
public boolean onZoom(final ZoomEvent event) 
{
	if(event.getZoomLevel() < zoomLevel_)
		items().clear();
	zoomLevel_ = event.getZoomLevel();
	refreshItems();
	return true;
}
 
开发者ID:MobileAppCodes,项目名称:CycleStreets-Android-app-,代码行数:10,代码来源:LiveItemOverlay.java


示例3: onZoom

import org.osmdroid.events.ZoomEvent; //导入依赖的package包/类
/**
 * handles the map movement rendering portions, prevents more than one render at a time,
 * waits for the user to stop moving the map before triggering the render
 */
@Override
public boolean onZoom(ZoomEvent event) {
    lastMovement = System.currentTimeMillis();
    needsDataRefresh = true;
    return false;
}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:11,代码来源:HeatMap.java


示例4: onZoom

import org.osmdroid.events.ZoomEvent; //导入依赖的package包/类
@Override
public boolean onZoom(ZoomEvent event) {
    if(lastEvent+40 < System.currentTimeMillis()) {
        lastEvent=System.currentTimeMillis();
        if (event.getSource() == mMapView) {
            mMapView2.getController().setZoom(event.getZoomLevel());
        } else
            mMapView.getController().setZoom(event.getZoomLevel());
    }
    return true;
}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:12,代码来源:SampleSplitScreen.java


示例5: onZoom

import org.osmdroid.events.ZoomEvent; //导入依赖的package包/类
public boolean onZoom(ZoomEvent zoomEvent) {
	Log.d("MapListener", zoomEvent.toString());
	boolean isOsmDataDownloadAutomatic = SettingsManager.getInstance().getBoolean(MapzenPreferenceActivity.PREF_DOWNLOAD_OSM, true);
	if(isOsmDataDownloadAutomatic)
		tryUpdateData();
	return true;
}
 
开发者ID:Mapzen-POI-Collector,项目名称:Mapzen-Android,代码行数:8,代码来源:OsmPoisOverlay.java


示例6: onZoom

import org.osmdroid.events.ZoomEvent; //导入依赖的package包/类
@Override
public boolean onZoom(ZoomEvent event) {
	
	if (event.getZoomLevel() < minZoomForOsmDataDownload) {
		progressIndicator.setVisibility(View.GONE);
		zoomInToAddPoisView.setVisibility(View.VISIBLE);
	} else
		zoomInToAddPoisView.setVisibility(View.GONE);
	
	zoomControl.setIsZoomInEnabled(mOsmv.canZoomIn());
	zoomControl.setIsZoomOutEnabled(mOsmv.canZoomOut());
	
	return mPoisOverlay.onZoom(event);
}
 
开发者ID:Mapzen-POI-Collector,项目名称:Mapzen-Android,代码行数:15,代码来源:MapActivity.java


示例7: onCreateView

import org.osmdroid.events.ZoomEvent; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater,
                         ViewGroup container,
                         Bundle savedInstanceState) {
    Log.d(TAG, "onCreateView");
    View createdView;

    if (getMapLayoutId() == -1) {
        LinearLayout linearLayout =
                (LinearLayout) inflater.inflate(getLayoutId(), container, false);
        linearLayout.addView(this.mapView);
        createdView = linearLayout;
    } else {
        createdView = inflater.inflate(getLayoutId(), container, false);
        LinearLayout mapLayout = (LinearLayout) createdView.findViewById(getMapLayoutId());
        mapLayout.addView(this.mapView);
    }


    this.mapView.setMapListener(
            new DelayedMapListener(
                    new MapListener() {
                        Integer x, y;

                        public boolean onZoom(final ZoomEvent zoomEvent) {
                            Log.i(TAG, "onZoom: " + zoomEvent.getZoomLevel());
                            currentStrategy.onMapDisplacement(
                                    mapView.getZoomLevel(),
                                    mapView.getMapCenter().getLatitude(),
                                    mapView.getMapCenter().getLongitude());
                            return true;
                        }

                        public boolean onScroll(final ScrollEvent e) {
                            Log.d(TAG, "onScroll");
                            MapFragment.this.onScroll();
                            if (x == null || y == null) {
                                x = e.getX();
                                y = e.getY();
                            } else if (x == e.getX() && y == e.getY()) {
                                return true;
                            }

                            currentStrategy.onMapDisplacement(
                                    mapView.getZoomLevel(),
                                    mapView.getMapCenter().getLatitude(),
                                    mapView.getMapCenter().getLongitude());

                            return true;
                        }
                    }, 200));

    return createdView;
}
 
开发者ID:InspectorIncognito,项目名称:androidApp,代码行数:55,代码来源:MapFragment.java


示例8: onZoom

import org.osmdroid.events.ZoomEvent; //导入依赖的package包/类
@Override
public boolean onZoom(final ZoomEvent event) {
  clearLastFix();
  return super.onZoom(event);
}
 
开发者ID:MobileAppCodes,项目名称:CycleStreets-Android-app-,代码行数:6,代码来源:POIOverlay.java


示例9: zoomToFixing

import org.osmdroid.events.ZoomEvent; //导入依赖的package包/类
@Override
public boolean zoomToFixing(double zoomLevel, int xPixel, int yPixel, Long zoomAnimationSpeed) {
    zoomLevel = zoomLevel > mMapView.getMaxZoomLevel() ? mMapView.getMaxZoomLevel() : zoomLevel;
    zoomLevel = zoomLevel < mMapView.getMinZoomLevel() ? mMapView.getMinZoomLevel() : zoomLevel;

    double currentZoomLevel = mMapView.getZoomLevelDouble();
    boolean canZoom = zoomLevel < currentZoomLevel && mMapView.canZoomOut() ||
        zoomLevel > currentZoomLevel && mMapView.canZoomIn();

    if (!canZoom) {
        return false;
    }
    if (mMapView.mIsAnimating.getAndSet(true)) {
        // TODO extend zoom (and return true)
        return false;
    }
    for (MapListener mapListener: mMapView.mListners) {
        mapListener.onZoom(new ZoomEvent(mMapView, zoomLevel));
    }
    mMapView.setMultiTouchScaleInitPoint(xPixel, yPixel);
    mMapView.startAnimation();

    float end = (float) Math.pow(2.0, zoomLevel - currentZoomLevel);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        ZoomAnimatorListener zoomAnimatorListener = new ZoomAnimatorListener(this);
        ValueAnimator zoomToAnimator = ValueAnimator.ofFloat(1f, end);
        zoomToAnimator.addListener(zoomAnimatorListener);
        zoomToAnimator.addUpdateListener(zoomAnimatorListener);
        if (zoomAnimationSpeed == null) {
            zoomToAnimator.setDuration(Configuration.getInstance().getAnimationSpeedShort());
        } else {
            zoomToAnimator.setDuration(zoomAnimationSpeed);
        }

        mCurrentAnimator = zoomToAnimator;
        zoomToAnimator.start();
        return true;
    }
    mTargetZoomLevel = zoomLevel;
    if (zoomLevel > currentZoomLevel)
        mMapView.startAnimation(mZoomInAnimationOld);
    else
        mMapView.startAnimation(mZoomOutAnimationOld);
    ScaleAnimation scaleAnimation;

    scaleAnimation = new ScaleAnimation(
            1f, end, //X
            1f, end, //Y
            Animation.RELATIVE_TO_SELF, 0.5f, //Pivot X
            Animation.RELATIVE_TO_SELF, 0.5f); //Pivot Y
    if (zoomAnimationSpeed == null) {
        scaleAnimation.setDuration(Configuration.getInstance().getAnimationSpeedShort());
    } else {
        scaleAnimation.setDuration(zoomAnimationSpeed);
    }
    scaleAnimation.setAnimationListener(new ZoomAnimationListener(this));
    return true;
}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:59,代码来源:MapController.java


示例10: setZoomLevel

import org.osmdroid.events.ZoomEvent; //导入依赖的package包/类
/**
 * @param aZoomLevel
 *            the zoom level bound by the tile source
 * Used to be an int - is a double since 6.0
 */
double setZoomLevel(final double aZoomLevel) {
	final double newZoomLevel = Math.max(getMinZoomLevel(), Math.min(getMaxZoomLevel(), aZoomLevel));
	final double curZoomLevel = this.mZoomLevel;

	if (newZoomLevel != curZoomLevel) {
		if (mScroller!=null)	//fix for edit mode in the IDE
			mScroller.forceFinished(true);
		mIsFlinging = false;
	}

	// Get our current center point
	final IGeoPoint centerGeoPoint = getProjection().getCurrentCenter();

	this.mZoomLevel = newZoomLevel;

	setExpectedCenter(centerGeoPoint);
	this.checkZoomButtons();

	if (isLayoutOccurred()) {
		getController().setCenter(centerGeoPoint);

		// snap for all snappables
		final Point snapPoint = new Point();
		final Projection pj = getProjection();
		if (this.getOverlayManager().onSnapToItem((int) mMultiTouchScaleInitPoint.x,
				(int) mMultiTouchScaleInitPoint.y, snapPoint, this)) {
			IGeoPoint geoPoint = pj.fromPixels(snapPoint.x, snapPoint.y, null, false);
			getController().animateTo(geoPoint);
		}

		mTileProvider.rescaleCache(pj, newZoomLevel, curZoomLevel, getScreenRect(null));
		pauseFling = true;	// issue 269, pause fling during zoom changes
	}

	// do callback on listener
	if (newZoomLevel != curZoomLevel) {
		final ZoomEvent event = new ZoomEvent(this, newZoomLevel);
		for (MapListener mapListener: mListners)
			mapListener.onZoom(event);
	}

	invalidate();
	return this.mZoomLevel;
}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:50,代码来源:MapView.java


示例11: onZoom

import org.osmdroid.events.ZoomEvent; //导入依赖的package包/类
@Override
public boolean onZoom(ZoomEvent zoomEvent) {
    updateGridlines();
    return false;
}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:6,代码来源:SampleGridlines.java


示例12: onZoom

import org.osmdroid.events.ZoomEvent; //导入依赖的package包/类
@Override
public boolean onZoom(ZoomEvent zoomEvent) {
    String zoomLevel = String.format(Locale.getDefault(), "%.2f", zoomEvent.getZoomLevel());
    Toast.makeText(getContext(), "Zoom to "+zoomLevel, Toast.LENGTH_SHORT).show();
    return false;
}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:7,代码来源:MinMaxZoomLevel.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java EvaluationStrategyImpl类代码示例发布时间:2022-05-22
下一篇:
Java CodingScheme类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap