make fields protected to allow extending MapView
This commit is contained in:
parent
dc0d161c14
commit
38c27c051d
@ -22,7 +22,6 @@ import org.oscim.android.input.AndroidMotionEvent;
|
|||||||
import org.oscim.backend.AssetAdapter;
|
import org.oscim.backend.AssetAdapter;
|
||||||
import org.oscim.backend.CanvasAdapter;
|
import org.oscim.backend.CanvasAdapter;
|
||||||
import org.oscim.backend.GLAdapter;
|
import org.oscim.backend.GLAdapter;
|
||||||
import org.oscim.core.Tile;
|
|
||||||
import org.oscim.event.Gesture;
|
import org.oscim.event.Gesture;
|
||||||
import org.oscim.map.Map;
|
import org.oscim.map.Map;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@ -39,25 +38,18 @@ import android.widget.RelativeLayout;
|
|||||||
|
|
||||||
public class MapView extends RelativeLayout {
|
public class MapView extends RelativeLayout {
|
||||||
|
|
||||||
static final Logger log = LoggerFactory.getLogger(MapView.class);
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
System.loadLibrary("vtm-jni");
|
System.loadLibrary("vtm-jni");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean mRotationEnabled = false;
|
static final Logger log = LoggerFactory.getLogger(MapView.class);
|
||||||
public boolean mCompassEnabled = false;
|
|
||||||
public boolean enablePagedFling = false;
|
|
||||||
|
|
||||||
private final GestureDetector mGestureDetector;
|
protected final AndroidMap mMap;
|
||||||
final AndroidMotionEvent mMotionEvent;
|
protected final GestureDetector mGestureDetector;
|
||||||
|
protected final AndroidMotionEvent mMotionEvent;
|
||||||
|
|
||||||
private int mWidth;
|
protected int mWidth;
|
||||||
private int mHeight;
|
protected int mHeight;
|
||||||
|
|
||||||
final AndroidMap mMap;
|
|
||||||
|
|
||||||
boolean mInitialized = false;
|
|
||||||
|
|
||||||
public MapView(Context context) {
|
public MapView(Context context) {
|
||||||
this(context, null);
|
this(context, null);
|
||||||
@ -80,7 +72,7 @@ public class MapView extends RelativeLayout {
|
|||||||
mMap = new AndroidMap(this);
|
mMap = new AndroidMap(this);
|
||||||
|
|
||||||
if (context instanceof MapActivity)
|
if (context instanceof MapActivity)
|
||||||
((MapActivity)context).registerMapView(this);
|
((MapActivity) context).registerMapView(this);
|
||||||
|
|
||||||
mMap.clearMap();
|
mMap.clearMap();
|
||||||
mMap.updateMap(false);
|
mMap.updateMap(false);
|
||||||
@ -89,7 +81,7 @@ public class MapView extends RelativeLayout {
|
|||||||
mGestureDetector = new GestureDetector(context, new OnGestureListener() {
|
mGestureDetector = new GestureDetector(context, new OnGestureListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onSingleTapUp(MotionEvent e) {
|
public boolean onSingleTapUp(MotionEvent e) {
|
||||||
return mMap.handleGesture(Gesture.TAP, mMotionEvent.wrap(e));
|
return mMap.handleGesture(Gesture.TAP, mMotionEvent.wrap(e));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -174,9 +166,7 @@ public class MapView extends RelativeLayout {
|
|||||||
mWidth = width;
|
mWidth = width;
|
||||||
mHeight = height;
|
mHeight = height;
|
||||||
|
|
||||||
mInitialized = (mWidth > 0 && mHeight > 0);
|
if (mWidth > 0 && mHeight > 0)
|
||||||
|
|
||||||
if (mInitialized)
|
|
||||||
mMap.viewport().setScreenSize(width, height);
|
mMap.viewport().setScreenSize(width, height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user