Archived
0

implement single land search

This commit is contained in:
iMoHax
2016-04-14 13:37:17 +03:00
parent 38c5e494ad
commit afa2d06b56
5 changed files with 33 additions and 2 deletions

View File

@@ -3,6 +3,7 @@ package ru.trader.controllers;
import javafx.fxml.FXML;
import javafx.scene.control.*;
import ru.trader.analysis.CrawlerSpecificator;
import ru.trader.core.Profile;
import ru.trader.model.*;
import ru.trader.view.support.autocomplete.AutoCompletion;
import ru.trader.view.support.autocomplete.CachedSuggestionProvider;
@@ -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
private void addMission(){

View File

@@ -240,10 +240,15 @@ public class MarketModel {
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) {
ProgressController progress = new ProgressController(Screeners.getMainScreen(), Localization.getString("analyzer.routes.title"));
Profile profile = Profile.clone(ModelFabric.get(MainController.getProfile()));
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,
ModelFabric.get(from), ModelFabric.get(stationFrom), ModelFabric.get(to), ModelFabric.get(stationTo),
profile, specificator

View File

@@ -157,6 +157,7 @@ router.pane.route.from=From:
router.pane.route.to=To:
router.pane.route.fast=Fasted
router.button.search=Find
router.button.singledSearch=A -> B
router.pane.route.jumps=Jumps:
router.button.recompute=Recompute
router.button.rebuild=Rebuild

View File

@@ -157,6 +157,7 @@ router.pane.route.from=\u041E\u0442:
router.pane.route.to=\u0414\u043E:
router.pane.route.fast=\u0411\u044B\u0441\u0442\u0440\u044B\u0439
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.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

View File

@@ -24,6 +24,7 @@
</HBox>
<HBox spacing="10" alignment="CENTER">
<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" />
</HBox>
</VBox>