Java Code Examples for com.amap.api.maps.model.BitmapDescriptorFactory#fromView()

The following examples show how to use com.amap.api.maps.model.BitmapDescriptorFactory#fromView() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClusterOverlay.java    From android-cluster-marker with Apache License 2.0 6 votes vote down vote up
/**
 * 获取每个聚合点的绘制样式
 */
private BitmapDescriptor getBitmapDes(int num) {
    BitmapDescriptor bitmapDescriptor = mLruCache.get(num);
    if (bitmapDescriptor == null) {
        TextView textView = new TextView(mContext);
        if (num > 1) {
            String tile = String.valueOf(num);
            textView.setText(tile);
        }
        textView.setGravity(Gravity.CENTER);
        textView.setTextColor(Color.BLACK);
        textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 15);
        if (mClusterRender != null && mClusterRender.getDrawAble(num) != null) {
            textView.setBackgroundDrawable(mClusterRender.getDrawAble(num));
        } else {
            textView.setBackgroundResource(R.drawable.defaultcluster);
        }
        bitmapDescriptor = BitmapDescriptorFactory.fromView(textView);
        mLruCache.put(num, bitmapDescriptor);

    }
    return bitmapDescriptor;
}
 
Example 2
Source File: GaoDeMapCustomMarkerView.java    From FimiX8-RE with MIT License 5 votes vote down vote up
public BitmapDescriptor createCustomMarkerViewForP2P(Context context, int res, float heightVale, int npos) {
    View view = LayoutInflater.from(context).inflate(R.layout.x8_map_custom_mark_view_for_point, null);
    ((TextView) view.findViewById(R.id.point_heightValue)).setText(X8NumberUtil.getDistanceNumberString(heightVale, 0, true));
    ImageView imageView = (ImageView) view.findViewById(R.id.markerIcon);
    if (res != 0) {
        imageView.setBackgroundResource(res);
    }
    return BitmapDescriptorFactory.fromView(view);
}
 
Example 3
Source File: GaoDeMapCustomMarkerView.java    From FimiX8-RE with MIT License 5 votes vote down vote up
public BitmapDescriptor createCustomMarkerView(Context context, int res, float heightVale, int npos) {
    View view = LayoutInflater.from(context).inflate(R.layout.x8_map_custom_mark_view, null);
    TextView heightView = (TextView) view.findViewById(R.id.point_heightValue);
    ((TextView) view.findViewById(R.id.tv_pos)).setText("" + npos);
    heightView.setText(X8NumberUtil.getDistanceNumberString(heightVale, 0, true));
    ImageView imageView = (ImageView) view.findViewById(R.id.markerIcon);
    if (res != 0) {
        imageView.setBackgroundResource(res);
    }
    return BitmapDescriptorFactory.fromView(view);
}
 
Example 4
Source File: GaoDeMapCustomMarkerView.java    From FimiX8-RE with MIT License 5 votes vote down vote up
public BitmapDescriptor createCustomMarkerView2(Context context, int res, int nPos) {
    View view = LayoutInflater.from(context).inflate(R.layout.x8_map_custom_mark_view2, null);
    ((TextView) view.findViewById(R.id.point_heightValue)).setText("" + nPos);
    ImageView imageView = (ImageView) view.findViewById(R.id.markerIcon);
    if (res != 0) {
        imageView.setBackgroundResource(res);
    }
    return BitmapDescriptorFactory.fromView(view);
}
 
Example 5
Source File: GaoDeMapCustomMarkerView.java    From FimiX8-RE with MIT License 5 votes vote down vote up
public BitmapDescriptor createCurrentPointView(Context context, int res, int actionRes, int nPos) {
    View view = LayoutInflater.from(context).inflate(R.layout.x8_map_custom_mark_view4, null);
    ImageView imageView = (ImageView) view.findViewById(R.id.img_point);
    if (res != 0) {
        imageView.setBackgroundResource(res);
    }
    ImageView imageView2 = (ImageView) view.findViewById(R.id.img_action);
    if (res != 0) {
        imageView2.setBackgroundResource(actionRes);
    }
    ((TextView) view.findViewById(R.id.tv_index)).setText("" + nPos);
    return BitmapDescriptorFactory.fromView(view);
}
 
Example 6
Source File: AmapFragment.java    From BmapLite with GNU General Public License v3.0 5 votes vote down vote up
private void makeRangingMarker(MyPoiModel poi) {
    //构建Marker图标
    ImageView imageView = new ImageView(getActivity());
    imageView.setImageResource(R.drawable.shape_point);

    BitmapDescriptor bitmap = BitmapDescriptorFactory.fromView(imageView);

    Marker marker = mAmap.addMarker(new MarkerOptions().icon(bitmap).anchor(0.5f, 0.5f).position(new LatLng(poi.getLatitude(), poi.getLongitude())));

    if (null == mRangingMarkerList) {
        mRangingMarkerList = new ArrayList<>();
    }
    mRangingMarkerList.add(marker);
}
 
Example 7
Source File: AmapFragment.java    From BmapLite with Apache License 2.0 5 votes vote down vote up
private void makeRangingMarker(MyPoiModel poi) {
    //构建Marker图标
    ImageView imageView = new ImageView(getActivity());
    imageView.setImageResource(R.drawable.shape_point);

    BitmapDescriptor bitmap = BitmapDescriptorFactory.fromView(imageView);

    Marker marker = mAmap.addMarker(new MarkerOptions().icon(bitmap).anchor(0.5f, 0.5f).position(new LatLng(poi.getLatitude(), poi.getLongitude())));

    if (null == mRangingMarkerList) {
        mRangingMarkerList = new ArrayList<>();
    }
    mRangingMarkerList.add(marker);
}
 
Example 8
Source File: AMapMarker.java    From react-native-amap with MIT License 5 votes vote down vote up
private BitmapDescriptor getIcon() {
    if (hasCustomMarkerView) {
        // creating a bitmap from an arbitrary view
        if (iconBitmapDescriptor != null) {
            //Bitmap viewBitmap = createDrawable();
            //int width = Math.max(iconBitmap.getWidth(), viewBitmap.getWidth());
            //int height = Math.max(iconBitmap.getHeight(), viewBitmap.getHeight());
            //Bitmap combinedBitmap = Bitmap.createBitmap(width, height, iconBitmap.getConfig());
            //Canvas canvas = new Canvas(combinedBitmap);
            //canvas.drawBitmap(iconBitmap, 0, 0, null);
            //canvas.drawBitmap(viewBitmap, 0, 0, null);
            //return BitmapDescriptorFactory.fromBitmap(combinedBitmap);
            ImageView image = (ImageView) this.view.findViewById(R.id.icon);
            Bitmap bitmap = MLRoundedImageView.getCroppedBitmap(Bitmap.createScaledBitmap(iconBitmap, 120, 120, true), 60);
            image.setImageBitmap(bitmap);
            return BitmapDescriptorFactory.fromView(this.view);
        } else {
            return BitmapDescriptorFactory.fromBitmap(createDrawable());
        }
    } else if (iconBitmapDescriptor != null) {
        // use local image as a marker
        return iconBitmapDescriptor;
    } else {
        // render the default marker pin
        return BitmapDescriptorFactory.defaultMarker(this.markerHue);
    }
}
 
Example 9
Source File: GaoDeMapCustomMarkerView.java    From FimiX8-RE with MIT License 4 votes vote down vote up
public BitmapDescriptor createInreterstMarkerView0(Context context, int res) {
    return BitmapDescriptorFactory.fromView(LayoutInflater.from(context).inflate(R.layout.x8_map_custom_mark_view3, null));
}