如何在HERE Maps Android SDK中添加静态地图标记? [英] How to add a static map marker in the HERE maps Android sdk?

查看:177
本文介绍了如何在HERE Maps Android SDK中添加静态地图标记?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想制作一个在地图旋转时不会移动的标记,就像折线一样.我的目标是给标记一个单一的方向,即使在发生错误时也不会改变.

I would like to make markers that doesn't move when the map rotates, exactly like the polylines. My goal is to give the marker a single orientation that never changes even when getsures occure.

我尝试了每种标记类型,但无法获得想要的效果.

I have tried with every marker type but I can't get the wanted effect.

由于我在这里待了很长时间,因此可以提供任何帮助

Any kind of help would be appreciated since I am stuck here for really long hours

推荐答案

您可以绘制一个简单的矩形,其正反两面的纹理如下:

You can draw a simple rectangle with both front and back facing sides textured as follows:

    // Two triangles
    FloatBuffer buff = FloatBuffer.allocate(12);
    buff.put(0- delta);
    buff.put(0- delta);
    buff.put(1.f);

    buff.put(0 + delta);
    buff.put(0 - delta);
    buff.put(1.f);

    buff.put(0 - delta);
    buff.put(0 + delta);
    buff.put(1.f);

    buff.put(0 + delta);
    buff.put(0 + delta);
    buff.put(1.f);

    // Two triangles to generate the rectangle. Both front and back face
    IntBuffer vertIndicieBuffer = IntBuffer.allocate(12);
    vertIndicieBuffer.put(0);
    vertIndicieBuffer.put(2);
    vertIndicieBuffer.put(1);
    vertIndicieBuffer.put(2);
    vertIndicieBuffer.put(3);
    vertIndicieBuffer.put(1);
    vertIndicieBuffer.put(0);
    vertIndicieBuffer.put(1);
    vertIndicieBuffer.put(2);
    vertIndicieBuffer.put(1);
    vertIndicieBuffer.put(3);
    vertIndicieBuffer.put(2);

    // Texture coordinates
    FloatBuffer textCoordBuffer = FloatBuffer.allocate(8);
    textCoordBuffer.put(0.f);
    textCoordBuffer.put(0.f);
    textCoordBuffer.put(1.f);
    textCoordBuffer.put(0.f);
    textCoordBuffer.put(0.f);
    textCoordBuffer.put(1.f);
    textCoordBuffer.put(1.f);
    textCoordBuffer.put(1.f);

    // The LocalMesh itself.
    LocalMesh mesh = new LocalMesh();
    mesh.setVertices(buff);
    mesh.setVertexIndices(vertIndicieBuffer);
    mesh.setTextureCoordinates(textCoordBuffer);

    MapLocalModel model = new MapLocalModel();
    model.setMesh(mesh);
    model.setDynamicScalingEnabled(true);
    model.setAnchor(new GeoCoordinate(LATITUDE, LONGITUDE, 0.0));

在其上附加图像以获取纹理,然后使用MapRenderLisener#onPredraw()更改跟随相机的局部模型对象的俯仰和偏航.

Attach an image to it for texture, and use MapRenderLisener#onPredraw() to change the pitch and yaw of the local model object to follow the camera.

这篇关于如何在HERE Maps Android SDK中添加静态地图标记?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆