Android Open Source - aBusTripMK Open Street Map View Overlay






From Project

Back to project page aBusTripMK.

License

The source code is released under:

GNU General Public License

If you think the Android project aBusTripMK listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

// Created by plusminus on 20:32:01 - 27.09.2008
package org.andnav.osm.views.overlay;
//  w w w .  j  a v  a2s  . c  o  m
import org.andnav.osm.util.constants.OpenStreetMapConstants;
import org.andnav.osm.views.OpenStreetMapView;
import org.andnav.osm.views.util.constants.OpenStreetMapViewConstants;

import android.graphics.Canvas;
import android.view.KeyEvent;
import android.view.MotionEvent;

/**
 * Base class representing an overlay which may be displayed on top of a
 * {@link OpenStreetMapView}. To add an overlay, subclass this class, create an
 * instance, and add it to the list obtained from getOverlays() of
 * {@link OpenStreetMapView}.
 * 
 * @author Nicolas Gramlich
 */
public abstract class OpenStreetMapViewOverlay implements
                OpenStreetMapConstants, OpenStreetMapViewConstants {
        // ===========================================================
        // Constants
        // ===========================================================

        // ===========================================================
        // Fields
        // ===========================================================

        // ===========================================================
        // Constructors
        // ===========================================================

        // ===========================================================
        // Getter & Setter
        // ===========================================================

        // ===========================================================
        // Methods for SuperClass/Interfaces
        // ===========================================================

        /**
         * Managed Draw calls gives Overlays the possibility to first draw manually
         * and after that do a final draw. This is very useful, i sth. to be drawn
         * needs to be <b>topmost</b>.
         */
        public void onManagedDraw(final Canvas c, final OpenStreetMapView osmv) {
                onDraw(c, osmv);
                onDrawFinished(c, osmv);
        }

        protected abstract void onDraw(final Canvas c, final OpenStreetMapView osmv);

        protected abstract void onDrawFinished(final Canvas c,
                        final OpenStreetMapView osmv);

        // ===========================================================
        // Methods
        // ===========================================================

        /**
         * By default does nothing (<code>return false</code>). If you handled the
         * Event, return <code>true</code>, otherwise return <code>false</code>. If
         * you returned <code>true</code> none of the following Overlays or the
         * underlying {@link OpenStreetMapView} has the chance to handle this event.
         */
        public boolean onKeyDown(final int keyCode, KeyEvent event,
                        final OpenStreetMapView mapView) {
                return false;
        }

        /**
         * By default does nothing (<code>return false</code>). If you handled the
         * Event, return <code>true</code>, otherwise return <code>false</code>. If
         * you returned <code>true</code> none of the following Overlays or the
         * underlying {@link OpenStreetMapView} has the chance to handle this event.
         */
        public boolean onKeyUp(final int keyCode, KeyEvent event,
                        final OpenStreetMapView mapView) {
                return false;
        }

        /**
         * <b>You can prevent all(!) other Touch-related events from happening!</b><br />
         * By default does nothing (<code>return false</code>). If you handled the
         * Event, return <code>true</code>, otherwise return <code>false</code>. If
         * you returned <code>true</code> none of the following Overlays or the
         * underlying {@link OpenStreetMapView} has the chance to handle this event.
         */
        public boolean onTouchEvent(final MotionEvent event,
                        final OpenStreetMapView mapView) {
                return false;
        }

        /**
         * By default does nothing (<code>return false</code>). If you handled the
         * Event, return <code>true</code>, otherwise return <code>false</code>. If
         * you returned <code>true</code> none of the following Overlays or the
         * underlying {@link OpenStreetMapView} has the chance to handle this event.
         */
        public boolean onTrackballEvent(final MotionEvent event,
                        final OpenStreetMapView mapView) {
                return false;
        }

        /**
         * By default does nothing (<code>return false</code>). If you handled the
         * Event, return <code>true</code>, otherwise return <code>false</code>. If
         * you returned <code>true</code> none of the following Overlays or the
         * underlying {@link OpenStreetMapView} has the chance to handle this event.
         */
        public boolean onSingleTapUp(MotionEvent e,
                        OpenStreetMapView openStreetMapView) {
                return false;
        }

        /**
         * By default does nothing (<code>return false</code>). If you handled the
         * Event, return <code>true</code>, otherwise return <code>false</code>. If
         * you returned <code>true</code> none of the following Overlays or the
         * underlying {@link OpenStreetMapView} has the chance to handle this event.
         */
        public boolean onLongPress(MotionEvent e,
                        OpenStreetMapView openStreetMapView) {
                return false;
        }

        // ===========================================================
        // Inner and Anonymous Classes
        // ===========================================================

        /**
         * Interface definition for overlays that contain items that can be snapped
         * to (for example, when the user invokes a zoom, this could be called
         * allowing the user to snap the zoom to an interesting point.)
         */
        public interface Snappable {
                
                /**
                 * Checks to see if the given x and y are close enough to an item resulting in snapping the current action (e.g. zoom) to the item. 
                 * @param x The x in screen coordinates.
                 * @param y The y in screen coordinates.
                 * @param snapPoint To be filled with the the interesting point (in screen coordinates) that is closest to the given x and y. Can be untouched if not snapping.
                 * @param mapView The OpenStreetMapView that is requesting the snap. Use MapView.getProjection() to convert between on-screen pixels and latitude/longitude pairs. 
                 * @return Whether or not to snap to the interesting point.
                 */
                boolean onSnapToItem(int x, int y, android.graphics.Point snapPoint,
                                OpenStreetMapView mapView);
        }

}




Java Source Code List

com.app.busmk.DataBaseHelper.java
com.app.busmk.MyOverLay.java
com.app.busmk.a12.java
com.app.busmk.a15.java
com.app.busmk.a19.java
com.app.busmk.a22.java
com.app.busmk.a24.java
com.app.busmk.a2.java
com.app.busmk.a3.java
com.app.busmk.a41.java
com.app.busmk.a5.java
com.app.busmk.a65b.java
com.app.busmk.a7.java
com.app.busmk.a8.java
com.app.busmk.about.java
com.app.busmk.baraj_lista.java
com.app.busmk.baraj_mapa.java
com.app.busmk.main.java
com.app.busmk.main_menu.java
com.app.busmk.other.java
com.app.busmk.splash.java
org.andnav.osm.exceptions.EmptyCacheException.java
org.andnav.osm.services.OpenStreetMapTileProviderService.java
org.andnav.osm.services.util.OpenStreetMapAsyncTileProvider.java
org.andnav.osm.services.util.OpenStreetMapTileDownloader.java
org.andnav.osm.services.util.OpenStreetMapTileFilesystemProvider.java
org.andnav.osm.services.util.OpenStreetMapTileProviderDataBase.java
org.andnav.osm.services.util.OpenStreetMapTile.java
org.andnav.osm.services.util.StreamUtils.java
org.andnav.osm.services.util.constants.OpenStreetMapServiceConstants.java
org.andnav.osm.util.BoundingBoxE6.java
org.andnav.osm.util.GeoPoint.java
org.andnav.osm.util.MyMath.java
org.andnav.osm.util.NetworkLocationIgnorer.java
org.andnav.osm.util.constants.GeoConstants.java
org.andnav.osm.util.constants.OpenStreetMapConstants.java
org.andnav.osm.views.OpenStreetMapViewController.java
org.andnav.osm.views.OpenStreetMapView.java
org.andnav.osm.views.overlay.MyLocationOverlay.java
org.andnav.osm.views.overlay.OpenStreetMapTilesOverlay.java
org.andnav.osm.views.overlay.OpenStreetMapViewItemizedOverlay.java
org.andnav.osm.views.overlay.OpenStreetMapViewOverlayItem.java
org.andnav.osm.views.overlay.OpenStreetMapViewOverlay.java
org.andnav.osm.views.util.HttpUserAgentHelper.java
org.andnav.osm.views.util.LRUMapTileCache.java
org.andnav.osm.views.util.Mercator.java
org.andnav.osm.views.util.MyMath.java
org.andnav.osm.views.util.OpenStreetMapRendererInfo.java
org.andnav.osm.views.util.OpenStreetMapTileCache.java
org.andnav.osm.views.util.OpenStreetMapTileProvider.java
org.andnav.osm.views.util.constants.MathConstants.java
org.andnav.osm.views.util.constants.OpenStreetMapViewConstants.java