com.amap.api.maps.model.BitmapDescriptor Java Examples

The following examples show how to use com.amap.api.maps.model.BitmapDescriptor. 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: AmapFragment.java    From BmapLite with GNU General Public License v3.0 6 votes vote down vote up
public void getFavoriteList() {
    if (null != mFavMarkerList && !mFavMarkerList.isEmpty()) {
        for (Marker o : mFavMarkerList) {
            o.remove();
        }
        mFavMarkerList.clear();
    }
    if (null != mFavoriteInteracter) {
        List<MyPoiModel> favoriteList = mFavoriteInteracter.getFavoriteList();
        if (null != favoriteList && !favoriteList.isEmpty()) {
            for (MyPoiModel poi : favoriteList) {
                BitmapDescriptor bitmapDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.ic_grade_point_2);
                Marker marker = mAmap.addMarker(new MarkerOptions().position(new LatLng(poi.getLatitude(), poi.getLongitude())).title(poi.getName()).snippet("").anchor(0.5f, 0.5f).icon(bitmapDescriptor));
                mFavMarkerList.add(marker);
            }
        }
    }
}
 
Example #2
Source File: AmapFragment.java    From BmapLite with Apache License 2.0 6 votes vote down vote up
public void getFavoriteList() {
    if (null != mFavMarkerList && !mFavMarkerList.isEmpty()) {
        for (Marker o : mFavMarkerList) {
            o.remove();
        }
        mFavMarkerList.clear();
    }
    if (null != mFavoriteInteracter) {
        List<MyPoiModel> favoriteList = mFavoriteInteracter.getFavoriteList();
        if (null != favoriteList && !favoriteList.isEmpty()) {
            for (MyPoiModel poi : favoriteList) {
                BitmapDescriptor bitmapDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.ic_grade_point_2);
                Marker marker = mAmap.addMarker(new MarkerOptions().position(new LatLng(poi.getLatitude(), poi.getLongitude())).title(poi.getName()).snippet("").anchor(0.5f, 0.5f).icon(bitmapDescriptor));
                mFavMarkerList.add(marker);
            }
        }
    }
}
 
Example #3
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 #4
Source File: ClusterOverlay.java    From android-cluster-marker with Apache License 2.0 6 votes vote down vote up
/**
     * 构造函数,批量添加聚合元素时,调用此构造函数
     *
     * @param amap
     * @param clusterItems 聚合元素
     * @param clusterSize
     * @param context
     */
    public ClusterOverlay(AMap amap, List<ClusterItem> clusterItems,
                          int clusterSize, Context context) {
//默认最多会缓存80张图片作为聚合显示元素图片,根据自己显示需求和app使用内存情况,可以修改数量
        mLruCache = new LruCache<Integer, BitmapDescriptor>(80) {
            protected void entryRemoved(boolean evicted, Integer key, BitmapDescriptor oldValue, BitmapDescriptor newValue) {
                oldValue.getBitmap().recycle();
            }
        };
        if (clusterItems != null) {
            mClusterItems = clusterItems;
        } else {
            mClusterItems = new ArrayList<ClusterItem>();
        }
        mContext = context;
        mClusters = new ArrayList<Cluster>();
        this.mAMap = amap;
        mClusterSize = clusterSize;
        mPXInMeters = mAMap.getScalePerPixel();
        mClusterDistance = mPXInMeters * mClusterSize;
        amap.setOnCameraChangeListener(this);
        amap.setOnMarkerClickListener(this);
        initThreadHandler();
        assignClusters();
    }
 
Example #5
Source File: MainActivity.java    From SmoothMove with MIT License 6 votes vote down vote up
private void addMarkerInBeijing(int number) {
    Random random = new Random();

    //new LatLng(39.90403, 116.407525)
    double tem_lat = 39.9;
    double tem_lon = 116.4;
    BitmapDescriptor descriptor = BitmapDescriptorFactory.defaultMarker();
    if (number == 1) {
        aMap.addMarker(new MarkerOptions().position(new LatLng(tem_lat, tem_lon)).icon
                (descriptor));
        return;
    }

    for (int i = 0; i < number; i++) {
        LatLng latLng = new LatLng(tem_lat + random.nextDouble() * (random.nextBoolean() ? 1
                : -1), tem_lon + random.nextDouble() * (random.nextBoolean() ? 1 : -1));
        aMap.addMarker(new MarkerOptions().position(latLng).icon(descriptor));
    }

}
 
Example #6
Source File: GaoDeMapAiLineManager.java    From FimiX8-RE with MIT License 6 votes vote down vote up
public void setAiLineMarkByHistory(List<X8AiLinePointLatlngInfo> points, int mapTpye) {
    for (X8AiLinePointLatlngInfo point : points) {
        int res;
        MapPointLatLng mp = new MapPointLatLng();
        if (point.getYawMode() == 0) {
            res = R.drawable.x8_ai_line_point_no_angle1;
        } else {
            res = R.drawable.x8_ai_line_point_with_angle1;
        }
        BitmapDescriptor mBitmapDescriptor = new GaoDeMapCustomMarkerView().createCustomMarkerView2(this.context, res, this.mMarkerList.size() + 1);
        mp.altitude = (float) point.getAltitude();
        mp.nPos = this.mMarkerList.size() + 1;
        LatLng latLng = new LatLng(point.getLatitude(), point.getLongitude());
        Marker mMarker = this.aMap.addMarker(new MarkerOptions().position(latLng).icon(mBitmapDescriptor).anchor(0.5f, 0.5f).draggable(false));
        mp.longitude = latLng.longitude;
        mp.latitude = latLng.latitude;
        mMarker.setObject(mp);
        this.mMarkerList.add(mMarker);
        mp.distance = 0.0f;
        this.mMapPointList.add(mp);
        setRotateAngle(mMarker, point.getYaw() / 100.0f);
    }
    if (points.size() > 0) {
        drawPointLine(this.mGaodeMapLocationManager.getHomeLocation());
    }
}
 
Example #7
Source File: SmoothMoveActivity.java    From TraceByAmap with MIT License 5 votes vote down vote up
/**
     * 添加轨迹线
     */
    private void addPolylineInPlayGround() {
        List<LatLng> list = readLatLngs();
        List<Integer> colorList = new ArrayList<Integer>();
        List<BitmapDescriptor> bitmapDescriptors = new ArrayList<BitmapDescriptor>();

        int[] colors = new int[]{Color.argb(255, 0, 255, 0),Color.argb(255, 255, 255, 0),Color.argb(255, 255, 0, 0)};

        //用一个数组来存放纹理
        List<BitmapDescriptor> textureList = new ArrayList<BitmapDescriptor>();
        textureList.add(BitmapDescriptorFactory.fromResource(R.drawable.custtexture));

        List<Integer> texIndexList = new ArrayList<Integer>();
        texIndexList.add(0);//对应上面的第0个纹理
        texIndexList.add(1);
        texIndexList.add(2);

        Random random = new Random();
        for (int i = 0; i < list.size(); i++) {
            colorList.add(colors[random.nextInt(3)]);
            bitmapDescriptors.add(textureList.get(0));

        }

        mPolyline = mAMap.addPolyline(new PolylineOptions().setCustomTexture(BitmapDescriptorFactory.fromResource(R.drawable.custtexture)) //setCustomTextureList(bitmapDescriptors)
//				.setCustomTextureIndex(texIndexList)
                .addAll(list)
                .useGradient(true)
                .width(18));

        LatLngBounds.Builder builder = new LatLngBounds.Builder();
        builder.include(list.get(0));
        builder.include(list.get(list.size() - 2));

        mAMap.animateCamera(CameraUpdateFactory.newLatLngBounds(builder.build(), 100));
    }
 
Example #8
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 #9
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 #10
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 #11
Source File: MainActivity.java    From SmoothMove with MIT License 5 votes vote down vote up
private void addPolylineInPlayGround() {
    List<LatLng> list = readLatLngs();
    List<Integer> colorList = new ArrayList<Integer>();
    List<BitmapDescriptor> bitmapDescriptors = new ArrayList<BitmapDescriptor>();

    int[] colors = new int[]{Color.argb(255, 0, 255, 0), Color.argb(255, 255, 255, 0), Color
            .argb(255, 255, 0, 0)};

    //用一个数组来存放纹理
    List<BitmapDescriptor> textureList = new ArrayList<BitmapDescriptor>();
    textureList.add(BitmapDescriptorFactory.fromResource(R.drawable.custtexture));

    List<Integer> texIndexList = new ArrayList<Integer>();
    texIndexList.add(0);//对应上面的第0个纹理
    texIndexList.add(1);
    texIndexList.add(2);

    Random random = new Random();
    for (int i = 0; i < list.size(); i++) {
        colorList.add(colors[random.nextInt(3)]);
        bitmapDescriptors.add(textureList.get(0));

    }

    aMap.addPolyline(new PolylineOptions().setCustomTexture(BitmapDescriptorFactory
            .fromResource(R.drawable.custtexture)) //setCustomTextureList(bitmapDescriptors)
            //				.setCustomTextureIndex(texIndexList)
            .addAll(list)
            .useGradient(true)
            .width(18));
}
 
Example #12
Source File: PolylineActivitybase.java    From TraceByAmap with MIT License 5 votes vote down vote up
private void addPolylinesWithTexture() {
	//四个点
	LatLng A = new LatLng(Lat_A, Lon_A);
	LatLng B = new LatLng(Lat_B, Lon_B);
	LatLng C = new LatLng(Lat_C, Lon_C);
	LatLng D = new LatLng(Lat_D, Lon_D);
	
	//用一个数组来存放纹理
	List<BitmapDescriptor> texTuresList = new ArrayList<BitmapDescriptor>();
	texTuresList.add(BitmapDescriptorFactory.fromResource(R.drawable.map_alr));
	texTuresList.add(BitmapDescriptorFactory.fromResource(R.drawable.custtexture));
	texTuresList.add(BitmapDescriptorFactory.fromResource(R.drawable.map_alr_night));
	
	//指定某一段用某个纹理,对应texTuresList的index即可, 四个点对应三段颜色
	List<Integer> texIndexList = new ArrayList<Integer>();
	texIndexList.add(0);//对应上面的第0个纹理
	texIndexList.add(2);
	texIndexList.add(1);
	
	
	PolylineOptions options = new PolylineOptions();
	options.width(20);//设置宽度
	
	//加入四个点
	options.add(A,B,C,D);
	
	//加入对应的颜色,使用setCustomTextureList 即表示使用多纹理;
	options.setCustomTextureList(texTuresList);
	
	//设置纹理对应的Index
	options.setCustomTextureIndex(texIndexList);
	
	aMap.addPolyline(options);
}
 
Example #13
Source File: ParticleWeatherMapActivity.java    From TraceByAmap with MIT License 5 votes vote down vote up
/**
 * 初始化添加marker
 */
private void initWeather() {
    CameraPosition cameraPosition = aMap.getCameraPosition();
    boolean isNeedShowWeatherMarker = false;
    if (cameraPosition != null) {
        isNeedShowWeatherMarker = cameraPosition.zoom <= MAX_SHOW_WEATHER_MARKER_ZOOM;

        // 查看首次需不需要显示粒子效果
        changeParticleOverlayState(cameraPosition);
    }
    for (int i = 0; i < latLngs.length; i++) {
        LatLng latLng = latLngs[i];
        int index = i % pngPaths.length;

        // 天气状态随机选取,如果要使用到实际场景,这里需要修改成真是数据
        String path = pngPaths[index];

        BitmapDescriptor bitmapDescriptor = bitmapDescriptorHashtable.get(path);
        if (bitmapDescriptor == null) {
            bitmapDescriptor = BitmapDescriptorFactory.fromAsset(path);
            bitmapDescriptorHashtable.put(path, bitmapDescriptor);
        }

        Marker marker = aMap.addMarker(new MarkerOptions().position(latLng).icon(bitmapDescriptor).visible(isNeedShowWeatherMarker));
        if (marker != null) {
            marker.setObject(path);
            markerList.add(marker);
        }

    }

}
 
Example #14
Source File: PolylineActivity.java    From TraceByAmap with MIT License 5 votes vote down vote up
private void addPolylinesWithTexture() {
	//四个点
	LatLng A = new LatLng(Lat_A+1, Lon_A+1);
	LatLng B = new LatLng(Lat_B+1, Lon_B+1);
	LatLng C = new LatLng(Lat_C+1, Lon_C+1);
	LatLng D = new LatLng(Lat_D+1, Lon_D+1);
	
	//用一个数组来存放纹理
	List<BitmapDescriptor> texTuresList = new ArrayList<BitmapDescriptor>();
	texTuresList.add(BitmapDescriptorFactory.fromResource(R.drawable.map_alr));
	texTuresList.add(BitmapDescriptorFactory.fromResource(R.drawable.custtexture));
	texTuresList.add(BitmapDescriptorFactory.fromResource(R.drawable.map_alr_night));
	
	//指定某一段用某个纹理,对应texTuresList的index即可, 四个点对应三段颜色
	List<Integer> texIndexList = new ArrayList<Integer>();
	texIndexList.add(0);//对应上面的第0个纹理
	texIndexList.add(2);
	texIndexList.add(1);
	
	
	PolylineOptions options = new PolylineOptions();
	options.width(20);//设置宽度
	
	//加入四个点
	options.add(A,B,C,D);
	
	//加入对应的颜色,使用setCustomTextureList 即表示使用多纹理;
	options.setCustomTextureList(texTuresList);
	
	//设置纹理对应的Index
	options.setCustomTextureIndex(texIndexList);
	
	aMap.addPolyline(options);
}
 
Example #15
Source File: SmoothMarker.java    From SmoothMove with MIT License 5 votes vote down vote up
public void setDescriptor(BitmapDescriptor descriptor) {
    if (this.descriptor != null) {
        this.descriptor.recycle();
    }
    this.descriptor = descriptor;
    if (marker != null) {
        marker.setIcon(descriptor);
    }
}
 
Example #16
Source File: ShareActivity.java    From TraceByAmap with MIT License 5 votes vote down vote up
/**
 * 添加marker方法
 * 
 * @param lat
 * @param lon
 * @param title
 * @param snippet
 * @param icon
 */
private void addMarker(double lat, double lon, String title,
		String snippet, BitmapDescriptor icon) {
	MarkerOptions markerOption = new MarkerOptions();
	LatLng markerPoint = new LatLng(lat, lon);
	markerOption.position(markerPoint);
	markerOption.title(title).snippet(snippet);
	markerOption.icon(icon);
	mAMap.addMarker(markerOption);
}
 
Example #17
Source File: GaoDeMapAiSurroundManager.java    From FimiX8-RE with MIT License 5 votes vote down vote up
public void setAiSurroundMark(double latitude, double logitude) {
    FLatLng fLatLng = GpsCorrect.Earth_To_Mars(latitude, logitude);
    LatLng latLng = new LatLng(fLatLng.latitude, fLatLng.longitude);
    if (this.pointMarker == null) {
        BitmapDescriptor mBitmapDescriptor = new GaoDeMapCustomMarkerView().createCustomMarkerView(this.context, R.drawable.x8_img_ai_follow_point2);
        this.mp = new MapPointLatLng();
        this.pointMarker = this.aMap.addMarker(new MarkerOptions().position(latLng).icon(mBitmapDescriptor).anchor(0.5f, 0.5f).draggable(true));
        this.pointMarker.setObject(this.mp);
        return;
    }
    this.pointMarker.setPosition(latLng);
}
 
Example #18
Source File: GaoDeMapAiLineManager.java    From FimiX8-RE with MIT License 5 votes vote down vote up
public void setAiLineMarkByDevice(List<AckGetAiLinePoint> points, List<AckGetAiLinePoint> list) {
    for (AckGetAiLinePoint point : points) {
        int res;
        MapPointLatLng mp = new MapPointLatLng();
        mp.yawMode = point.getYawMode();
        if (mp.yawMode == 0) {
            res = R.drawable.x8_ai_line_point_no_angle1;
        } else {
            res = R.drawable.x8_ai_line_point_with_angle1;
        }
        BitmapDescriptor mBitmapDescriptor = new GaoDeMapCustomMarkerView().createCustomMarkerView2(this.context, res, this.mMarkerList.size() + 1);
        mp.altitude = (float) point.getAltitude();
        mp.nPos = this.mMarkerList.size() + 1;
        FLatLng fLatLng = GpsCorrect.Earth_To_Mars(point.getLatitude(), point.getLongitude());
        LatLng latLng = new LatLng(fLatLng.latitude, fLatLng.longitude);
        Marker mMarker = this.aMap.addMarker(new MarkerOptions().position(latLng).icon(mBitmapDescriptor).anchor(0.5f, 0.5f).draggable(false));
        mp.longitude = latLng.longitude;
        mp.latitude = latLng.latitude;
        mp.angle = point.getAngle();
        mMarker.setObject(mp);
        this.mMarkerList.add(mMarker);
        mp.distance = 0.0f;
        this.mMapPointList.add(mp);
        mMarker.setFlat(true);
        setRotateAngle(mMarker, point.getAngle());
    }
    if (points.size() > 0) {
        drawPointLine(this.mGaodeMapLocationManager.getHomeLocation());
    }
}
 
Example #19
Source File: GaoDeMapAiLineManager.java    From FimiX8-RE with MIT License 5 votes vote down vote up
public void addPointLatLng(LatLng latLng, float distance, LatLng deviceLocation, boolean isMapPoint, float angle) {
    BitmapDescriptor mBitmapDescriptor;
    MapPointLatLng mp = new MapPointLatLng();
    mp.nPos = this.mMarkerList.size() + 1;
    int h = Math.round(StateManager.getInstance().getX8Drone().getHeight());
    if (h <= 5) {
        h = 5;
    }
    if (isMapPoint) {
        mBitmapDescriptor = new GaoDeMapCustomMarkerView().createCustomMarkerView(this.context, R.drawable.x8_img_ai_follow_point2, (float) h, mp.nPos);
        mp.altitude = (float) h;
        mp.isMapPoint = isMapPoint;
    } else {
        mBitmapDescriptor = new GaoDeMapCustomMarkerView().createCustomMarkerView2(this.context, R.drawable.x8_ai_line_point_with_angle1, this.mMarkerList.size() + 1);
        mp.altitude = (float) h;
        mp.isMapPoint = isMapPoint;
    }
    Marker mMarker = this.aMap.addMarker(new MarkerOptions().position(latLng).icon(mBitmapDescriptor).anchor(0.5f, 0.5f).draggable(false));
    mp.longitude = latLng.longitude;
    mp.latitude = latLng.latitude;
    mMarker.setObject(mp);
    this.mMarkerList.add(mMarker);
    mp.distance = distance;
    this.mMapPointList.add(mp);
    drawPointLine(deviceLocation);
    this.lineMarkerSelectListener.onMarkerSizeChange(this.mMarkerList.size());
    if (angle != -1.0f) {
        mp.angle = angle;
        setRotateAngle(mMarker, angle);
    }
    this.isClick = false;
    onMarkerClick(mMarker);
}
 
Example #20
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 #21
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 #22
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 #23
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 #24
Source File: NaviRouteActivity.java    From Maps with GNU General Public License v2.0 4 votes vote down vote up
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_route);

	mEndNavi = getIntent().getParcelableArrayListExtra(NAVI_ENDS);
	mStartNavi = getIntent().getParcelableArrayListExtra(NAVI_START);

	Log.d("NaviRouteActivity ", "onCreate- " + mEndNavi.get(0).getLatitude());

	initView(savedInstanceState);


	mAmapNavi = AMapNavi.getInstance(this);
	mAmapNavi.setAMapNaviListener(naviRouteListener);
	boolean startGps = mAmapNavi.startGPS();
	Log.d("NaviRouteActivity ", "onCreate- startGps- " + startGps);

	boolean iscalDrive = mAmapNavi.calculateDriveRoute(mStartNavi, mEndNavi, null, AMapNavi.DrivingDefault);

	Log.d("NaviRouteActivity ", "onCreate- calculateDriveRoute- " + iscalDrive);


	if (SettingUtils.readCurrentCameraState() == SettingUtils.SWITCH_ON){
		MarkerInteractor markerInteractor = new MarkerInteractorImpl();
		markerInteractor.readCameras(new MarkerInteractor.OnReadCamerasListener() {
			BitmapDescriptor icon = BitmapDescriptorFactory.fromResource(R.drawable.icon_camera_location);
			@Override
			public void onReadCameras(ArrayList<BJCamera> cameraBeans) {
				ArrayList<MarkerOptions> markerOptionses = new ArrayList<>();
				for (BJCamera cameraBean : cameraBeans) {
					LatLng latLng = new LatLng(cameraBean.getLatitude(), cameraBean.getLongtitude());
					MarkerOptions mo = new MarkerOptions().position(latLng).draggable(true).icon(icon);
					markerOptionses.add(mo);
				}

				mAmap.addMarkers(markerOptionses,false);
			}
		});
	}

}
 
Example #25
Source File: BusLineOverlay.java    From BmapLite with Apache License 2.0 4 votes vote down vote up
protected BitmapDescriptor getBusBitmapDescriptor() {
    busBit = BitmapDescriptorFactory.fromResource(R.drawable.amap_bus);
    return busBit;
}
 
Example #26
Source File: RouteOverlay.java    From BmapLite with GNU General Public License v3.0 4 votes vote down vote up
protected BitmapDescriptor getDriveBitmapDescriptor() {
	return BitmapDescriptorFactory.fromResource(R.drawable.amap_car);
}
 
Example #27
Source File: BusLineOverlay.java    From BmapLite with GNU General Public License v3.0 4 votes vote down vote up
protected BitmapDescriptor getBusBitmapDescriptor() {
    busBit = BitmapDescriptorFactory.fromResource(R.drawable.amap_bus);
    return busBit;
}
 
Example #28
Source File: BusLineOverlay.java    From BmapLite with GNU General Public License v3.0 4 votes vote down vote up
protected BitmapDescriptor getEndBitmapDescriptor() {
    endBit = BitmapDescriptorFactory.fromResource(R.drawable.amap_end);
    return endBit;
}
 
Example #29
Source File: BusLineOverlay.java    From BmapLite with GNU General Public License v3.0 4 votes vote down vote up
protected BitmapDescriptor getStartBitmapDescriptor() {
    startBit = BitmapDescriptorFactory.fromResource(R.drawable.amap_start);
    return startBit;
}
 
Example #30
Source File: PluginAssets.java    From flutter_amap_plugin with MIT License 4 votes vote down vote up
public static BitmapDescriptor assetpath(String asset) throws IOException {
    AssetFileDescriptor assetFileDescriptor = PluginAssets.assetManager.openFd(registrar.lookupKeyForAsset(asset));
    return BitmapDescriptorFactory.fromBitmap(BitmapFactory.decodeStream(assetFileDescriptor.createInputStream()));
}