implement single land search
This commit is contained in:
@@ -3,6 +3,7 @@ package ru.trader.controllers;
|
|||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
import ru.trader.analysis.CrawlerSpecificator;
|
import ru.trader.analysis.CrawlerSpecificator;
|
||||||
|
import ru.trader.core.Profile;
|
||||||
import ru.trader.model.*;
|
import ru.trader.model.*;
|
||||||
import ru.trader.view.support.autocomplete.AutoCompletion;
|
import ru.trader.view.support.autocomplete.AutoCompletion;
|
||||||
import ru.trader.view.support.autocomplete.CachedSuggestionProvider;
|
import ru.trader.view.support.autocomplete.CachedSuggestionProvider;
|
||||||
@@ -109,7 +110,7 @@ public class RouteSearchController {
|
|||||||
for (Iterator<RouteModel> iterator = routes.iterator(); iterator.hasNext(); ) {
|
for (Iterator<RouteModel> iterator = routes.iterator(); iterator.hasNext(); ) {
|
||||||
RouteModel route = iterator.next();
|
RouteModel route = iterator.next();
|
||||||
Collection<MissionModel> notAdded = route.addAll(0, missionsList.getItems());
|
Collection<MissionModel> notAdded = route.addAll(0, missionsList.getItems());
|
||||||
if (!notAdded.isEmpty()){
|
if (!notAdded.isEmpty()) {
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -133,6 +134,28 @@ public class RouteSearchController {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private void searchSingled(){
|
||||||
|
SystemModel f = fromSystem.getValue();
|
||||||
|
SystemModel t = toSystem.getValue();
|
||||||
|
StationModel fS = f != null ? f.get(fromStation.getValue()) : ModelFabric.NONE_STATION;
|
||||||
|
StationModel tS = t != null ? t.get(toStation.getValue()) : ModelFabric.NONE_STATION;
|
||||||
|
|
||||||
|
CrawlerSpecificator specificator = new CrawlerSpecificator();
|
||||||
|
specificator.setByTime(rbByTime.isSelected());
|
||||||
|
specificator.setFullScan(cbFullScan.isSelected());
|
||||||
|
|
||||||
|
Profile profile = Profile.clone(ModelFabric.get(this.profile));
|
||||||
|
profile.setLands(fS.equals(tS) ? 2 : 1);
|
||||||
|
market.getRoutes(f, fS, t, tS, profile, specificator, routes -> {
|
||||||
|
Optional<RouteModel> path = Screeners.showRouters(routes);
|
||||||
|
if (path.isPresent()) {
|
||||||
|
this.profile.setRoute(path.get());
|
||||||
|
Screeners.showTrackTab();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void addMission(){
|
private void addMission(){
|
||||||
|
|||||||
@@ -240,10 +240,15 @@ public class MarketModel {
|
|||||||
getRoutes(stationFrom.getSystem(), stationFrom, stationTo.getSystem(), stationTo, balance, specificator, result);
|
getRoutes(stationFrom.getSystem(), stationFrom, stationTo.getSystem(), stationTo, balance, specificator, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void getRoutes(SystemModel from, StationModel stationFrom, SystemModel to, StationModel stationTo, double balance, CrawlerSpecificator specificator, Consumer<ObservableList<RouteModel>> result) {
|
public void getRoutes(SystemModel from, StationModel stationFrom, SystemModel to, StationModel stationTo, double balance, CrawlerSpecificator specificator, Consumer<ObservableList<RouteModel>> result) {
|
||||||
ProgressController progress = new ProgressController(Screeners.getMainScreen(), Localization.getString("analyzer.routes.title"));
|
|
||||||
Profile profile = Profile.clone(ModelFabric.get(MainController.getProfile()));
|
Profile profile = Profile.clone(ModelFabric.get(MainController.getProfile()));
|
||||||
profile.setBalance(balance);
|
profile.setBalance(balance);
|
||||||
|
getRoutes(from, stationFrom, to, stationTo, profile, specificator, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getRoutes(SystemModel from, StationModel stationFrom, SystemModel to, StationModel stationTo, Profile profile, CrawlerSpecificator specificator, Consumer<ObservableList<RouteModel>> result) {
|
||||||
|
ProgressController progress = new ProgressController(Screeners.getMainScreen(), Localization.getString("analyzer.routes.title"));
|
||||||
RoutesSearchTask task = new RoutesSearchTask(this,
|
RoutesSearchTask task = new RoutesSearchTask(this,
|
||||||
ModelFabric.get(from), ModelFabric.get(stationFrom), ModelFabric.get(to), ModelFabric.get(stationTo),
|
ModelFabric.get(from), ModelFabric.get(stationFrom), ModelFabric.get(to), ModelFabric.get(stationTo),
|
||||||
profile, specificator
|
profile, specificator
|
||||||
|
|||||||
@@ -157,6 +157,7 @@ router.pane.route.from=From:
|
|||||||
router.pane.route.to=To:
|
router.pane.route.to=To:
|
||||||
router.pane.route.fast=Fasted
|
router.pane.route.fast=Fasted
|
||||||
router.button.search=Find
|
router.button.search=Find
|
||||||
|
router.button.singledSearch=A -> B
|
||||||
router.pane.route.jumps=Jumps:
|
router.pane.route.jumps=Jumps:
|
||||||
router.button.recompute=Recompute
|
router.button.recompute=Recompute
|
||||||
router.button.rebuild=Rebuild
|
router.button.rebuild=Rebuild
|
||||||
|
|||||||
@@ -157,6 +157,7 @@ router.pane.route.from=\u041E\u0442:
|
|||||||
router.pane.route.to=\u0414\u043E:
|
router.pane.route.to=\u0414\u043E:
|
||||||
router.pane.route.fast=\u0411\u044B\u0441\u0442\u0440\u044B\u0439
|
router.pane.route.fast=\u0411\u044B\u0441\u0442\u0440\u044B\u0439
|
||||||
router.button.search=\u041D\u0430\u0439\u0442\u0438
|
router.button.search=\u041D\u0430\u0439\u0442\u0438
|
||||||
|
router.button.singledSearch=\u0410 -> \u0411
|
||||||
router.pane.route.jumps=\u041F\u0440\u044B\u0436\u043A\u043E\u0432:
|
router.pane.route.jumps=\u041F\u0440\u044B\u0436\u043A\u043E\u0432:
|
||||||
router.button.recompute=\u041F\u0435\u0440\u0435\u0441\u0447\u0438\u0442\u0430\u0442\u044C
|
router.button.recompute=\u041F\u0435\u0440\u0435\u0441\u0447\u0438\u0442\u0430\u0442\u044C
|
||||||
router.button.rebuild=\u041F\u0435\u0440\u0435\u0441\u0442\u0440\u043E\u0438\u0442\u044C
|
router.button.rebuild=\u041F\u0435\u0440\u0435\u0441\u0442\u0440\u043E\u0438\u0442\u044C
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
</HBox>
|
</HBox>
|
||||||
<HBox spacing="10" alignment="CENTER">
|
<HBox spacing="10" alignment="CENTER">
|
||||||
<Button prefWidth="80" text="%router.button.search" onAction="#search" />
|
<Button prefWidth="80" text="%router.button.search" onAction="#search" />
|
||||||
|
<Button prefWidth="80" text="%router.button.singledSearch" onAction="#searchSingled" />
|
||||||
<Button prefWidth="80" text="%router.button.top" onAction="#searchTop" />
|
<Button prefWidth="80" text="%router.button.top" onAction="#searchTop" />
|
||||||
</HBox>
|
</HBox>
|
||||||
</VBox>
|
</VBox>
|
||||||
|
|||||||
Reference in New Issue
Block a user