Exemplo n.º 1
0
 private void updateStatusMessage() {
   String msg = "";
   if (dragX != MapConstants.NULL && dragY != MapConstants.NULL) {
     msg =
         "Moving the map to ("
             + StringUtil.toNumString(startX)
             + " : "
             + StringUtil.toNumString(startY)
             + " - "
             + StringUtil.toNumString(endX)
             + " : "
             + StringUtil.toNumString(endY)
             + ") of ("
             + StringUtil.toNumString(MAP_MAX_WIDTH)
             + " : "
             + StringUtil.toNumString(MAP_MAX_HEIGHT)
             + ")";
   } else if (dragPoint != null) {
     msg =
         "Moving the point to ("
             + StringUtil.toNumString(dragPoint.getAxisX())
             + " : "
             + StringUtil.toNumString(dragPoint.getAxisY())
             + ")";
   } else if (pointSelect != null) {
     if (pointSelect.getType() == PointType.LINK) {
       msg =
           "Linked Point ("
               + StringUtil.toNumString(pointSelect.getAxisX())
               + " : "
               + StringUtil.toNumString(pointSelect.getAxisY())
               + ")";
     } else if (pointSelect.getType() == PointType.NAME) {
       msg =
           "Named Point ("
               + StringUtil.toNumString(pointSelect.getAxisX())
               + " : "
               + StringUtil.toNumString(pointSelect.getAxisY())
               + ")";
     }
   } else {
     msg =
         "Now showing ("
             + StringUtil.toNumString(startX)
             + " : "
             + StringUtil.toNumString(startY)
             + " - "
             + StringUtil.toNumString(endX)
             + " : "
             + StringUtil.toNumString(endY)
             + ") of ("
             + StringUtil.toNumString(MAP_MAX_WIDTH)
             + " : "
             + StringUtil.toNumString(MAP_MAX_HEIGHT)
             + ")";
   }
   MapStatusBar.setMessage(msg);
 }
Exemplo n.º 2
0
  private void drawPoint(Graphics2D g2d) {
    int mapPointX1 = (startX / MAP_POINT_WIDTH) + 1;
    int mapPointX2 = (endX / MAP_POINT_WIDTH) + 1;
    int mapPointY1 = (startY / MAP_POINT_HEIGHT) + 1;
    int mapPointY2 = (endY / MAP_POINT_HEIGHT) + 1;

    Stroke oldStroke = g2d.getStroke();

    for (int y = mapPointY1; y <= mapPointY2; y++) {
      for (int x = mapPointX1; x <= mapPointX2; x++) {
        String mapPointKey = (x < 10 ? "0" + x : "" + x) + (y < 10 ? "0" + y : "" + y);

        List<PointInfo> points = null;
        if (mapPoint.containsKey(mapPointKey)) {
          points = mapPoint.get(mapPointKey);
        } else {
          points = MapDbBean.loadMapPoint(x, y);
          mapPoint.put(mapPointKey, points);
        }

        for (int i = 0; i < points.size(); i++) {
          PointInfo pointInfo = points.get(i);
          if (pointInfo.getMode() == Mode.DELETE) {
            continue;
          }

          int p_x = pointInfo.getAxisX() - startX;
          int p_y = pointInfo.getAxisY() - startY;

          if (pointInfo.getType() == PointType.LINK) {
            if (!((mainFrame.getMapMode() == MapMode.VIEW
                    || mainFrame.getMapMode() == MapMode.TEST_ROUTE)
                && !mainFrame.containsViewType(ViewType.VIEW_POINT_LINK))) {
              drawPointOut(g2d, p_x, p_y, pointInfo);
            }
          } else if (pointInfo.getType() == PointType.NAME) {
            if (!((mainFrame.getMapMode() == MapMode.VIEW
                    || mainFrame.getMapMode() == MapMode.TEST_ROUTE)
                && !mainFrame.containsViewType(ViewType.VIEW_POINT_NAME))) {
              drawPointOut(g2d, p_x, p_y, pointInfo);
              drawPointIn(g2d, p_x, p_y);
            }
          }
        }
      }
    }

    g2d.setStroke(oldStroke);
  }