source: josm/trunk/src/org/openstreetmap/josm/actions/search/InView.java@ 13312

Last change on this file since 13312 was 12662, checked in by Don-vip, 7 years ago

see #15182 - remove dependence on GUI from data.osm.search.SearchCompiler

  • Property svn:eol-style set to native
File size: 930 bytes
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.actions.search;
3
4import java.util.Collection;
5import java.util.Collections;
6
7import org.openstreetmap.josm.data.Bounds;
8import org.openstreetmap.josm.data.osm.OsmPrimitive;
9import org.openstreetmap.josm.data.osm.search.SearchCompiler.InArea;
10import org.openstreetmap.josm.gui.MainApplication;
11
12/**
13 * Matches objects within current map view.
14 * @since 12662 (extracted from {@code SearchCompiler})
15 */
16class InView extends InArea {
17
18 InView(boolean all) {
19 super(all);
20 }
21
22 @Override
23 protected Collection<Bounds> getBounds(OsmPrimitive primitive) {
24 if (!MainApplication.isDisplayingMapView()) {
25 return null;
26 }
27 return Collections.singleton(MainApplication.getMap().mapView.getRealBounds());
28 }
29
30 @Override
31 public String toString() {
32 return all ? "allinview" : "inview";
33 }
34}
Note: See TracBrowser for help on using the repository browser.