kopia lustrzana https://github.com/JOSM/MapWithAI
rodzic
fdd4ce0b02
commit
9ed527b36a
|
@ -22,7 +22,7 @@ import org.openstreetmap.josm.tools.Destroyable;
|
||||||
*/
|
*/
|
||||||
public final class DownloadListener implements DataSourceListener, Destroyable {
|
public final class DownloadListener implements DataSourceListener, Destroyable {
|
||||||
|
|
||||||
private WeakReference<DataSet> ds;
|
private final WeakReference<DataSet> ds;
|
||||||
private static final Collection<DownloadListener> LISTENERS = new HashSet<>();
|
private static final Collection<DownloadListener> LISTENERS = new HashSet<>();
|
||||||
|
|
||||||
public DownloadListener(DataSet dataSet) {
|
public DownloadListener(DataSet dataSet) {
|
||||||
|
|
|
@ -226,7 +226,7 @@ public class MapWithAILayer extends OsmDataLayer implements ActiveLayerChangeLis
|
||||||
return continuousDownload;
|
return continuousDownload;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ContinuousDownloadAction extends AbstractAction implements LayerAction {
|
private static class ContinuousDownloadAction extends AbstractAction implements LayerAction {
|
||||||
private static final long serialVersionUID = -3528632887550700527L;
|
private static final long serialVersionUID = -3528632887550700527L;
|
||||||
private final MapWithAILayer layer;
|
private final MapWithAILayer layer;
|
||||||
|
|
||||||
|
|
|
@ -74,8 +74,8 @@ public class MapWithAIMoveAction extends JosmAction {
|
||||||
}
|
}
|
||||||
final Collection<OsmPrimitive> selected = limitCollection(ds, maxAddition);
|
final Collection<OsmPrimitive> selected = limitCollection(ds, maxAddition);
|
||||||
final OsmDataLayer editLayer = getOsmDataLayer();
|
final OsmDataLayer editLayer = getOsmDataLayer();
|
||||||
if (editLayer != null && !selected.isEmpty()
|
if ((editLayer != null && !selected.isEmpty()
|
||||||
&& (MapWithAIDataUtils.getAddedObjects() < maxAddition * MAX_ADD_MULTIPLIER)
|
&& (MapWithAIDataUtils.getAddedObjects() < maxAddition * MAX_ADD_MULTIPLIER))
|
||||||
|| (maxAddition == 0 && ExpertToggleAction.isExpert())) {
|
|| (maxAddition == 0 && ExpertToggleAction.isExpert())) {
|
||||||
final MapWithAIAddCommand command = new MapWithAIAddCommand(mapWithAI, editLayer, selected);
|
final MapWithAIAddCommand command = new MapWithAIAddCommand(mapWithAI, editLayer, selected);
|
||||||
UndoRedoHandler.getInstance().add(command);
|
UndoRedoHandler.getInstance().add(command);
|
||||||
|
@ -88,7 +88,7 @@ public class MapWithAIMoveAction extends JosmAction {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createTooManyAdditionsNotification(int maxAddition) {
|
private static void createTooManyAdditionsNotification(int maxAddition) {
|
||||||
Notification tooMany = new Notification();
|
Notification tooMany = new Notification();
|
||||||
tooMany.setIcon(JOptionPane.WARNING_MESSAGE);
|
tooMany.setIcon(JOptionPane.WARNING_MESSAGE);
|
||||||
tooMany.setDuration(Notification.TIME_DEFAULT);
|
tooMany.setDuration(Notification.TIME_DEFAULT);
|
||||||
|
|
|
@ -102,8 +102,8 @@ public class RoutingIslandsTest extends Test {
|
||||||
errors.add(TestError.builder(this, SEVERITY_MAP.get(LONELY_WAY), LONELY_WAY).primitives(way)
|
errors.add(TestError.builder(this, SEVERITY_MAP.get(LONELY_WAY), LONELY_WAY).primitives(way)
|
||||||
.message(tr("MapWithAI (experimental)"), marktr("Routable way not connected to other ways"))
|
.message(tr("MapWithAI (experimental)"), marktr("Routable way not connected to other ways"))
|
||||||
.build());
|
.build());
|
||||||
} else if (((ValidatorPrefHelper.PREF_OTHER.get() || ValidatorPrefHelper.PREF_OTHER_UPLOAD.get()
|
} else if ((ValidatorPrefHelper.PREF_OTHER.get() || ValidatorPrefHelper.PREF_OTHER_UPLOAD.get()
|
||||||
|| !Severity.OTHER.equals(SEVERITY_MAP.get(ROUTING_ISLAND)))) && !isBeforeUpload) {
|
|| !Severity.OTHER.equals(SEVERITY_MAP.get(ROUTING_ISLAND))) && !isBeforeUpload) {
|
||||||
if (way.hasKey(HIGHWAY)) {
|
if (way.hasKey(HIGHWAY)) {
|
||||||
potentialHighways.add(way);
|
potentialHighways.add(way);
|
||||||
} else if (way.hasKey(WATERWAY)) {
|
} else if (way.hasKey(WATERWAY)) {
|
||||||
|
@ -395,7 +395,7 @@ public class RoutingIslandsTest extends Test {
|
||||||
*/
|
*/
|
||||||
public static Node firstNode(Way way, String transportType) {
|
public static Node firstNode(Way way, String transportType) {
|
||||||
Integer oneway = isOneway(way, transportType);
|
Integer oneway = isOneway(way, transportType);
|
||||||
Node node = (Integer.valueOf(-1).equals(oneway)) ? way.lastNode() : way.firstNode();
|
Node node = Integer.valueOf(-1).equals(oneway) ? way.lastNode() : way.firstNode();
|
||||||
|
|
||||||
Map<String, String> accessValues = getDefaultAccessTags(way);
|
Map<String, String> accessValues = getDefaultAccessTags(way);
|
||||||
boolean accessible = Access.getPositiveAccessValues()
|
boolean accessible = Access.getPositiveAccessValues()
|
||||||
|
@ -413,7 +413,7 @@ public class RoutingIslandsTest extends Test {
|
||||||
*/
|
*/
|
||||||
public static Node lastNode(Way way, String transportType) {
|
public static Node lastNode(Way way, String transportType) {
|
||||||
Integer oneway = isOneway(way, transportType);
|
Integer oneway = isOneway(way, transportType);
|
||||||
Node node = (Integer.valueOf(-1).equals(oneway)) ? way.firstNode() : way.lastNode();
|
Node node = Integer.valueOf(-1).equals(oneway) ? way.firstNode() : way.lastNode();
|
||||||
Map<String, String> accessValues = getDefaultAccessTags(way);
|
Map<String, String> accessValues = getDefaultAccessTags(way);
|
||||||
boolean accessible = Access.getPositiveAccessValues()
|
boolean accessible = Access.getPositiveAccessValues()
|
||||||
.contains(accessValues.getOrDefault(transportType, Access.AccessTags.NO.getKey()));
|
.contains(accessValues.getOrDefault(transportType, Access.AccessTags.NO.getKey()));
|
||||||
|
|
|
@ -340,8 +340,8 @@ public class Access {
|
||||||
*/
|
*/
|
||||||
TRAIN("train", RAIL_TRANSPORT_TYPE);
|
TRAIN("train", RAIL_TRANSPORT_TYPE);
|
||||||
|
|
||||||
private String key;
|
private final String key;
|
||||||
private AccessTags type;
|
private final AccessTags type;
|
||||||
|
|
||||||
AccessTags(String key) {
|
AccessTags(String key) {
|
||||||
this.key = key;
|
this.key = key;
|
||||||
|
|
Ładowanie…
Reference in New Issue