Reputation: 1710
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
Upvotes: 1
Views: 2316
Reputation: 1762
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));
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.
Upvotes: 1
Reputation: 1762
The MapMarker object is what you are looking for? It is anchored to the position you give it and it will always be drawn in screen 2d space regardless of the tilt and rotate you apply to the map.
Hope this helps.
Upvotes: 0