If you think the Android project android-augment-reality-framework 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
package com.jwetherell.augmented_reality.data;
/*fromwww.java2s.com*/import java.util.ArrayList;
import java.util.List;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import com.jwetherell.augmented_reality.R;
import com.jwetherell.augmented_reality.ui.IconMarker;
import com.jwetherell.augmented_reality.ui.Marker;
/**
* This class should be used as a example local data source. It is an example of
* how to add data programatically. You can add data either programatically,
* SQLite or through any other source.
*
* @author Justin Wetherell <phishman3579@gmail.com>
*/publicclass LocalDataSource extends DataSource {
private List<Marker> cachedMarkers = new ArrayList<Marker>();
privatestatic Bitmap icon = null;
public LocalDataSource(Resources res) {
if (res == null) thrownew NullPointerException();
createIcon(res);
}
protectedvoid createIcon(Resources res) {
if (res == null) thrownew NullPointerException();
icon = BitmapFactory.decodeResource(res, R.drawable.icon);
}
public List<Marker> getMarkers() {
Marker atl = new IconMarker("ATL ICON", 39.931268, -75.051262, 0, Color.DKGRAY, icon);
cachedMarkers.add(atl);
Marker home = new Marker("ATL CIRCLE", 39.931269, -75.051231, 0, Color.YELLOW);
cachedMarkers.add(home);
/*
* Marker lon = new IconMarker(
* "I am a really really long string which should wrap a number of times on the screen."
* , 39.95335, -74.9223445, 0, Color.MAGENTA, icon);
* cachedMarkers.add(lon); Marker lon2 = new IconMarker(
* "2: I am a really really long string which should wrap a number of times on the screen."
* , 39.95334, -74.9223446, 0, Color.MAGENTA, icon);
* cachedMarkers.add(lon2);
*//*
* float max = 10; for (float i=0; i<max; i++) { Marker marker = null;
* float decimal = i/max; if (i%2==0) marker = new Marker("Test-"+i,
* 39.99, -75.33+decimal, 0, Color.LTGRAY); marker = new
* IconMarker("Test-"+i, 39.99+decimal, -75.33, 0, Color.LTGRAY, icon);
* cachedMarkers.add(marker); }
*/return cachedMarkers;
}
}