Ejemplo n.º 1
0
  /**
   * method used to draw a polygon on map
   *
   * @param advancedStyle
   */
  public void drawPolygons(AdvancedStyle advancedStyle) {
    Paint stroke = StyleManager.getStrokePaint4Style(advancedStyle);
    Paint fill = StyleManager.getFillPaint4Style(advancedStyle);

    if (stroke == null && fill == null) {
      // Can't draw
      return;
    }

    ShapeWriter wr = new ShapeWriter(pointTransformer);
    wr.setRemoveDuplicatePoints(true);
    wr.setDecimation(style4Table.decimationFactor);
    while (geometryIterator.hasNext()) {

      Geometry geom = geometryIterator.next();
      if (geom != null) {
        DrawableShape shape = wr.toShape(geom);
        if (fill != null) {
          shape.fill(canvas, fill);
        }
        if (stroke != null) {
          shape.draw(canvas, stroke);
        }
      }
    }
  }
Ejemplo n.º 2
0
  /**
   * Method used to draw a line on map.
   *
   * @param advancedStyle
   * @param currentZoomLevel the current zoom level of the map view
   */
  public void drawLines(AdvancedStyle advancedStyle, byte currentZoomLevel) {
    Paint stroke = StyleManager.getStrokePaint4Style(advancedStyle);
    Paint textStroke = StyleManager.getTextStrokePaint4Style(advancedStyle);
    ShapeWriter wr = new ShapeWriter(pointTransformer);
    wr.setRemoveDuplicatePoints(true);
    wr.setDecimation(style4Table.decimationFactor);
    if (stroke == null && textStroke == null) {
      // Can't draw
      return;
    }

    while (geometryIterator.hasNext()) {
      Geometry geom = geometryIterator.next();
      DrawableShape shape = wr.toShape(geom);
      if (stroke != null) {
        shape.draw(canvas, stroke);
      }

      // draw labels if zoom level fits and data is available
      if (currentZoomLevel >= advancedStyle.label_minZoom
          && textStroke != null
          && shape instanceof PathShape
          && geom.getUserData() != null) {

        Object userData = geom.getUserData();

        canvas.drawTextOnPath(
            userData.toString(),
            ((PathShape) shape).getPath(),
            LABEL_H_OFFSET,
            LABEL_V_OFFSET,
            textStroke);
      }
    }
  }
Ejemplo n.º 3
0
  /**
   * Method used to draw a point on map.
   *
   * @param fill
   * @param stroke
   */
  public void drawPoints(Paint fill, Paint stroke) {
    ShapeWriter wr = new ShapeWriter(pointTransformer, style4Table.shape, style4Table.size);
    wr.setRemoveDuplicatePoints(true);
    wr.setDecimation(style4Table.decimationFactor);
    while (geometryIterator.hasNext()) {
      Geometry geom = geometryIterator.next();
      geom.getCoordinate();
      DrawableShape shape = wr.toShape(geom);

      if (fill != null) {
        shape.fill(canvas, fill);
      }
      if (stroke != null) {
        shape.draw(canvas, stroke);
      }
    }
  }