update license headers, formatting

This commit is contained in:
Hannes Janetzek 2013-01-31 02:25:50 +01:00
parent f93d0944a3
commit 4408a86a5b
9 changed files with 160 additions and 39 deletions

View File

@ -1,3 +1,18 @@
/*
* Copyright 2012 osmdroid
* Copyright 2013 OpenScienceMap
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.oscim.overlay; package org.oscim.overlay;
import java.io.IOException; import java.io.IOException;
@ -18,7 +33,6 @@ public class DefaultResourceProxyImpl implements ResourceProxy, MapViewConstants
/** /**
* Constructor. * Constructor.
*
* @param pContext * @param pContext
* Used to get the display metrics that are used for scaling the * Used to get the display metrics that are used for scaling the
* bitmaps returned by {@@link getBitmap}. Can be null, * bitmaps returned by {@@link getBitmap}. Can be null,

View File

@ -1,3 +1,18 @@
/*
* Copyright 2012 osmdroid
* Copyright 2013 OpenScienceMap
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.oscim.overlay; package org.oscim.overlay;
import java.util.List; import java.util.List;
@ -183,16 +198,8 @@ public class ItemizedIconOverlay<Item extends OverlayItem> extends ItemizedOverl
*/ */
private boolean activateSelectedItems(final MotionEvent event, final MapView mapView, private boolean activateSelectedItems(final MotionEvent event, final MapView mapView,
final ActiveItem task) { final ActiveItem task) {
// final Projection pj = mapView.getProjection();
final int eventX = (int) event.getX(); final int eventX = (int) event.getX();
final int eventY = (int) event.getY(); final int eventY = (int) event.getY();
// Log.d("...", "test items " + eventX + " " + eventY);
/* These objects are created to avoid construct new ones every cycle. */
// pj.fromMapPixels(eventX, eventY, mTouchScreenPoint);
MapViewPosition mapViewPosition = mMapView.getMapViewPosition(); MapViewPosition mapViewPosition = mMapView.getMapViewPosition();
byte z = mapViewPosition.getMapPosition().zoomLevel; byte z = mapViewPosition.getMapPosition().zoomLevel;
@ -203,33 +210,22 @@ public class ItemizedIconOverlay<Item extends OverlayItem> extends ItemizedOverl
double dist = Double.MAX_VALUE; double dist = Double.MAX_VALUE;
// TODO use intermediate projection and bounding box test // TODO use intermediate projection and bounding box test
for (int i = 0; i < this.mItemList.size(); ++i) { for (int i = 0; i < this.mItemList.size(); ++i) {
final Item item = getItem(i); final Item item = getItem(i);
// final Drawable marker = (item.getMarker(0) == null) ? this.mDefaultMarker : item // final Drawable marker = (item.getMarker(0) == null) ? this.mDefaultMarker : item
// .getMarker(0); // .getMarker(0);
// int x = (int) MercatorProjection.longitudeToPixelX(item.getPoint().getLongitude(), z);
// int y = (int) MercatorProjection.latitudeToPixelY(item.getPoint().getLatitude(), z);
MercatorProjection.projectPoint(item.getPoint(), z, mItemPoint); MercatorProjection.projectPoint(item.getPoint(), z, mItemPoint);
// pj.toPixels(item.getPoint(), mItemPoint);
// Log.d("...", (x - mTouchScreenPoint.x) + " " + (y - mTouchScreenPoint.y));
float dx = mItemPoint.x - mTouchScreenPoint.x; float dx = mItemPoint.x - mTouchScreenPoint.x;
float dy = mItemPoint.y - mTouchScreenPoint.y; float dy = mItemPoint.y - mTouchScreenPoint.y;
double d = Math.sqrt(dx * dx + dy * dy); double d = Math.sqrt(dx * dx + dy * dy);
if (d < 50) { if (d < 50) {
// Log.d("...", "HIT! " + (x - mTouchScreenPoint.x) + " " + (y - mTouchScreenPoint.y));
if (d < dist) { if (d < dist) {
dist = d; dist = d;
nearest = i; nearest = i;
} }
// if (hitTest(item, marker, mTouchScreenPoint.x - mItemPoint.x, mTouchScreenPoint.y
// - mItemPoint.y)) {
} }
} }

View File

@ -1,4 +1,19 @@
// Created by plusminus on 23:18:23 - 02.10.2008 /*
* Copyright 2012 osmdroid
* Copyright 2013 OpenScienceMap
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.oscim.overlay; package org.oscim.overlay;
import org.oscim.core.GeoPoint; import org.oscim.core.GeoPoint;
@ -13,16 +28,17 @@ import android.graphics.Rect;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.opengl.Matrix; import android.opengl.Matrix;
/* @author Marc Kurtz
* @author Nicolas Gramlich
* @author Theodore Hong
* @author Fred Eisele
* @author Hannes Janetzek
* */
/** /**
* Draws a list of {@link OverlayItem} as markers to a map. The item with the * Draws a list of {@link OverlayItem} as markers to a map. The item with the
* lowest index is drawn as last and therefore the 'topmost' marker. It also * lowest index is drawn as last and therefore the 'topmost' marker. It also
* gets checked for onTap first. This class is generic, because you then you get * gets checked for onTap first. This class is generic, because you then you get
* your custom item-class passed back in onTap(). * your custom item-class passed back in onTap().
* @author Marc Kurtz
* @author Nicolas Gramlich
* @author Theodore Hong
* @author Fred Eisele
* @author Hannes Janetzek
* @param <Item> * @param <Item>
* ... * ...
*/ */

View File

@ -1,12 +1,25 @@
/*
* Copyright 2012 osmdroid
* Copyright 2013 OpenScienceMap
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
// Created by plusminus on 18:00:24 - 25.09.2008 // Created by plusminus on 18:00:24 - 25.09.2008
package org.oscim.overlay; package org.oscim.overlay;
/** /**
*
* This class contains constants used by the map view. * This class contains constants used by the map view.
*
* @author Nicolas Gramlich * @author Nicolas Gramlich
*
*/ */
public interface MapViewConstants { public interface MapViewConstants {
// =========================================================== // ===========================================================
@ -29,7 +42,8 @@ public interface MapViewConstants {
public static final int MINIMUM_ZOOMLEVEL = 0; public static final int MINIMUM_ZOOMLEVEL = 0;
/** /**
* Maximum Zoom Level - we use Integers to store zoom levels so overflow happens at 2^32 - 1, * Maximum Zoom Level - we use Integers to store zoom levels so overflow
* happens at 2^32 - 1,
* but we also have a tile size that is typically 2^8, so (32-1)-8-1 = 22 * but we also have a tile size that is typically 2^8, so (32-1)-8-1 = 22
*/ */
public static final int MAXIMUM_ZOOMLEVEL = 22; public static final int MAXIMUM_ZOOMLEVEL = 22;

View File

@ -1,3 +1,19 @@
/*
* Copyright 2012 osmdroid
* Copyright 2013 OpenScienceMap
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
// Created by plusminus on 20:32:01 - 27.09.2008 // Created by plusminus on 20:32:01 - 27.09.2008
package org.oscim.overlay; package org.oscim.overlay;

View File

@ -1,3 +1,18 @@
/*
* Copyright 2012 osmdroid
* Copyright 2013 OpenScienceMap
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.oscim.overlay; package org.oscim.overlay;
/** /**

View File

@ -1,3 +1,19 @@
/*
* Copyright 2012 osmdroid
* Copyright 2013 OpenScienceMap
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
// Created by plusminus on 00:02:58 - 03.10.2008 // Created by plusminus on 00:02:58 - 03.10.2008
package org.oscim.overlay; package org.oscim.overlay;
@ -6,10 +22,12 @@ import org.oscim.core.GeoPoint;
import android.graphics.Point; import android.graphics.Point;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
/** Immutable class describing a GeoPoint with a Title and a Description. /**
* Immutable class describing a GeoPoint with a Title and a Description.
* @author Nicolas Gramlich * @author Nicolas Gramlich
* @author Theodore Hong * @author Theodore Hong
* @author Fred Eisele */ * @author Fred Eisele
*/
public class OverlayItem { public class OverlayItem {
// =========================================================== // ===========================================================
@ -21,9 +39,11 @@ public class OverlayItem {
protected static final Point DEFAULT_MARKER_SIZE = new Point(26, 94); protected static final Point DEFAULT_MARKER_SIZE = new Point(26, 94);
/** Indicates a hotspot for an area. This is where the origin (0,0) of a /**
* Indicates a hotspot for an area. This is where the origin (0,0) of a
* point will be located relative to the area. In otherwords this acts as an * point will be located relative to the area. In otherwords this acts as an
* offset. NONE indicates that no adjustment should be made. */ * offset. NONE indicates that no adjustment should be made.
*/
public enum HotspotPlace { public enum HotspotPlace {
NONE, CENTER, BOTTOM_CENTER, TOP_CENTER, RIGHT_CENTER, LEFT_CENTER, UPPER_RIGHT_CORNER, LOWER_RIGHT_CORNER, UPPER_LEFT_CORNER, LOWER_LEFT_CORNER NONE, CENTER, BOTTOM_CENTER, TOP_CENTER, RIGHT_CENTER, LEFT_CENTER, UPPER_RIGHT_CORNER, LOWER_RIGHT_CORNER, UPPER_LEFT_CORNER, LOWER_LEFT_CORNER
} }
@ -43,12 +63,14 @@ public class OverlayItem {
// Constructors // Constructors
// =========================================================== // ===========================================================
/** @param aTitle /**
* @param aTitle
* this should be <b>singleLine</b> (no <code>'\n'</code> ) * this should be <b>singleLine</b> (no <code>'\n'</code> )
* @param aDescription * @param aDescription
* a <b>multiLine</b> description ( <code>'\n'</code> possible) * a <b>multiLine</b> description ( <code>'\n'</code> possible)
* @param aGeoPoint * @param aGeoPoint
* ... */ * ...
*/
public OverlayItem(final String aTitle, final String aDescription, final GeoPoint aGeoPoint) { public OverlayItem(final String aTitle, final String aDescription, final GeoPoint aGeoPoint) {
this(null, aTitle, aDescription, aGeoPoint); this(null, aTitle, aDescription, aGeoPoint);
} }

View File

@ -1,3 +1,19 @@
/*
* Copyright 2012 osmdroid
* Copyright 2013 OpenScienceMap
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.oscim.overlay; package org.oscim.overlay;
import java.util.AbstractList; import java.util.AbstractList;

View File

@ -1,3 +1,18 @@
/*
* Copyright 2012 osmdroid
* Copyright 2013 OpenScienceMap
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.oscim.overlay; package org.oscim.overlay;
import android.graphics.Bitmap; import android.graphics.Bitmap;
@ -38,7 +53,6 @@ public interface ResourceProxy {
/** /**
* Use a string resource as a format definition, and format using the * Use a string resource as a format definition, and format using the
* supplied format arguments. * supplied format arguments.
*
* @param pResId * @param pResId
* ... * ...
* @param formatArgs * @param formatArgs
@ -51,7 +65,6 @@ public interface ResourceProxy {
/** /**
* Get a bitmap as a {@link Drawable} * Get a bitmap as a {@link Drawable}
*
* @param pResId * @param pResId
* ... * ...
* @return ... * @return ...
@ -60,7 +73,6 @@ public interface ResourceProxy {
/** /**
* Gets the density from the current screen's DisplayMetrics * Gets the density from the current screen's DisplayMetrics
*
* @return the screen's density * @return the screen's density
*/ */
float getDisplayMetricsDensity(); float getDisplayMetricsDensity();