/**
   * Initialize scale bar.
   *
   * @param unitType how are units shown (english/metric/crs)
   * @param unitLength length of a unit in meter
   * @param position coordinate where scalebar should be drawn on the graphics context
   */
  public void initialize(UnitType unitType, double unitLength, Coordinate position) {
    if (null == unitType) {
      throw new IllegalArgumentException("please provide a unitType");
    }

    this.unitType = unitType;
    this.unitLength = unitLength;

    backGround = new Rectangle((null == getId() ? "" : getId() + "-bg"));
    backGround.setBounds(new Bbox(0, 0, 5, MARKER_HEIGHT + 2 * VERTICAL_PADDING));
    backGround.setStyle(STYLE_BACKGROUND);
    leftMarker = new Rectangle((null == getId() ? "" : getId() + "-lm"));
    leftMarker.setStyle(STYLE_MARKER);
    leftMarker.setBounds(new Bbox(0, 0, 1, MARKER_HEIGHT));

    rightMarker = new Rectangle((null == getId() ? "" : getId() + "-rm"));
    rightMarker.setStyle(STYLE_MARKER);
    rightMarker.setBounds(new Bbox(0, 0, 1, MARKER_HEIGHT));
    bottomLine = new Rectangle((null == getId() ? "" : getId() + "-bm"));
    bottomLine.setStyle(STYLE_MARKER);
    bottomLine.setBounds(new Bbox(0, 0, 0, 1));
    distance = new Text((null == getId() ? "" : getId() + "-text"));
    distance.setStyle(STYLE_FONT);

    dummy = new Rectangle(getId() + "-dummy");
    dummy.setStyle(new ShapeStyle("#FFFFFF", 0, "#FFFFFF", 0, 0));
    dummy.setBounds(new Bbox(0, 0, 1, 1));
  }