code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
@Deprecated
public static ITileSource getTileSource(final int aOrdinal) throws IllegalArgumentException {
for (final ITileSource tileSource : mTileSources) {
if (tileSource.ordinal() == aOrdinal) {
return tileSource;
}
}
throw new IllegalArgumentException("No tile source at position: " + aOrdinal);
} | java |
public static int removeTileSources(final String aRegex) {
int n=0;
for (int i=mTileSources.size()-1; i>=0; --i) {
if (mTileSources.get(i).name().matches(aRegex)) {
mTileSources.remove(i);
++n;
}
}
return n;
} | java |
private static void startServer() throws Exception {
JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
sf.setResourceClasses(TileFetcher.class);
List<Object> providers = new ArrayList<Object>();
// add custom providers if any
providers.add(new org.apache.cxf.ja... | java |
public void add(ShapeMarkers shapeMarkers) {
for (Marker marker : shapeMarkers.getMarkers()) {
add(marker, shapeMarkers);
}
} | java |
public static void addMarkerAsPolyline(Marker marker, List<Marker> markers) {
GeoPoint position = marker.getPosition();
int insertLocation = markers.size();
if (markers.size() > 1) {
double[] distances = new double[markers.size()];
insertLocation = 0;
distance... | java |
public void showInfoWindow(){
if (mInfoWindow == null)
return;
final int markerWidth = mIcon.getIntrinsicWidth();
final int markerHeight = mIcon.getIntrinsicHeight();
final int offsetX = (int)(markerWidth * (mIWAnchorU - mAnchorU));
final int offsetY = (int)(markerHeight * (mIWAnchorV - mAnchorV));
if (m... | java |
@Override
public void onDetach(MapView mapView) {
BitmapPool.getInstance().asyncRecycle(mIcon);
mIcon=null;
BitmapPool.getInstance().asyncRecycle(mImage);
//cleanDefaults();
this.mOnMarkerClickListener=null;
this.mOnMarkerDragListener=null;
this.mResources=null;
setRelatedObject(null);
if (isInfoWind... | java |
public static double orthogonalDistance(GeoPoint point, GeoPoint lineStart, GeoPoint lineEnd)
{
double area = Math.abs(
(
lineStart.getLatitude() * lineEnd.getLongitude()
+ lineEnd.getLatitude() * point.getLongitude()
+ point.getLatitude() ... | java |
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.buttonManualCacheEntry: {
showManualEntry();
}
break;
case R.id.buttonSetCache: {
showPickCacheFromList();
}
break;
}
} | java |
public void closeAllInfoWindows(){
for (Overlay overlay:mOverlayManager){
if (overlay instanceof FolderOverlay){
((FolderOverlay)overlay).closeAllInfoWindows();
} else if (overlay instanceof OverlayWithIW){
((OverlayWithIW)overlay).closeInfoWindow();
}
}
} | java |
private ImageryMetaDataResource getMetaData() {
Log.d(IMapView.LOGTAG, "getMetaData");
ImageryMetaDataResource returnValue = null;
InputStream in = null;
HttpURLConnection client = null;
ByteArrayOutputStream dataStream = null;
BufferedOutputStream out = null;
t... | java |
public boolean shouldIgnore(final String pProvider, final long pTime) {
if (LocationManager.GPS_PROVIDER.equals(pProvider)) {
mLastGps = pTime;
} else {
if (pTime < mLastGps + Configuration.getInstance().getGpsWaitTime()) {
return true;
}
}
return false;
} | java |
private double adjustScaleBarLength(double length) {
long pow = 0;
boolean feet = false;
if (unitsOfMeasure == UnitsOfMeasure.imperial) {
if (length >= GeoConstants.METERS_PER_STATUTE_MILE / 5)
length = length / GeoConstants.METERS_PER_STATUTE_MILE;
else {
length = length * GeoConstants.FEET_PER_MET... | java |
public static Location getLastKnownLocation(final LocationManager pLocationManager) {
if (pLocationManager == null) {
return null;
}
final Location gpsLocation = getLastKnownLocation(pLocationManager, LocationManager.GPS_PROVIDER);
final Location networkLocation = getLastKnownLocation(pLocationManager, Locat... | java |
public void setInfoWindow(InfoWindow infoWindow){
if (mInfoWindow != null){
if (mInfoWindow.getRelatedObject()==this)
mInfoWindow.setRelatedObject(null);
}
mInfoWindow = infoWindow;
} | java |
public List<List<GeoPoint>> getHoles(){
List<List<GeoPoint>> result = new ArrayList<List<GeoPoint>>(mHoles.size());
for (LinearRing hole:mHoles){
result.add(hole.getPoints());
//TODO: completely wrong:
// hole.getPoints() doesn't return a copy but a direct handler to the internal list.
// - if geodesic,... | java |
public static ArrayList<GeoPoint> pointsAsCircle(GeoPoint center, double radiusInMeters){
ArrayList<GeoPoint> circlePoints = new ArrayList<GeoPoint>(360/6);
for (int f = 0; f < 360; f += 6){
GeoPoint onCircle = center.destinationPoint(radiusInMeters, f);
circlePoints.add(onCircle);
}
return circlePoints;
... | java |
protected void setDefaultInfoWindowLocation() {
int s = mOutline.getPoints().size();
if (s == 0){
mInfoWindowLocation = new GeoPoint(0.0, 0.0);
return;
}
//TODO: as soon as the polygon bounding box will be a class member, don't compute it again here.
mInfoWindowLocation = mOutline.getCenter(null);
} | java |
@Deprecated
public Point toPixelsFromProjected(final PointL in, final Point reuse) {
final Point out = reuse != null ? reuse : new Point();
final double power = getProjectedPowerDifference();
final PointL tmp = new PointL();
getLongPixelsFromProjected(in, power, true, tmp);
out.x = TileSystem.truncateToInt(t... | java |
public Point unrotateAndScalePoint(int x, int y, Point reuse) {
return applyMatrixToPoint(x, y, reuse, mUnrotateAndScaleMatrix, mOrientation != 0);
} | java |
public Point rotateAndScalePoint(int x, int y, Point reuse) {
return applyMatrixToPoint(x, y, reuse, mRotateAndScaleMatrix, mOrientation != 0);
} | java |
public void adjustOffsets(final IGeoPoint pGeoPoint, final PointF pPixel) {
if (pPixel == null) {
return;
}
final Point unRotatedExpectedPixel = unrotateAndScalePoint((int)pPixel.x, (int)pPixel.y, null);
final Point unRotatedActualPixel = toPixels(pGeoPoint, null);
final long deltaX = unRotatedExpectedPixe... | java |
@Deprecated
public void adjustOffsets(final BoundingBox pBoundingBox) {
if (pBoundingBox == null) {
return;
}
adjustOffsets(pBoundingBox.getLonWest(), pBoundingBox.getLonEast(), false, 0);
adjustOffsets(pBoundingBox.getActualNorth(), pBoundingBox.getActualSouth(), true, 0);
} | java |
protected String quadTree(final long pMapTileIndex) {
final StringBuilder quadKey = new StringBuilder();
for (int i = MapTileIndex.getZoom(pMapTileIndex); i > 0; i--) {
int digit = 0;
final int mask = 1 << (i - 1);
if ((MapTileIndex.getX(pMapTileIndex) & mask) != 0)
digit += 1;
if ((MapTileIndex.get... | java |
@Override
public void mapTileRequestFailed(final MapTileRequestState pState) {
if (mTileNotFoundImage!=null) {
putTileIntoCache(pState.getMapTile(), mTileNotFoundImage, ExpirableBitmapDrawable.NOT_FOUND);
for (final Handler handler : mTileRequestCompleteHandlers) {
if (handler != null) {
handler.send... | java |
@Override
public void mapTileRequestExpiredTile(MapTileRequestState pState, Drawable pDrawable) {
putTileIntoCache(pState.getMapTile(), pDrawable, ExpirableBitmapDrawable.getState(pDrawable));
// tell our caller we've finished and it should update its view
for (final Handler handler : mTileRequestCompleteHandle... | java |
public void rescaleCache(final Projection pProjection, final double pNewZoomLevel,
final double pOldZoomLevel, final Rect pViewPort) {
if (TileSystem.getInputTileZoomLevel(pNewZoomLevel) == TileSystem.getInputTileZoomLevel(pOldZoomLevel)) {
return;
}
final long startMs = System.currentTimeMillis();
if (... | java |
protected boolean onDrawItem(final Canvas canvas, final Item item, final Point curScreenCoords,
final Projection pProjection) {
final int state = (mDrawFocusedItem && (mFocusedItem == item) ? OverlayItem.ITEM_STATE_FOCUSED_MASK
: 0);
final Drawable marker = (item.getMarker(state) == null) ? getDefaultMa... | java |
public List<Item> getDisplayedItems() {
final List<Item> result = new ArrayList<>();
if (mInternalItemDisplayedList == null) {
return result;
}
for (int i = 0 ; i < mInternalItemDisplayedList.length ; i ++) {
if (mInternalItemDisplayedList[i]) {
result.add(getItem(i));
}
}
return result;
} | java |
protected Rect calculateItemRect(Item item, Point coords, Rect reuse) {
final Rect out = reuse != null ? reuse : new Rect();
HotspotPlace hotspot = item.getMarkerHotspot();
if (hotspot == null) {
hotspot = HotspotPlace.BOTTOM_CENTER;
}
final int state = (mDrawFocusedItem && (mFocusedItem == item) ? Overl... | java |
private Overlay createPolygon(BoundingBox key, Integer value, int redthreshold, int orangethreshold) {
Polygon polygon = new Polygon(mMapView);
if (value < orangethreshold)
polygon.setFillColor(Color.parseColor(alpha + yellow));
else if (value < redthreshold)
polygon.setF... | java |
public boolean isInClipArea(final long pX, final long pY) {
return pX > mXMin && pX < mXMax && pY > mYMin && pY < mYMax;
} | java |
private boolean intersection(
final long pX0, final long pY0, final long pX1, final long pY1,
final long pX2, final long pY2, final long pX3, final long pY3
) {
return SegmentIntersection.intersection(
pX0, pY0, pX1, pY1,
pX2, pY2, pX3, pY3, mOptimInte... | java |
private boolean intersection(final long pX0, final long pY0, final long pX1, final long pY1) {
return intersection(pX0, pY0, pX1, pY1, mXMin, mYMin, mXMin, mYMax) // x min segment
|| intersection(pX0, pY0, pX1, pY1, mXMax, mYMin, mXMax, mYMax) // x max segment
|| intersection(pX0... | java |
private int getClosestCorner(final long pX0, final long pY0, final long pX1, final long pY1) {
double min = Double.MAX_VALUE;
int corner = 0;
for (int i = 0 ; i < cornerX.length ; i ++) {
final double distance = Distance.getSquaredDistanceToSegment(
cornerX[i], co... | java |
@Override
public void animateTo(int x, int y) {
// If no layout, delay this call
if (!mMapView.isLayoutOccurred()) {
mReplayController.animateTo(x, y);
return;
}
if (!mMapView.isAnimating()) {
mMapView.mIsFlinging = false;
final int xS... | java |
@Override
public void setCenter(final IGeoPoint point) {
// If no layout, delay this call
if (!mMapView.isLayoutOccurred()) {
mReplayController.setCenter(point);
return;
}
mMapView.setExpectedCenter(point);
} | java |
@Override
public void stopAnimation(final boolean jumpToTarget) {
if (!mMapView.getScroller().isFinished()) {
if (jumpToTarget) {
mMapView.mIsFlinging = false;
mMapView.getScroller().abortAnimation();
} else
stopPanning();
}
... | java |
public void runCleanupOperation() {
final SQLiteDatabase db = getDb();
if (db == null || !db.isOpen()) {
if (Configuration.getInstance().isDebugMode()) {
Log.d(IMapView.LOGTAG, "Finished init thread, aborted due to null database reference");
}
return;
... | java |
public boolean exists(final String pTileSource, final long pMapTileIndex) {
return 1 == getRowCount(primaryKey, getPrimaryKeyParameters(getIndex(pMapTileIndex), pTileSource));
} | java |
public boolean purgeCache() {
final SQLiteDatabase db = getDb();
if (db != null && db.isOpen()) {
try {
db.delete(TABLE, null, null);
return true;
} catch (Exception e) {
Log.w(IMapView.LOGTAG, "Error purging the db", e);
... | java |
@Override
public boolean remove(final ITileSource pTileSourceInfo, final long pMapTileIndex) {
final SQLiteDatabase db = getDb();
if (db == null || !db.isOpen()) {
Log.d(IMapView.LOGTAG, "Unable to delete cached tile from " + pTileSourceInfo.name() + " " + MapTileIndex.toString(pMapTileI... | java |
public long getRowCount(String tileSourceName) {
if (tileSourceName == null) {
return getRowCount(null, null);
}
return getRowCount(COLUMN_PROVIDER + "=?", new String[] {tileSourceName});
} | java |
public long getRowCount(final String pTileSourceName, final int pZoom,
final Collection<Rect> pInclude, final Collection<Rect> pExclude) {
return getRowCount(
getWhereClause(pZoom, pInclude, pExclude)
+ (pTileSourceName != null ? " and " + COLU... | java |
public long getFirstExpiry() {
final SQLiteDatabase db = getDb();
if (db == null || !db.isOpen()) {
return 0;
}
try {
Cursor cursor = db.rawQuery("select min(" + COLUMN_EXPIRES + ") from " + TABLE, null);
cursor.moveToFirst();
long time = c... | java |
public static long getIndex(final long pMapTileIndex) {
return getIndex(MapTileIndex.getX(pMapTileIndex), MapTileIndex.getY(pMapTileIndex), MapTileIndex.getZoom(pMapTileIndex));
} | java |
public long delete(final String pTileSourceName, final int pZoom,
final Collection<Rect> pInclude, final Collection<Rect> pExclude) {
try {
final SQLiteDatabase db = getDb();
if (db == null || !db.isOpen()) {
return -1;
}
ret... | java |
@SuppressWarnings("unused")
public boolean onTouchEvent(MotionEvent event) {
try {
int pointerCount = multiTouchSupported ? (Integer) m_getPointerCount.invoke(event) : 1;
if (DEBUG)
Log.i("MultiTouch", "Got here 1 - " + multiTouchSupported + " " + mMode + " " + handleSingleTouchEvents + " " + pointerCount)... | java |
public List<GeopackageRasterTileSource> getTileSources() {
List<GeopackageRasterTileSource> srcs = new ArrayList<>();
List<String> databases = manager.databases();
for (int i = 0; i < databases.size(); i++) {
GeoPackage open = manager.open(databases.get(i));
List<String... | java |
public ClickableIconOverlay set(int id, IGeoPoint position, Drawable icon, DataType data) {
set(position, icon);
mId = id;
mData = data;
return this;
} | java |
public JSONObject makeHttpRequest(String url) throws IOException {
InputStream is = null;
JSONObject jObj = null;
String json = null;
// Making HTTP request
try {
is = new URL(url).openStream();
} catch (Exception ex) {
Log.d("Networking", ex.g... | java |
public static double getCenterLongitude(final double pWest, final double pEast) {
double longitude = (pEast + pWest) / 2.0;
if (pEast < pWest) {
// center is on the other side of earth
longitude += 180;
}
return org.osmdroid.views.MapView.getTileSystem().cleanLongitude(longitude);
} | java |
public BoundingBox increaseByScale(final float pBoundingboxPaddingRelativeScale) {
if (pBoundingboxPaddingRelativeScale <= 0)
throw new IllegalArgumentException("pBoundingboxPaddingRelativeScale must be positive");
final TileSystem tileSystem = org.osmdroid.views.MapView.getTileSystem();
... | java |
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
// Add a marker in Sydney and move the camera
LatLng sydney = new LatLng(-34, 151);
mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney"));
mMap.moveCamera(CameraUpdateFactory.n... | java |
public static WMSEndpoint parse(InputStream inputStream) throws Exception {
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
dBuilder.setEntityResolver(new EntityResolver() {
@Override
pub... | java |
public static boolean isGoogleMapsV2Supported(final Context aContext) {
try {
// first check if Google Play Services is available
int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(aContext);
if (resultCode == ConnectionResult.SUCCESS) {
// then check if OpenGL ES 2.0 is available
... | java |
private boolean isSymbolicDirectoryLink(final File pParentDirectory, final File pDirectory) {
try {
final String canonicalParentPath1 = pParentDirectory.getCanonicalPath();
final String canonicalParentPath2 = pDirectory.getCanonicalFile().getParent();
return !canonicalParentPath1.equals(canonicalParentPath2)... | java |
private void cutCurrentCache() {
final File lock=Configuration.getInstance().getOsmdroidTileCache();
synchronized (lock) {
if (mUsedCacheSpace > Configuration.getInstance().getTileFileSystemCacheTrimBytes()) {
Log.d(IMapView.LOGTAG,"Trimming tile cache from " + mUsedCacheSpace + " to "
+ Configurati... | java |
public static Bitmap getTileBitmap(final int pTileSizePx) {
final Bitmap bitmap = BitmapPool.getInstance().obtainSizedBitmapFromPool(pTileSizePx, pTileSizePx);
if (bitmap != null) {
return bitmap;
}
return Bitmap.createBitmap(pTileSizePx, pTileSizePx, Bitmap.Config.ARGB_8888)... | java |
private GeoPoint getLocation() {
//sample data
//{"timestamp": 1483742439, "iss_position": {"latitude": "-50.8416", "longitude": "-41.2701"}, "message": "success"}
NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
boolean isConnected = activeNetwork != null && activeNetwork.isConn... | java |
public void addGreatCircle(final GeoPoint startPoint, final GeoPoint endPoint) {
// get the great circle path length in meters
final int greatCircleLength = (int) startPoint.distanceToAsDouble(endPoint);
// add one point for every 100kms of the great circle path
final int numberOfPoints... | java |
public void addGreatCircle(final GeoPoint startPoint, final GeoPoint endPoint, final int numberOfPoints) {
// adapted from page http://compastic.blogspot.co.uk/2011/07/how-to-draw-great-circle-on-map-in.html
// which was adapted from page http://maps.forum.nu/gm_flight_path.html
// convert to radians
final dou... | java |
@Override
public void draw(final Canvas canvas, final Projection pj) {
final int size = this.mPoints.size();
if (size < 2) {
// nothing to paint
return;
}
// precompute new points to the intermediate projection.
while (this.mPointsPrecomputed < size) {
final PointL pt = this.mPoints.get(this.mPoin... | java |
public void enableFollowLocation() {
mIsFollowing = true;
// set initial location when enabled
if (isMyLocationEnabled()) {
Location location = mMyLocationProvider.getLastKnownLocation();
if (location != null) {
setLocation(location);
}
}
// Update the screen to see changes take effect
if (mM... | java |
public boolean runOnFirstFix(final Runnable runnable) {
if (mMyLocationProvider != null && mLocation != null) {
new Thread(runnable).start();
return true;
} else {
mRunOnFirstFix.addLast(runnable);
return false;
}
} | java |
public boolean hasTile(final long pMapTileIndex) {
ITileSource tileSource = mTileSource.get();
if (tileSource == null) {
return false;
}
return mWriter.getExpirationTimestamp(tileSource, pMapTileIndex) != null;
} | java |
public static String retrieveKey(final Context aContext, final String aKey) {
// get the key from the manifest
final PackageManager pm = aContext.getPackageManager();
try {
final ApplicationInfo info = pm.getApplicationInfo(aContext.getPackageName(),
PackageManager.GET_META_DAT... | java |
public boolean forceLoadTile(final OnlineTileSourceBase tileSource, final long pMapTileIndex) {
try {
final Drawable drawable = mTileDownloader.downloadTile(pMapTileIndex, mTileWriter, tileSource);
return drawable != null;
} catch (CantContinueException e) {
return fa... | java |
public boolean isTileToBeDownloaded(final ITileSource pTileSource, final long pMapTileIndex) {
final Long expiration = mTileWriter.getExpirationTimestamp(pTileSource, pMapTileIndex);
if (expiration == null) {
return true;
}
final long now = System.currentTimeMillis();
... | java |
static IterableWithSize<Long> getTilesCoverageIterable(final BoundingBox pBB,
final int pZoomMin, final int pZoomMax) {
final MapTileAreaList list = new MapTileAreaList();
for (int zoomLevel = pZoomMin; zoomLevel <= pZoomMax; zoomLevel++) {
... | java |
public static List<Long> getTilesCoverage(final ArrayList<GeoPoint> pGeoPoints,
final int pZoomMin, final int pZoomMax) {
final List<Long> result = new ArrayList<>();
for (int zoomLevel = pZoomMin; zoomLevel <= pZoomMax; zoomLevel++) {
final Coll... | java |
public CacheManagerTask downloadAreaAsync(Context ctx, ArrayList<GeoPoint> geoPoints, final int zoomMin, final int zoomMax, final CacheManagerCallback callback) {
final CacheManagerTask task = new CacheManagerTask(this, getDownloadingAction(), geoPoints, zoomMin, zoomMax);
task.addCallback(callback);
... | java |
public CacheManagerTask downloadAreaAsyncNoUI(Context ctx, BoundingBox bb, final int zoomMin, final int zoomMax, final CacheManagerCallback callback) {
final CacheManagerTask task = new CacheManagerTask(this, getDownloadingAction(), bb, zoomMin, zoomMax);
task.addCallback(callback);
execute(task... | java |
public void cancelAllJobs(){
Iterator<CacheManagerTask> iterator = mPendingTasks.iterator();
while (iterator.hasNext()) {
CacheManagerTask next = iterator.next();
next.cancel(true);
}
mPendingTasks.clear();
} | java |
public CacheManagerTask downloadAreaAsync(Context ctx, List<Long> pTiles, final int zoomMin, final int zoomMax) {
final CacheManagerTask task = new CacheManagerTask(this, getDownloadingAction(), pTiles, zoomMin, zoomMax);
task.addCallback(getDownloadingDialog(ctx, task));
return execute(task);
... | java |
public CacheManagerTask cleanAreaAsync(final Context ctx, ArrayList<GeoPoint> geoPoints, int zoomMin, int zoomMax) {
BoundingBox extendedBounds = extendedBoundsFromGeoPoints(geoPoints,zoomMin);
return cleanAreaAsync(ctx, extendedBounds, zoomMin, zoomMax);
} | java |
public static long updateStoragePrefreneces(Context ctx){
//loads the osmdroid config from the shared preferences object.
//if this is the first time launching this app, all settings are set defaults with one exception,
//the tile cache. the default is the largest write storage partition, which... | java |
private void updateStorageInfo(){
long cacheSize = updateStoragePrefreneces(this);
//cache management ends here
TextView tv = findViewById(R.id.sdcardstate_value);
final String state = Environment.getExternalStorageState();
boolean mSdCardAvailable = Environment.MEDIA_MOUNTED.... | java |
@Override
public boolean onSingleTapConfirmed(final MotionEvent event, final MapView mapView) {
if(!mStyle.mClickable) return false;
float hyp;
Float minHyp = null;
int closest = -1;
Point tmp = new Point();
Projection pj = mapView.getProjection();
for(int i ... | java |
public void setSelectedPoint(Integer toSelect) {
if(toSelect == null || toSelect < 0 || toSelect >= mPointList.size())
mSelectedPoint = null;
else
mSelectedPoint = toSelect;
} | java |
static public ImageryMetaDataResource getInstanceFromJSON(final String a_jsonContent) throws Exception
{
if(a_jsonContent==null) {
throw new Exception("JSON to parse is null");
}
/// response code should be 200 and authorization should be valid (valid BingMap key)
final JSONObject jsonResult = new JSONObj... | java |
public static void registerArchiveFileProvider(Class<? extends IArchiveFile> provider, String fileExtension){
extensionMap.put(fileExtension, provider);
} | java |
private static void load(final SharedPreferences pPrefs,
final Map<String, String> pMap, final String pPrefix) {
//potential fix for #1079 https://github.com/osmdroid/osmdroid/issues/1079
if (pPrefix==null || pMap==null) return;
pMap.clear();
for (final St... | java |
private static void save(final SharedPreferences pPrefs, final SharedPreferences.Editor pEdit,
final Map<String, String> pMap, final String pPrefix) {
for (final String key : pPrefs.getAll().keySet()) {
if (key.startsWith(pPrefix)) {
pEdit.remove(key);
... | java |
public static void retrieveCloudmadeKey(final Context aContext) {
mAndroidId = Settings.Secure.getString(aContext.getContentResolver(), Settings.Secure.ANDROID_ID);
// get the key from the manifest
mKey = ManifestUtil.retrieveKey(aContext, CLOUDMADE_KEY);
// if the id hasn't changed then set the token to the... | java |
public static String getCloudmadeToken() {
if (mToken.length() == 0) {
synchronized (mToken) {
// check again because it may have been set while we were blocking
if (mToken.length() == 0) {
final String url = "http://auth.cloudmade.com/token/" + mKey + "?userid=" + mAndroidId;
HttpURLConnection... | java |
private static double[] getStartEndPointsWE(double west, double east, int zoom) {
double incrementor = getIncrementor(zoom);
//brute force when zoom is less than 10
if (zoom < 10) {
double we_startpoint = Math.floor(west);
double x = 180;
while (x > we_startp... | java |
public static void setDefaults() {
lineColor = Color.BLACK;
fontColor=Color.WHITE;
backgroundColor=Color.BLACK;
lineWidth = 1f;
fontSizeDp=32;
DEBUG=false;
DEBUG2=false;
} | java |
public List<SourceCount> getSources() {
final SQLiteDatabase db = getDb();
List<SourceCount> ret = new ArrayList<>();
if (db == null) {
return ret;
}
Cursor cur = null;
try {
cur = db.rawQuery(
"select "
... | java |
public boolean isCloseTo(GeoPoint point, double tolerance, MapView mapView) {
return getCloseTo(point, tolerance, mapView) != null;
} | java |
protected void setDefaultInfoWindowLocation(){
int s = mOriginalPoints.size();
if (s > 0)
mInfoWindowLocation = mOriginalPoints.get(s/2);
else
mInfoWindowLocation = new GeoPoint(0.0, 0.0);
} | java |
public void onDetach() {
this.getOverlayManager().onDetach(this);
mTileProvider.detach();
mOldZoomController.setVisible(false);
if (mZoomController != null) {
mZoomController.onDetach();
}
//https://github.com/osmdroid/osmdroid/issues/390
if (mTileRequestCompleteHandler instanceof SimpleInvalidationHa... | java |
private static boolean parallelSideEffect(
final double pXA, final double pYA, final double pXB, final double pYB,
final double pXC, final double pYC, final double pXD, final double pYD,
final PointL pIntersection
) {
if (pXA == pXB) {
return parallelSideEffec... | java |
private static boolean check(
final double pXA, final double pYA, final double pXB, final double pYB,
final double pXC, final double pYC, final double pXD, final double pYD,
final PointL pIntersection,
final double pXI, final double pYI
) {
if (pXI < Math.min(... | java |
private static boolean divisionByZeroSideEffect(
final double pXA, final double pYA, final double pXB, final double pYB,
final double pXC, final double pYC, final double pXD, final double pYD,
final PointL pIntersection
) {
return divisionByZeroSideEffectX(pXA, pYA, pXB, ... | java |
@Override
public boolean onSingleTapConfirmed(final MotionEvent event, final MapView mapView) {
return (activateSelectedItems(event, mapView, new ActiveItem() {
@Override
public boolean run(final int index) {
final ItemizedIconOverlay<Item> that = ItemizedIconOverlay.this;
if (that.mOnItemGestureListen... | java |
private boolean activateSelectedItems(final MotionEvent event, final MapView mapView,
final ActiveItem task) {
final int eventX = Math.round(event.getX());
final int eventY = Math.round(event.getY());
for (int i = 0; i < this.mItemList.size(); ++i) {
if (isEventOnItem(getItem(i), eventX, eventY, mapView)) {... | java |
public void garbageCollection() {
// number of tiles to remove from cache
int toBeRemoved = Integer.MAX_VALUE; // MAX_VALUE for stressed memory case
final int size = mCachedTiles.size();
if (!mStressedMemory) {
toBeRemoved = size - mCapacity;
if (toBeRemoved <= 0) {
return;
}
}
refreshAddition... | java |
private void populateSyncCachedTiles(final MapTileList pList) {
synchronized (mCachedTiles) {
pList.ensureCapacity(mCachedTiles.size());
pList.clear();
for (final long index : mCachedTiles.keySet()) {
pList.put(index);
}
}
} | java |
@Override
public boolean startOrientationProvider(IOrientationConsumer orientationConsumer)
{
mOrientationConsumer = orientationConsumer;
boolean result = false;
final Sensor sensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION);
if (sensor != null) {
res... | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.