summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTeddy <ted.sybil@gmail.com>2013-08-28 23:24:05 +0800
committerTeddy <ted.sybil@gmail.com>2013-08-28 23:24:05 +0800
commit8f1982baf087949df2ac6492235b411a7cfdf59f (patch)
tree98f07be4e5df4888a47e03f27c2f7cf94e340ab5
parentcef62991bfc27f763e9d4f83170bdff828fb96a9 (diff)
parent956c10597fa5e504eab9255a5fde61a54c6f1972 (diff)
Merge branch 'master' of github.com:Determinant/piztor
-rw-r--r--client/Piztor/.classpath8
-rw-r--r--client/Piztor/.project33
-rw-r--r--client/Piztor/AndroidManifest.xml4
-rw-r--r--client/Piztor/ic_launcher-web.pngbin0 -> 130248 bytes
-rw-r--r--client/Piztor/proguard-project.txt20
-rw-r--r--client/Piztor/project.properties14
-rw-r--r--client/Piztor/res/drawable/circle_green.pngbin0 -> 1079 bytes
-rw-r--r--client/Piztor/src/com/macaroon/piztor/Main.java71
-rw-r--r--client/Piztor/src/com/macaroon/piztor/MapMaker.java311
9 files changed, 323 insertions, 138 deletions
diff --git a/client/Piztor/.classpath b/client/Piztor/.classpath
index 1c0c6e1..2c647e0 100644
--- a/client/Piztor/.classpath
+++ b/client/Piztor/.classpath
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
- <classpathentry kind="lib" path="/home/goblin/piztor/client/Piztor/libs/baidumapapi_v2_1_3.jar"/>
- <classpathentry kind="lib" path="/home/goblin/piztor/client/Piztor/libs/locSDK_4.0.jar"/>
+ <classpathentry kind="lib" path="/home/fs/workspace/Piztor/libs/baidumapapi_v2_1_3.jar"/>
+ <classpathentry kind="lib" path="/home/fs/workspace/Piztor/libs/locSDK_4.0.jar"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="gen"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
diff --git a/client/Piztor/.project b/client/Piztor/.project
new file mode 100644
index 0000000..97100ec
--- /dev/null
+++ b/client/Piztor/.project
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>Piztor</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.android.ide.eclipse.adt.ApkBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/client/Piztor/AndroidManifest.xml b/client/Piztor/AndroidManifest.xml
index c026975..f336200 100644
--- a/client/Piztor/AndroidManifest.xml
+++ b/client/Piztor/AndroidManifest.xml
@@ -57,13 +57,13 @@
<activity
android:name="com.macaroon.piztor.Main"
android:label="@string/title_activity_main"
- android:screenOrientation="sensor"
+ android:screenOrientation="portrait"
android:configChanges="orientation">
</activity>
<activity
android:name="com.macaroon.piztor.Settings"
android:label="@string/title_activity_settings"
- android:screenOrientation="sensor"
+ android:screenOrientation="portrait"
android:configChanges="orientation">
</activity>
<service
diff --git a/client/Piztor/ic_launcher-web.png b/client/Piztor/ic_launcher-web.png
new file mode 100644
index 0000000..3cd0ac2
--- /dev/null
+++ b/client/Piztor/ic_launcher-web.png
Binary files differ
diff --git a/client/Piztor/proguard-project.txt b/client/Piztor/proguard-project.txt
new file mode 100644
index 0000000..f2fe155
--- /dev/null
+++ b/client/Piztor/proguard-project.txt
@@ -0,0 +1,20 @@
+# To enable ProGuard in your project, edit project.properties
+# to define the proguard.config property as described in that file.
+#
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in ${sdk.dir}/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the ProGuard
+# include property in project.properties.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
diff --git a/client/Piztor/project.properties b/client/Piztor/project.properties
new file mode 100644
index 0000000..b7c2081
--- /dev/null
+++ b/client/Piztor/project.properties
@@ -0,0 +1,14 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system edit
+# "ant.properties", and override values to adapt the script to your
+# project structure.
+#
+# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
+#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
+
+# Project target.
+target=android-10
diff --git a/client/Piztor/res/drawable/circle_green.png b/client/Piztor/res/drawable/circle_green.png
new file mode 100644
index 0000000..ded6938
--- /dev/null
+++ b/client/Piztor/res/drawable/circle_green.png
Binary files differ
diff --git a/client/Piztor/src/com/macaroon/piztor/Main.java b/client/Piztor/src/com/macaroon/piztor/Main.java
index 5aa767d..03e7ebc 100644
--- a/client/Piztor/src/com/macaroon/piztor/Main.java
+++ b/client/Piztor/src/com/macaroon/piztor/Main.java
@@ -4,8 +4,6 @@ import java.util.Timer;
import java.util.TimerTask;
import android.annotation.SuppressLint;
-import android.graphics.Bitmap;
-import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
@@ -21,15 +19,10 @@ import com.baidu.location.BDLocation;
import com.baidu.location.BDLocationListener;
import com.baidu.location.LocationClient;
import com.baidu.location.LocationClientOption;
-import com.baidu.mapapi.map.ItemizedOverlay;
import com.baidu.mapapi.map.LocationData;
import com.baidu.mapapi.map.MapView;
import com.baidu.mapapi.map.OverlayItem;
-import com.baidu.mapapi.map.PopupClickListener;
import com.baidu.mapapi.map.PopupOverlay;
-import com.baidu.platform.comapi.basestruct.GeoPoint;
-
-import com.macaroon.piztor.BMapUtil;
public class Main extends PiztorAct {
final static int SearchButtonPress = 1;
@@ -39,9 +32,23 @@ public class Main extends PiztorAct {
final static int Fetch = 6;
final static int mapViewtouched = 7;
+ /**
+ * popups
+ */
+ private PopupOverlay pop = null;
+ private TextView popupText = null;
+ private View viewCache = null;
+ private View popupInfo = null;
+ private View popupLeft = null;
+ private View popupRight = null;
+ private MapView.LayoutParams layoutParam = null;
+ private OverlayItem mCurItem = null;
+
MapMaker mapMaker = null;
MapView mMapView;
+ boolean isFirstLocation = true;
+
/**
* Locating component
*/
@@ -50,7 +57,7 @@ public class Main extends PiztorAct {
public MyLocationListener myListener = new MyLocationListener();
ImageButton btnSearch, btnFetch, btnFocus, btnSettings;
- //Timer autodate;
+ // Timer autodate;
MapInfo mapInfo;
/*
* @SuppressLint("HandlerLeak") Handler fromGPS = new Handler() {
@@ -100,11 +107,7 @@ public class Main extends PiztorAct {
+ " group : " + r.gid);
if (r.uid == Infomation.myInfo.uid) {
Infomation.myInfo.gid = r.gid;
- try {
- //autodate.schedule(new AutoUpdate(), 0, 5000);
- } catch (Exception e) {
- e.printStackTrace();
- }
+ Infomation.myInfo.sex = r.sex;
} else {
UserInfo user = mapInfo.getUserInfo(r.uid);
if (user != null)
@@ -119,9 +122,14 @@ public class Main extends PiztorAct {
}
break;
case 4:// 登出
- Toast toast = Toast.makeText(getApplicationContext(),
- "logout failed", Toast.LENGTH_LONG);
- toast.show();
+ ResLogout logout = (ResLogout) m.obj;
+ if (logout.s == 0) {
+ actMgr.trigger(AppMgr.logout);
+ } else {
+ Toast toast = Toast.makeText(getApplicationContext(),
+ "logout failed", Toast.LENGTH_LONG);
+ toast.show();
+ }
break;
default:
break;
@@ -150,6 +158,9 @@ public class Main extends PiztorAct {
void flushMap() {
if (mapMaker != null)
mapMaker.UpdateMap(AppMgr.mapInfo);
+ else
+ System.out
+ .println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
}
public class MyLocationListener implements BDLocationListener {
@@ -165,9 +176,14 @@ public class Main extends PiztorAct {
locData.accuracy = location.getRadius();
locData.direction = location.getDerect();
- mapMaker.UpdateLocationOverlay(locData, false);
- if (Infomation.token != null)
- AppMgr.transam.send(new ReqUpdate(Infomation.token, Infomation.username, locData.latitude, locData.longitude, System.currentTimeMillis(), 2000));
+ mapMaker.UpdateLocationOverlay(locData, isFirstLocation);
+ isFirstLocation = false;
+ if (Infomation.token != null) {
+ AppMgr.transam.send(new ReqUpdate(Infomation.token,
+ Infomation.username, locData.latitude,
+ locData.longitude, System.currentTimeMillis(), 2000));
+ Infomation.myInfo.setLocation(locData.latitude, locData.longitude);
+ }
}
@Override
@@ -236,9 +252,7 @@ public class Main extends PiztorAct {
requesLocation(Infomation.myInfo.gid);
break;
case FocuseButtonPress:
- if( locData != null) {
- mapMaker.UpdateLocationOverlay(locData, true);
- } else mapMaker.InitMap();
+ mapMaker.UpdateLocationOverlay(locData, true);
break;
case SuccessFetch:
flushMap();
@@ -293,16 +307,13 @@ public class Main extends PiztorAct {
actMgr.add(focusStatus, mapViewtouched, startStatus);
actMgr.add(focusStatus, SuccessFetch, focusStatus);
actMgr.add(focusStatus, Fetch, focusStatus);
- //autodate = new Timer();
- flushMap();
setContentView(R.layout.activity_main);
mMapView = (MapView) findViewById(R.id.bmapView);
mapMaker = new MapMaker(mMapView, getApplicationContext());
+ mapMaker.clearOverlay(mMapView);
mapMaker.InitMap();
mLocClient = new LocationClient(this);
locData = new LocationData();
- locData.latitude = 31.032247;
- locData.longitude = 121.445937;
mLocClient.registerLocationListener(myListener);
LocationClientOption option = new LocationClientOption();
option.setOpenGps(true);
@@ -313,6 +324,10 @@ public class Main extends PiztorAct {
mapMaker.UpdateLocationOverlay(locData, false);
}
+ /*
+ * public boolean onTap(int index) { OverlayItem item = getItem(index);
+ * mCurItem = item; if () }
+ */
@Override
protected void onStart() {
super.onStart();
@@ -344,6 +359,7 @@ public class Main extends PiztorAct {
@Override
protected void onResume() {
mapMaker.onResume();
+ flushMap();
super.onResume();
}
@@ -356,7 +372,6 @@ public class Main extends PiztorAct {
@Override
public void onStop() {
super.onStop();
- //autodate.cancel();
}
@Override
@@ -397,4 +412,4 @@ public class Main extends PiztorAct {
mMapView.onRestoreInstanceState(savedInstanceState);
}
-}
+} \ No newline at end of file
diff --git a/client/Piztor/src/com/macaroon/piztor/MapMaker.java b/client/Piztor/src/com/macaroon/piztor/MapMaker.java
index 895d409..4e30df6 100644
--- a/client/Piztor/src/com/macaroon/piztor/MapMaker.java
+++ b/client/Piztor/src/com/macaroon/piztor/MapMaker.java
@@ -48,173 +48,243 @@ import com.baidu.mapapi.map.MyLocationOverlay;
import com.baidu.mapapi.map.OverlayItem;
import com.baidu.mapapi.map.PopupClickListener;
import com.baidu.mapapi.map.PopupOverlay;
+import com.baidu.mapapi.search.MKPoiInfo;
+import com.baidu.mapapi.search.MKPoiResult;
import com.baidu.platform.comapi.basestruct.GeoPoint;
-public class MapMaker extends Activity{
-
+public class MapMaker extends Activity {
+
+ // MapView controlling component
private MapView mMapView = null;
private MapController mMapController = null;
- private static GeoPoint sjtuCenter = new GeoPoint((int)(31.032247 * 1E6), (int)(121.445937 * 1E6));
+
+ // Default center
+ private final static GeoPoint sjtuCenter = new GeoPoint((int)(31.032247 * 1E6), (int)(121.445937 * 1E6));
+
+ // Map layers and items
private MyOverlay mOverlay = null;
private OverlayItem curItem = null;
- private ArrayList<OverlayItem> mItems = null;
private LocationOverlay mLocationOverlay;
+ private ArrayList<OverlayItem> mItems = null;
+ private MapInfo preMapInfo = null;
+
+ // marker layer
+ private MyOverlay markerOverlay;
+ private OverlayItem nowMarker = null;
+
+ //
private Context context;
- private MKMapTouchListener mapTouchListener;
- boolean isFirstLoc = true;
- /**
- * popups
- */
+ private MKMapTouchListener mapTouchListener;
+
+ // Popup component
private PopupOverlay popLay = null;
private TextView popupText = null;
private View viewCache = null;
private View popupInfo = null;
- public MapMaker(MapView mapView, Context c) {
+ /**
+ * Constructor
+ */
+ public MapMaker(MapView mapView, Context cc) {
+
mMapView = mapView;
mMapController = mMapView.getController();
+
mMapController.setCenter(sjtuCenter);
- mMapController.setZoom(17);
+ mMapController.setZoom(16);
mMapController.setRotation(-22);
mMapController.enableClick(true);
- context = c;
+
+ context = cc;
mLocationOverlay = null;
mOverlay = null;
}
+ /**
+ * Layer for my location
+ */
public class LocationOverlay extends MyLocationOverlay {
+
public LocationOverlay(MapView mapView) {
super(mapView);
}
}
- public class MyOverlay extends ItemizedOverlay{
- public MyOverlay(Drawable defaultMarker, MapView mapView) {
- super(defaultMarker, mapView);
+ /**
+ * Layer for items(other users)
+ */
+ public class MyOverlay extends ItemizedOverlay {
+
+ public MyOverlay(Drawable defaultMaker, MapView mapView) {
+ super(defaultMaker, mapView);
}
-
+
@Override
- public boolean onTap(int index){
- Log.d("123", "Marker tap");
+ public boolean onTap(int index) {
+
OverlayItem item = getItem(index);
- popupText.setText("^ _ ^");
- Bitmap bitmap = BMapUtil.getBitmapFromView(popupInfo);
- popLay.showPopup(bitmap,item.getPoint(),32);
+ //TODO
+ /////////////////////////////////////////////////////////
+ popupText.setText("^_^");
+ Bitmap bitmap = BMapUtil.getBitmapFromView(popupInfo);
+ popLay.showPopup(bitmap, item.getPoint(),32);
+
return true;
}
-
- @Override
- public boolean onTap(GeoPoint pt, MapView mMapView){
- Log.d("123", "Marker tap disappear");
- if (popLay != null){
- popLay.hidePop();
+ @Override
+ public boolean onTap(GeoPoint pt, MapView mapView) {
+
+ if(popLay != null) {
+ popLay.hidePop();
}
- return false;
- }
- }
- public void UpdateLocationOverlay(LocationData locationData, boolean hasAnimation) {
- /**
- * Update only location overlay
- */
- mLocationOverlay.setData(locationData);
- mMapView.refresh();
- if (hasAnimation || isFirstLoc) {
- mMapController.animateTo(new GeoPoint((int)(locationData.latitude * 1E6), (int)(locationData.longitude * 1E6)));
+ return false;
}
- isFirstLoc = true;
}
-
- public void InitMap() {
- /**
- * Initialize LocationOverlay
- */
- Log.d("GPS", "init");
+
+ /**
+ * Initialize location layer
+ */
+ public void InitLocationOverlay() {
+
mLocationOverlay = new LocationOverlay(mMapView);
- //mLocationOverlay.setMarker(context.getResources().getDrawable(R.drawable.marker1));
LocationData locationData = new LocationData();
mLocationOverlay.setData(locationData);
mMapView.getOverlays().add(mLocationOverlay);
mLocationOverlay.enableCompass();
mMapView.refresh();
- mOverlay = new MyOverlay(context.getResources().getDrawable(R.drawable.circle_red), mMapView);
- Log.d("123", "MapView initialized");
+ }
- /**
- * Initialize pop up
- */
- LayoutInflater inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
- Log.d("123", "OK 0");
+ /**
+ * Initialize other users layer
+ */
+ public void InitMyOverLay() {
+
+ //TODO
+ /////////////////////////////////////////////////////////////////
+ mOverlay = new MyOverlay(context.getResources().getDrawable(R.drawable.circle_red), mMapView);
+ markerOverlay = new MyOverlay(context.getResources().getDrawable(R.drawable.marker1), mMapView);
+ }
+
+ /**
+ * Initialize popup
+ */
+ public void InitPopup() {
+
+ LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
viewCache = inflater.inflate(R.layout.custom_text_view, null);
- Log.d("123", "OK 1");
- popupInfo = (View) viewCache.findViewById(R.id.popinfo);
- Log.d("123", "OK 2");
- popupText = (TextView) viewCache.findViewById(R.id.textcache);
- Log.d("123", "OK 3");
- Log.d("123", "Popup initialized");
+ popupInfo = (View)viewCache.findViewById(R.id.popinfo);
+ popupText = (TextView)viewCache.findViewById(R.id.textcache);
-
PopupClickListener popListener = new PopupClickListener() {
+
@Override
public void onClickedPopup(int index) {
- //
+ // when the popup is clicked
+ if (index == 0) {
+ // do nothing
+ }
+ if (index == 1) {
+ // this is a marker and remove it
+ }
}
};
+
popLay = new PopupOverlay(mMapView, popListener);
+ }
+
+
+ /**
+ * Initialize touch listener
+ */
+ public void InitTouchListenr() {
- /**
- * Initialize touch listener
- */
- /**
- * TODO
- */
mapTouchListener = new MKMapTouchListener() {
+
@Override
- public void onMapClick(GeoPoint point) {
- System.out.println("++++++++++++++++++++++++++++++++ SingleClick "
- + point.getLatitudeE6() * 1E-6 + " " + point.getLongitudeE6() * 1E-6);
+ public void onMapLongClick(GeoPoint arg0) {
+ DrawMarker(arg0);
+ Log.d("marker", "draw a new marker");
}
-
+
@Override
- public void onMapDoubleClick(GeoPoint point) {
- System.out.println("++++++++++++++++++++++++++++++++ DoubleClick "
- + point.getLatitudeE6() * 1E-6 + " " + point.getLongitudeE6() * 1E-6);
+ public void onMapDoubleClick(GeoPoint arg0) {
+ // TODO Auto-generated method stub
+
}
-
+
@Override
- public void onMapLongClick(GeoPoint point) {
- System.out.println("++++++++++++++++++++++++++++++++ LongClick "
- + point.getLatitudeE6() * 1E-6 + " " + point.getLongitudeE6() * 1E-6);
+ public void onMapClick(GeoPoint arg0) {
+ // TODO Auto-generated method stub
+
}
};
mMapView.regMapTouchListner(mapTouchListener);
+ }
+
+ /**
+ * Initialize map
+ */
+ public void InitMap() {
+
+ InitLocationOverlay();
+ InitMyOverLay();
+ InitPopup();
+ InitTouchListenr();
+ }
+ /**
+ * Update location layer when new location is received
+ */
+ public void UpdateLocationOverlay(LocationData locationData, boolean hasAnimation) {
+
+ mLocationOverlay.setData(locationData);
+ mMapView.refresh();
+ if (hasAnimation) {
+ mMapController.animateTo(new GeoPoint((int)(locationData.latitude * 1E6)
+ , (int)(locationData.longitude * 1E6)));
+ }
}
+ /**
+ * Update to draw other users
+ */
public void UpdateMap(MapInfo mapInfo) {
- /**
- * Update location of others
- */
- if (mOverlay != null && mOverlay.getAllItem().size() != 0) {
- clearOverlay(mMapView);
+
+ if (mapInfo != null) {
+ preMapInfo = mapInfo;
+ if (mOverlay != null && mOverlay.getAllItem().size() != 0) {
+ mOverlay.removeAll();
+ }
+ mOverlay = new MyOverlay(context.getResources().getDrawable(R.drawable.circle_red), mMapView);
+ GeoPoint p;
+ Vector<UserInfo> allUsers = mapInfo.getVector();
+ boolean flag = false;
+ for (int i =1; i < allUsers.size(); i++) {
+ // it's me!
+ if (allUsers.get(i).uid == Infomation.myInfo.uid) continue;
+ p = new GeoPoint((int)(allUsers.get(i).getLatitude() * 1E6),
+ (int)(allUsers.get(i).getLongitude()*1E6));
+ curItem = new OverlayItem(p, "USERNAME HERE!!!!!", "");
+ //TODO
+ ////////////////////////////////////////////////////////////
+ if (flag == false){
+ flag = true;
+ curItem.setMarker(context.getResources().getDrawable(R.drawable.circle_green));
+ } else {
+ curItem.setMarker(context.getResources().getDrawable(R.drawable.circle_red));
+ }
+ mOverlay.addItem(curItem);
+ }
+ mItems = new ArrayList<OverlayItem>();
+ mItems.addAll(mOverlay.getAllItem());
}
- mOverlay = new MyOverlay(context.getResources().getDrawable(R.drawable.circle_red), mMapView);
- //mMapView.refresh();
- GeoPoint p;
- Vector<UserInfo> allUsers = mapInfo.getVector();
- System.out.println("SSSSSSSSSSSSSSSSize "+allUsers.size());
- for(int i = 0; i < allUsers.size(); i++) {
- if (allUsers.get(i).uid == Infomation.myInfo.uid) continue;
- p = new GeoPoint((int)(allUsers.get(i).getLatitude() * 1E6)
- ,(int)(allUsers.get(i).getLongitude() * 1E6));
- curItem = new OverlayItem(p, "^_^", "");
- curItem.setMarker(context.getResources().getDrawable(R.drawable.circle_red));
- mOverlay.addItem(curItem);
+ if (nowMarker != null) {
+ Log.d("marker", "now marker is not null");
+ mOverlay.addItem(nowMarker);
}
- mItems = new ArrayList<OverlayItem>();
- mItems.addAll(mOverlay.getAllItem());
if (mMapView != null) {
if (mMapView.getOverlays() != null) {
mMapView.getOverlays().add(mOverlay);
@@ -222,19 +292,52 @@ public class MapMaker extends Activity{
}
}
}
+
+ /**
+ * Update marker
+ */
+ public void UpdateMarker() {
+
+ mOverlay.addItem(nowMarker);
+ if (mMapView != null) {
+ mMapView.getOverlays().add(mOverlay);
+ mMapView.refresh();
+ }
+ }
+
+ /**
+ * Draw a marker
+ */
+ public void DrawMarker(GeoPoint markerPoint) {
+
+ nowMarker = new OverlayItem(markerPoint, "THIS IS A MARKER", "");
+ nowMarker.setMarker(context.getResources().getDrawable(R.drawable.marker1));
+ Log.d("marker", "new marker created");
+ System.out.println("mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm " + markerPoint.getLatitudeE6() + " " + markerPoint.getLongitudeE6());
+
+ UpdateMap(preMapInfo);
+ }
-
+ /**
+ * Remove all other users
+ */
public void clearOverlay(View view) {
- mOverlay.removeAll();
- mMapView.refresh();
+
+ if(mOverlay != null && mOverlay.getAllItem().size() != 0) {
+ mOverlay.removeAll();
+ mMapView.refresh();
+ }
}
+ /**
+ * Reset other users over lay
+ */
public void resetOverlay(View view) {
+
clearOverlay(null);
mOverlay.addItem(mItems);
- mMapView.refresh();
}
-
+
@Override
protected void onPause() {
mMapView.onPause();
@@ -243,11 +346,11 @@ public class MapMaker extends Activity{
@Override
protected void onResume() {
mMapView.onResume();
- }
+ }
@Override
protected void onDestroy() {
mMapView.destroy();
}
+
}
-