//package com.jqyd.newprocess; // //import java.util.ArrayList; // //import android.content.Context; //import android.graphics.Canvas; //import android.graphics.Color; //import android.graphics.Paint; //import android.graphics.Point; //import android.graphics.drawable.Drawable; //import android.text.Html; //import android.view.View; //import android.widget.ImageView; //import android.widget.TextView; // //import com.amap.mapapi.core.OverlayItem; //import com.amap.mapapi.map.ItemizedOverlay; //import com.amap.mapapi.map.MapView; //import com.amap.mapapi.map.Projection; //import com.jqyd.manager.R; // ////在MAPVIEW之上创建一个图层,需要创建一个类,实现Overlay,并生成该类的对象,然后将该对象添加到MapView.getOverlays() ////一个OverlayItem对象代表一个在地图上显示的标记 //public class OverLayGj extends ItemizedOverlay<OverlayItem>{ // //创建list对象,用于持有该图层当中所有的标记对象 // private ArrayList<OverlayItem> overlayItems = new ArrayList<OverlayItem>(); // //新增 // private Gzgj context; // private Drawable marker; // private TextView textView1,textView2; // // public OverLayGj(Drawable marker) { // super(boundCenterBottom(marker)); // } // // public OverLayGj(Drawable marker,Context context){ // super(boundCenterBottom(marker)); // this.marker = marker; // this.context = (Gzgj) context; // } // //将生成好的OverlayItem对象添加到List当中 // public void addOverlay(OverlayItem overlayItem){ // overlayItems.add(overlayItem); // populate(); // } // // @Override // public void draw(Canvas canvas, MapView mapView, boolean shadow) { // // Projection projection = mapView.getProjection(); // for (int index = size() - 1; index >= 0; index--) { // OverlayItem overLayItem = getItem(index); // // String title = overLayItem.getTitle(); // String arr[] = title.split(","); // String b = arr[1]; // Point point = new Point(); // projection.toPixels(overLayItem.getPoint(), point); // Paint paintText = new Paint(); // paintText.setColor(Color.RED); // paintText.setTextSize(15); // canvas.drawText(b, point.x + 5, point.y + 5, paintText); // // } // super.draw(canvas, mapView, shadow); // boundCenterBottom(marker); // } // // //创建一个OverlayItem对象 // @Override // protected OverlayItem createItem(int i) { // return overlayItems.get(i); // } // // @Override // public int size() { // return overlayItems.size(); // } // // protected boolean onTap(int i) { // // MapView.LayoutParams geoLP = (MapView.LayoutParams)context.popView.getLayoutParams(); // geoLP.point = overlayItems.get(i).getPoint(); // context.mMapView.updateViewLayout(context.popView, geoLP); // context.popView.setVisibility(View.VISIBLE); // textView1 = (TextView) context.popView.findViewById(R.id.map_bubbleTitle); // textView2 = (TextView) context.popView.findViewById(R.id.map_bubbleText); // String title = overlayItems.get(i).getTitle(); // String arr[] = title.split(","); // String b = arr[0]; // textView1.setText(b); // textView1.setTextColor(Color.RED); // textView2.setText(Html.fromHtml(overlayItems.get(i).getSnippet())); // textView2.setTextColor(Color.BLUE); // context.popView.setVisibility(View.VISIBLE); // ImageView imageView = (ImageView) context.popView.findViewById(R.id.map_bubbleImage); // imageView.setOnClickListener(new View.OnClickListener(){ // // public void onClick(View v) { // context.popView.setVisibility(View.GONE); // } // // }); // return true; // } // //}