(Graphics g, Marker m)
| 459 | } |
| 460 | |
| 461 | private void drawMarker(Graphics g, Marker m) { |
| 462 | if (!m.isVisible()) { |
| 463 | return; |
| 464 | } |
| 465 | Point p = engine.latLngToScreen(m.getPosition()); |
| 466 | EncodedImage icon = m.getIcon(); |
| 467 | if (icon != null) { |
| 468 | int w = icon.getWidth(); |
| 469 | int h = icon.getHeight(); |
| 470 | int dx = p.getX() - (int) (w * m.getAnchorU()); |
| 471 | int dy = p.getY() - (int) (h * m.getAnchorV()); |
| 472 | g.drawImage(icon, dx, dy); |
| 473 | return; |
| 474 | } |
| 475 | // Default marker: the standard Material Design map pin glyph, anchored |
| 476 | // at the marker's tip (anchor defaults to 0.5, 1.0 -- bottom center). |
| 477 | Font pin = markerFont(); |
| 478 | String glyph = String.valueOf(FontImage.MATERIAL_PLACE); |
| 479 | int gw = pin.stringWidth(glyph); |
| 480 | int gh = pin.getHeight(); |
| 481 | int gx = p.getX() - (int) (gw * m.getAnchorU()); |
| 482 | int gy = p.getY() - (int) (gh * m.getAnchorV()); |
| 483 | int prevAlpha = g.getAlpha(); |
| 484 | g.setFont(pin); |
| 485 | g.setAlpha(255); |
| 486 | g.setColor(0x8e1c16); |
| 487 | g.drawString(glyph, gx - 1, gy); |
| 488 | g.drawString(glyph, gx + 1, gy); |
| 489 | g.drawString(glyph, gx, gy - 1); |
| 490 | g.drawString(glyph, gx, gy + 1); |
| 491 | g.setColor(0xe53935); |
| 492 | g.drawString(glyph, gx, gy); |
| 493 | g.setAlpha(prevAlpha); |
| 494 | } |
| 495 | |
| 496 | private Font markerFont() { |
| 497 | if (markerFont == null) { |
no test coverage detected