Esempio n. 1
0
  // Return true if associated line should be truncated at basePoint
  public boolean calcNewLineEndPoint(
      MiRenderer renderer, double angle, int style, MiDistance size, MiPoint basePoint) {
    boolean truncateAssocLine = false;
    double sinAngle = Math.sin(angle);
    double cosAngle = Math.cos(angle);
    MiDistance length = size;

    switch (style) {
      case Mi_NONE:
        truncateAssocLine = false;
        break;

      case Mi_TRIANGLE_VIA_LINE_END_STYLE:
      case Mi_FILLED_TRIANGLE_VIA_LINE_END_STYLE:
        length = size;
        truncateAssocLine = false;
        break;

      case Mi_CIRCLE_VIA_LINE_END_STYLE:
      case Mi_FILLED_CIRCLE_VIA_LINE_END_STYLE:
      case Mi_SQUARE_VIA_LINE_END_STYLE:
      case Mi_FILLED_SQUARE_VIA_LINE_END_STYLE:
        length = size / 2;
        truncateAssocLine = false;
        break;

      case Mi_STROKED_ARROW_LINE_END_STYLE:
      case Mi_FILLED_ARROW_LINE_END_STYLE:
      case Mi_3FEATHER_LINE_END_STYLE:
        // LONG_length = 2 * size;
        length = size;
        truncateAssocLine = false;
        break;

      case Mi_FILLED_TRIANGLE_LINE_END_STYLE:
      case Mi_TRIANGLE_LINE_END_STYLE:
      case Mi_2FEATHER_LINE_END_STYLE:
        // LONG_length = 2 * size;
        length = size;
        truncateAssocLine = true;
        break;

      case Mi_DIAMOND_LINE_END_STYLE:
        length = 2 * size;
        truncateAssocLine = true;
        break;

      case Mi_FILLED_DIAMOND_LINE_END_STYLE:
        length = 2 * size;
        truncateAssocLine = true;
        break;

      case Mi_FILLED_CIRCLE_LINE_END_STYLE:
      case Mi_FILLED_SQUARE_LINE_END_STYLE:
        length = size;
        truncateAssocLine = false;
        break;

      case Mi_CIRCLE_LINE_END_STYLE:
      case Mi_SQUARE_LINE_END_STYLE:
        length = size;
        truncateAssocLine = true;
        break;
    }

    basePoint.x = basePoint.x - length * cosAngle;
    basePoint.y = basePoint.y - length * sinAngle;
    return (truncateAssocLine);
  }