¸ãºäÀ§¿¡ ½ºÇdzʸ¦ »Ñ¸®°í
½ºÇdzʷΠ¾ÆÀÌÅÛÀ» Ŭ¸¯ÇÏ¸é ¸ÊºäÀ§¿¡ ³ë¼±ÀÌ ¿À¹ö·¹À̵Ǵ ÄÚµùÀÔ´Ï´Ù
¤Ð¤Ð
±Ùµ¥ ½ºÇÇ³Ê µû·Î ¿À¹ö·¹ÀÌ µû·Î ÇÏ¸é µÑ´Ù ³ª¿À´Âµ¥
½ºÇdzʺäÀÇ ½ºÀ§Ä¡¹® ¾È¿¡ ³Ö¾î¼ ¾ÆÀÌÅÛÀ» Ŭ¸¯ÇÏ¿© ¿À¹ö·¹ÀÌ ÇÏ·Á±¸ ÇÏ¸é ³ë¼±ÀÌ ¾È³ª¿É´Ï´Ù ¤Ð¤Ð
ÄÚµù»ó¿¡´Â ³í¸®ÀûÀ¸·Î´Â ÀÌ·¸°Ô ÇÏ¸é ³ª¿Ã°Å °°Àºµ¥ »ý°¢Ã³·³ µÇÁú ¾Ê½À´Ï´Ù.¤Ð¤Ð °í¼ö´Ôµé ´äº¯Á» ºÎŹµå¸³´Ï´Ù
ÀÏÁÖÀÏ° ¿ä°Å Çϳª¶§¹®¿¡ ½Ã°£À» ¾ó¸¶³ª ÇãºñÇß´ÂÁö ¸ð¸£°Ú½À´Ï´Ù..ºÎŹµå¸®°Ú½À´Ï´Ù.¤Ð
Âü°í·Î Å佺Ʈ ¹®ÀåÀº ³ª¿É´Ï´Ù ¤Ð¤Ð ±×·¡¼ ´õ ¹ÌÄ¡°Ú½À´Ï´Ù.¤Ð¤Ð
package pe.Map;
import java.util.List;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Point;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import android.widget.Toast;
import android.widget.AdapterView.OnItemSelectedListener;
import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;
import com.google.android.maps.Projection;
public class Map extends MapActivity
{
MapView mapView;
MapController mControl;
ArrayAdapter<CharSequence> adspin;
private Spinner sp;
private List<Overlay> mapOverlays;
private Projection projection;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
sp = (Spinner)findViewById(R.id.spin);
sp.setPrompt("³ë¼±À»¼±ÅÃÇϼ¼¿ä.");
adspin = ArrayAdapter.createFromResource(this, R.array.strArray,
android.R.layout.simple_spinner_item);
adspin.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
sp.setAdapter(adspin);
mapView = (MapView) findViewById(R.id.mapview);
mapView.setBuiltInZoomControls(true);
mapOverlays = mapView.getOverlays();
projection = mapView.getProjection();
mapOverlays.add(new MyOverlay());
mControl = mapView.getController();
mControl.setZoom(16);
mapView.setBuiltInZoomControls(true);
GeoPoint pt = new GeoPoint((int)(34.77656 * 1e6), (int)(127.699455 * 1e6));
mControl.setCenter(pt);
}
@Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
class MyOverlay extends Overlay{
public MyOverlay(){
}
public void draw(final Canvas canvas, MapView mapv, boolean shadow){
super.draw(canvas, mapv, shadow);
final Paint mPaint = new Paint();
mPaint.setDither(true);
mPaint.setColor(Color.RED);
mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
mPaint.setStrokeWidth(3);
sp.setOnItemSelectedListener(new OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> parent, View v, final int position, long id) {
Toast.makeText(getApplicationContext(), parent.getItemAtPosition(position).toString(),Toast.LENGTH_SHORT).show();
switch(position){
case 0:
GeoPoint gP1 = new GeoPoint((int)(34.77656 * 1e6), (int)(127.699455 * 1e6));
GeoPoint gP2 = new GeoPoint((int)(34.7759 * 1e6), (int)(127.698906 * 1e6));
GeoPoint gP3 = new GeoPoint((int)(34.775215 * 1e6), (int)(127.69823 * 1e6));
GeoPoint gP4 = new GeoPoint((int)(34.77426 * 1e6), (int)(127.69841 * 1e6));
GeoPoint gP5 = new GeoPoint((int)(34.7742 * 1e6), (int)(127.698296 * 1e6));
GeoPoint gP6 = new GeoPoint((int)(34.774082 * 1e6), (int)(127.698265 * 1e6));
GeoPoint gP7 = new GeoPoint((int)(34.774 * 1e6), (int)(127.69835 * 1e6));
GeoPoint gP8 = new GeoPoint((int)(34.773987 * 1e6), (int)(127.698524 * 1e6));
GeoPoint gP9 = new GeoPoint((int)(34.77297 * 1e6), (int)(127.69862 * 1e6));
GeoPoint gP10 = new GeoPoint((int)(34.772865 * 1e6), (int)(127.6986 * 1e6));
GeoPoint gP11 = new GeoPoint((int)(34.77224 * 1e6), (int)(127.69807 * 1e6));
GeoPoint gP12 = new GeoPoint((int)(34.7721 * 1e6), (int)(127.69801 * 1e6));
GeoPoint gP13 = new GeoPoint((int)(34.771877 * 1e6), (int)(127.69807 * 1e6));
GeoPoint gP14 = new GeoPoint((int)(34.77171 * 1e6), (int)(127.69826 * 1e6));
GeoPoint gP15 = new GeoPoint((int)(34.771652 * 1e6), (int)(127.6985 * 1e6));
GeoPoint gP16 = new GeoPoint((int)(34.77174 * 1e6), (int)(127.69876 * 1e6));
GeoPoint gP17 = new GeoPoint((int)(34.771896 * 1e6), (int)(127.69898 * 1e6));
GeoPoint gP18 = new GeoPoint((int)(34.77347 * 1e6), (int)(127.70063 * 1e6));
GeoPoint gP19 = new GeoPoint((int)(34.77357 * 1e6), (int)(127.70091 * 1e6));
GeoPoint gP20 = new GeoPoint((int)(34.773735 * 1e6), (int)(127.7011 * 1e6));
GeoPoint gP21 = new GeoPoint((int)(34.77293 * 1e6), (int)(127.703094 * 1e6));
GeoPoint gP22 = new GeoPoint((int)(34.771362 * 1e6), (int)(127.7022 * 1e6));
GeoPoint gP23 = new GeoPoint((int)(34.77028 * 1e6), (int)(127.70253 * 1e6));
GeoPoint gP24 = new GeoPoint((int)(34.768906 * 1e6), (int)(127.69621 * 1e6));
GeoPoint gP25 = new GeoPoint((int)(34.76806 * 1e6), (int)(127.699165 * 1e6));
GeoPoint gP26 = new GeoPoint((int)(34.766342 * 1e6), (int)(127.702736 * 1e6));
GeoPoint gP27 = new GeoPoint((int)(34.764244 * 1e6), (int)(127.7058 * 1e6));
GeoPoint gP28 = new GeoPoint((int)(34.763153 * 1e6), (int)(127.706924 * 1e6));
GeoPoint gP29 = new GeoPoint((int)(34.760788 * 1e6), (int)(127.70898 * 1e6));
GeoPoint gP30 = new GeoPoint((int)(34.759186 * 1e6), (int)(127.71133 * 1e6));
GeoPoint gP31 = new GeoPoint((int)(34.758766 * 1e6), (int)(127.71262 * 1e6));
GeoPoint gP32 = new GeoPoint((int)(34.7581 * 1e6), (int)(127.71659 * 1e6));
GeoPoint gP33 = new GeoPoint((int)(34.756657 * 1e6), (int)(127.71894 * 1e6));
GeoPoint gP34 = new GeoPoint((int)(34.75572 * 1e6), (int)(127.7201 * 1e6));
GeoPoint gP35 = new GeoPoint((int)(34.75563 * 1e6), (int)(127.723465 * 1e6));
GeoPoint gP36 = new GeoPoint((int)(34.754856 * 1e6), (int)(127.72614 * 1e6));
GeoPoint gP37 = new GeoPoint((int)(34.75388 * 1e6), (int)(127.72733 * 1e6));
GeoPoint gP38 = new GeoPoint((int)(34.752663 * 1e6), (int)(127.72769 * 1e6));
GeoPoint gP39 = new GeoPoint((int)(34.750183 * 1e6), (int)(127.72783 * 1e6));
GeoPoint gP40 = new GeoPoint((int)(34.74727 * 1e6), (int)(127.72893 * 1e6));
GeoPoint gP41 = new GeoPoint((int)(34.740353 * 1e6), (int)(127.72778 * 1e6));
GeoPoint gP42 = new GeoPoint((int)(34.73698 * 1e6), (int)(127.72174 * 1e6));
GeoPoint gP43 = new GeoPoint((int)(34.730354 * 1e6), (int)(127.71688 * 1e6));
GeoPoint gP44 = new GeoPoint((int)(34.729366 * 1e6), (int)(127.715645 * 1e6));
GeoPoint gP45 = new GeoPoint((int)(34.728973 * 1e6), (int)(127.716034 * 1e6));
GeoPoint gP46 = new GeoPoint((int)(34.72852 * 1e6), (int)(127.717094 * 1e6));
// Point p = new Point();
Point p1 = new Point();
Point p2 = new Point();
Point p3 = new Point();
Point p4 = new Point();
Point p5 = new Point();
Point p6 = new Point();
Point p7 = new Point();
Point p8 = new Point();
Point p9 = new Point();
Point p10 = new Point();
Point p11 = new Point();
Point p12 = new Point();
Point p13 = new Point();
Point p14 = new Point();
Point p15 = new Point();
Point p16 = new Point();
Point p17 = new Point();
Point p18 = new Point();
Point p19 = new Point();
Point p20 = new Point();
Point p21 = new Point();
Point p22 = new Point();
Point p23 = new Point();
Point p24 = new Point();
Point p25 = new Point();
Point p26 = new Point();
Point p27 = new Point();
Point p28 = new Point();
Point p29 = new Point();
Point p30 = new Point();
Point p31 = new Point();
Point p32 = new Point();
Point p33 = new Point();
Point p34 = new Point();
Point p35 = new Point();
Point p36 = new Point();
Point p37 = new Point();
Point p38 = new Point();
Point p39 = new Point();
Point p40 = new Point();
Point p41 = new Point();
Point p42 = new Point();
Point p43 = new Point();
Point p44 = new Point();
Point p45 = new Point();
Point p46 = new Point();
// Path path = new Path();
// projection.toPixels(gP, p);
projection.toPixels(gP1, p1);
projection.toPixels(gP2, p2);
projection.toPixels(gP3, p3);
projection.toPixels(gP4, p4);
projection.toPixels(gP5, p5);
projection.toPixels(gP6, p6);
projection.toPixels(gP7, p7);
projection.toPixels(gP8, p8);
projection.toPixels(gP9, p9);
projection.toPixels(gP10, p10);
projection.toPixels(gP11, p11);
projection.toPixels(gP12, p12);
projection.toPixels(gP13, p13);
projection.toPixels(gP14, p14);
projection.toPixels(gP15, p15);
projection.toPixels(gP16, p16);
projection.toPixels(gP17, p17);
projection.toPixels(gP18, p18);
projection.toPixels(gP19, p19);
projection.toPixels(gP20, p20);
projection.toPixels(gP21, p21);
projection.toPixels(gP22, p22);
projection.toPixels(gP23, p23);
projection.toPixels(gP24, p24);
projection.toPixels(gP25, p25);
projection.toPixels(gP26, p26);
projection.toPixels(gP27, p27);
projection.toPixels(gP28, p28);
projection.toPixels(gP29, p29);
projection.toPixels(gP30, p30);
projection.toPixels(gP31, p31);
projection.toPixels(gP32, p32);
projection.toPixels(gP33, p33);
projection.toPixels(gP34, p34);
projection.toPixels(gP35, p35);
projection.toPixels(gP36, p36);
projection.toPixels(gP37, p37);
projection.toPixels(gP38, p38);
projection.toPixels(gP39, p39);
projection.toPixels(gP40, p40);
projection.toPixels(gP41, p41);
projection.toPixels(gP42, p42);
projection.toPixels(gP43, p43);
projection.toPixels(gP44, p44);
projection.toPixels(gP45, p45);
projection.toPixels(gP46, p46);
mPaint.setColor(Color.RED);
float[] path1 = { p1.x, p1.y, p2.x,p2.y, p2.x,p2.y, p3.x,p3.y, p3.x,p3.y,p4.x,p4.y,
p4.x, p4.y, p5.x, p5.y,p5.x, p5.y,p6.x, p6.y,p6.x, p6.y,p7.x, p7.y,
p7.x, p7.y,p8.x, p8.y, p8.x, p8.y, p9.x, p9.y, p9.x, p9.y, p10.x, p10.y,
p10.x, p10.y, p11.x, p11.y, p11.x, p11.y, p12.x, p12.y, p12.x, p12.y,
p13.x, p13.y, p13.x, p13.y, p14.x, p14.y, p14.x, p14.y, p15.x, p15.y,
p15.x, p15.y, p16.x, p16.y, p16.x, p16.y, p17.x, p17.y, p17.x, p17.y, p18.x, p18.y, p18.x, p18.y,
p19.x, p19.y, p19.x, p19.y, p20.x, p20.y, p20.x, p20.y, p21.x, p21.y, p21.x, p21.y, p22.x, p22.y,
p22.x, p22.y, p23.x, p23.y, p23.x, p23.y, p24.x, p24.y, p24.x, p24.y, p25.x, p25.y, p25.x, p25.y,
p26.x, p26.y, p26.x, p26.y, p27.x, p27.y, p27.x, p27.y, p28.x, p28.y, p28.x, p28.y, p29.x, p29.y,
p29.x, p29.y, p30.x, p30.y, p30.x, p30.y, p31.x, p31.y, p31.x, p31.y, p32.x, p32.y, p32.x, p32.y,
p33.x, p33.y, p33.x, p33.y, p34.x, p34.y, p34.x, p34.y, p35.x, p35.y, p35.x, p35.y, p36.x, p36.y,
p36.x, p36.y, p37.x, p37.y, p37.x, p37.y, p38.x, p38.y, p38.x, p38.y, p39.x, p39.y, p39.x, p39.y,
p40.x, p40.y, p40.x, p40.y,
p41.x, p41.y, p41.x, p41.y, p42.x, p42.y, p42.x, p42.y, p43.x, p43.y, p43.x, p43.y, p44.x, p44.y,
p44.x, p44.y, p45.x, p45.y, p45.x, p45.y, p46.x, p46.y
};
canvas.drawLines(path1, mPaint);
break;
case 1:
break;
case 2:
break;
case 3:
break;
case 4:
break;
case 5:
break;
case 6:
break;
case 7:
break;
}
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {
// TODO Auto-generated method stub
}
});
}
}
}
* ±ÛÀ» µî·ÏÇϽǶ§ ²À ÇÊ¿äÇÑ °æ¿ì°¡ ¾Æ´Ï¸é °³ÀÎÁ¤º¸¸¦ ³²±âÁö ¸¶¼¼¿ä ^^ (¿¬¶ôó,À̸ÞÀÏÁÖ¼Ò,Áֹεî·Ï¹øÈ£ µî)