예제 #1
0
 /** removes any highlighting that may have been set beforehand. */
 private void removeHighlighting() {
   highlightHelper.clear();
   DataSet ds = getCurrentDataSet();
   if (ds != null) {
     ds.clearHighlightedWaySegments();
   }
 }
예제 #2
0
  private void repaintIfRequired(
      Set<OsmPrimitive> newHighlights, WaySegment newHighlightedWaySegment) {
    boolean needsRepaint = false;
    DataSet ds = getCurrentDataSet();

    if (newHighlightedWaySegment == null && oldHighlightedWaySegment != null) {
      if (ds != null) {
        ds.clearHighlightedWaySegments();
        needsRepaint = true;
      }
      oldHighlightedWaySegment = null;
    } else if (newHighlightedWaySegment != null
        && !newHighlightedWaySegment.equals(oldHighlightedWaySegment)) {
      if (ds != null) {
        ds.setHighlightedWaySegments(Collections.singleton(newHighlightedWaySegment));
        needsRepaint = true;
      }
      oldHighlightedWaySegment = newHighlightedWaySegment;
    }
    needsRepaint |= highlightHelper.highlightOnly(newHighlights);
    if (needsRepaint) {
      Main.map.mapView.repaint();
    }
  }