Manually move mod block after the use block, to match what CLion does.

This commit is contained in:
Dustin Carlino 2020-10-04 16:09:20 -07:00
parent 41ecd62e69
commit 27d94945c6
30 changed files with 243 additions and 243 deletions

View File

@ -5,14 +5,6 @@
// - A/B Street-specific filesystem paths
// - true utility functions (collections, prettyprinting, CLI parsing
mod abst_paths;
mod cli;
mod collections;
mod io;
mod serde;
mod time;
mod utils;
#[macro_use]
extern crate log;
@ -33,4 +25,10 @@ pub use collections::*;
pub use time::*;
pub use utils::*;
mod cli;
mod collections;
mod io;
mod random;
mod time;
const PROGRESS_FREQUENCY_SECONDS: f64 = 0.2;

View File

@ -1,3 +1,8 @@
use abstutil::Timer;
use geom::{Distance, FindClosest, GPSBounds, LonLat, Pt2D, Ring};
use map_model::raw::RawMap;
use map_model::{osm, MapConfig, NamePerLanguage};
mod clip;
mod extract;
mod parking;
@ -7,11 +12,6 @@ mod split_ways;
mod srtm;
mod transit;
use abstutil::Timer;
use geom::{Distance, FindClosest, GPSBounds, LonLat, Pt2D, Ring};
use map_model::raw::RawMap;
use map_model::{osm, MapConfig, NamePerLanguage};
pub struct Options {
pub osm_input: String,
pub city_name: String,

View File

@ -1,11 +1,3 @@
mod city_picker;
mod colors;
mod heatmap;
mod isochrone;
mod minimap;
mod navigate;
mod warp;
pub use self::city_picker::CityPicker;
pub use self::colors::{ColorDiscrete, ColorLegend, ColorNetwork, ColorScale, DivergingScale};
pub use self::heatmap::{make_heatmap, HeatmapOptions};
@ -24,6 +16,14 @@ use widgetry::{
ScreenDims, ScreenPt, ScreenRectangle, Text, VerticalAlignment, Widget,
};
mod city_picker;
mod colors;
mod heatmap;
mod isochrone;
mod minimap;
mod navigate;
mod warp;
// TODO This is now just used in two modes...
pub struct CommonState {
// TODO Better to express these as mutex

View File

@ -1,9 +1,3 @@
mod floodfill;
mod objects;
pub mod path_counter;
mod polygons;
pub mod shared_row;
use crate::app::{App, ShowLayers, ShowObject};
use crate::common::{tool_panel, CommonState, ContextualActions};
use crate::game::{ChooseSomething, DrawBaselayer, PopupMsg, PromptInput, State, Transition};
@ -21,6 +15,12 @@ use widgetry::{
HorizontalAlignment, Key, Line, Outcome, Panel, Text, UpdateType, VerticalAlignment, Widget,
};
mod floodfill;
mod objects;
pub mod path_counter;
mod polygons;
pub mod shared_row;
pub struct DebugMode {
panel: Panel,
common: CommonState,

View File

@ -1,10 +1,3 @@
mod destinations;
mod kml;
pub mod mapping;
mod polygon;
mod scenario;
mod story;
use crate::app::App;
use crate::common::CityPicker;
use crate::game::{ChooseSomething, DrawBaselayer, State, Transition};
@ -16,6 +9,13 @@ use widgetry::{
VerticalAlignment, Widget,
};
mod destinations;
mod kml;
pub mod mapping;
mod polygon;
mod scenario;
mod story;
pub struct DevToolsMode {
panel: Panel,
}

View File

@ -1,13 +1,3 @@
mod bulk;
mod cluster_traffic_signals;
mod lanes;
mod routes;
mod select;
mod stop_signs;
mod traffic_signals;
mod validate;
mod zones;
pub use self::cluster_traffic_signals::ClusterTrafficSignalEditor;
pub use self::lanes::LaneEditor;
pub use self::routes::RouteEditor;
@ -32,6 +22,16 @@ use widgetry::{
Outcome, Panel, Text, TextExt, VerticalAlignment, Widget,
};
mod bulk;
mod cluster_traffic_signals;
mod lanes;
mod routes;
mod select;
mod stop_signs;
mod traffic_signals;
mod validate;
mod zones;
pub struct EditMode {
tool_panel: Panel,
top_center: Panel,

View File

@ -1,8 +1,3 @@
mod edits;
mod offsets;
mod picker;
mod preview;
use crate::app::{App, ShowEverything};
use crate::common::{CommonState, Warping};
use crate::edit::{apply_map_edits, ConfirmDiscard};
@ -22,6 +17,11 @@ use widgetry::{
MultiButton, Outcome, Panel, RewriteColor, Text, TextExt, VerticalAlignment, Widget,
};
mod edits;
mod offsets;
mod picker;
mod preview;
// Welcome to one of the most overwhelmingly complicated parts of the UI...
pub struct TrafficSignalEditor {

View File

@ -1,12 +1,3 @@
mod building;
mod bus;
mod debug;
mod intersection;
mod lane;
mod parking_lot;
mod person;
mod trip;
use crate::app::App;
use crate::common::Warping;
use crate::debug::path_counter::PathCounter;
@ -27,6 +18,15 @@ use widgetry::{
LinePlot, Outcome, Panel, PlotOptions, Series, TextExt, VerticalAlignment, Widget,
};
mod building;
mod bus;
mod debug;
mod intersection;
mod lane;
mod parking_lot;
mod person;
mod trip;
pub struct InfoPanel {
tab: Tab,
time: Time,

View File

@ -1,3 +1,10 @@
use crate::app::App;
use crate::common::HeatmapOptions;
use crate::game::{DrawBaselayer, State, Transition};
use crate::helpers::hotkey_btn;
use crate::sandbox::dashboards;
use widgetry::{Btn, EventCtx, GfxCtx, Key, Line, Outcome, Panel, TextExt, Widget};
mod elevation;
pub mod map;
mod pandemic;
@ -6,13 +13,6 @@ mod population;
pub mod traffic;
pub mod transit;
use crate::app::App;
use crate::common::HeatmapOptions;
use crate::game::{DrawBaselayer, State, Transition};
use crate::helpers::hotkey_btn;
use crate::sandbox::dashboards;
use widgetry::{Btn, EventCtx, GfxCtx, Key, Line, Outcome, Panel, TextExt, Widget};
// TODO Good ideas in
// https://towardsdatascience.com/top-10-map-types-in-data-visualization-b3a80898ea70

View File

@ -1,3 +1,12 @@
#[macro_use]
extern crate log;
use abstutil::{CmdArgs, Timer};
use geom::Duration;
use sim::SimFlags;
use crate::app::Flags;
mod app;
mod challenges;
mod colors;
@ -15,14 +24,6 @@ mod pregame;
mod render;
mod sandbox;
#[macro_use]
extern crate log;
use crate::app::Flags;
use abstutil::{CmdArgs, Timer};
use geom::Duration;
use sim::SimFlags;
pub fn main() {
let mut args = CmdArgs::new();

View File

@ -1,17 +1,3 @@
mod area;
mod bike;
mod building;
mod bus_stop;
mod car;
mod intersection;
mod lane;
mod map;
mod parking_lot;
mod pedestrian;
mod road;
pub mod traffic_signal;
mod turn;
use crate::app::App;
use crate::colors::ColorScheme;
use crate::helpers::ID;
@ -28,6 +14,20 @@ use map_model::{IntersectionID, Map};
use sim::{DrawCarInput, VehicleType};
use widgetry::{GfxCtx, Prerender};
mod area;
mod bike;
mod building;
mod bus_stop;
mod car;
mod intersection;
mod lane;
mod map;
mod parking_lot;
mod pedestrian;
mod road;
pub mod traffic_signal;
mod turn;
pub const BIG_ARROW_THICKNESS: Distance = Distance::const_meters(0.5);
pub const CROSSWALK_LINE_THICKNESS: Distance = Distance::const_meters(0.15);

View File

@ -1,3 +1,10 @@
use crate::app::App;
use crate::game::Transition;
pub use commuter::CommuterPatterns;
pub use traffic_signals::TrafficSignalDemand;
pub use trip_table::FinishedTripTable;
use widgetry::{Btn, Choice, EventCtx, Key, Line, Panel, TextExt, Widget};
mod commuter;
mod generic_trip_table;
mod misc;
@ -7,13 +14,6 @@ mod table;
mod traffic_signals;
mod trip_table;
use crate::app::App;
use crate::game::Transition;
pub use commuter::CommuterPatterns;
pub use traffic_signals::TrafficSignalDemand;
pub use trip_table::FinishedTripTable;
use widgetry::{Btn, Choice, EventCtx, Key, Line, Panel, TextExt, Widget};
// Oh the dashboards melted, but we still had the radio
#[derive(Clone, Copy, PartialEq, Debug)]
pub enum DashTab {

View File

@ -1,10 +1,3 @@
// TODO pub so challenges can grab cutscenes and SandboxMode can dispatch to actions. Weird?
pub mod commute;
pub mod fix_traffic_signals;
pub mod freeform;
pub mod play_scenario;
pub mod tutorial;
pub use self::freeform::spawn_agents_around;
pub use self::tutorial::{Tutorial, TutorialPointer, TutorialState};
use crate::app::App;
@ -22,6 +15,13 @@ use widgetry::{
lctrl, Btn, Color, EventCtx, GeomBatch, GfxCtx, Key, Line, Outcome, Panel, TextExt, Widget,
};
// TODO pub so challenges can grab cutscenes and SandboxMode can dispatch to actions. Weird?
pub mod commute;
pub mod fix_traffic_signals;
pub mod freeform;
pub mod play_scenario;
pub mod tutorial;
#[derive(PartialEq, Eq, PartialOrd, Ord, Clone)]
pub enum GameplayMode {
// TODO Maybe this should be "sandbox"

View File

@ -1,10 +1,3 @@
pub mod dashboards;
pub mod gameplay;
mod misc_tools;
mod speed;
mod time_warp;
mod uber_turns;
use self::misc_tools::{RoutePreview, TurnExplorer};
use crate::app::App;
use crate::common::{tool_panel, CommonState, ContextualActions, IsochroneViewer, Minimap};
@ -30,6 +23,13 @@ use widgetry::{
TextExt, UpdateType, VerticalAlignment, Widget,
};
pub mod dashboards;
pub mod gameplay;
mod misc_tools;
mod speed;
mod time_warp;
mod uber_turns;
pub struct SandboxMode {
gameplay: Box<dyn gameplay::GameplayState>,
pub gameplay_mode: GameplayMode,

View File

@ -1,20 +1,3 @@
mod angle;
mod bounds;
mod circle;
mod distance;
mod duration;
mod find_closest;
mod gps;
mod line;
mod percent;
mod polygon;
mod polyline;
mod pt;
mod ring;
mod speed;
mod stats;
mod time;
pub use crate::angle::Angle;
pub use crate::bounds::{Bounds, GPSBounds};
pub use crate::circle::Circle;
@ -32,6 +15,23 @@ pub use crate::speed::Speed;
pub use crate::stats::{HgramValue, Histogram, Statistic};
pub use crate::time::Time;
mod angle;
mod bounds;
mod circle;
mod distance;
mod duration;
mod find_closest;
mod gps;
mod line;
mod percent;
mod polygon;
mod polyline;
mod pt;
mod ring;
mod speed;
mod stats;
mod time;
// About 0.4 inches... which is quite tiny on the scale of things. :)
pub const EPSILON_DIST: Distance = Distance::const_meters(0.01);

View File

@ -1,3 +1,6 @@
use configuration::{load_configuration, ImporterConfiguration};
use dependencies::are_dependencies_callable;
mod berlin;
mod configuration;
mod dependencies;
@ -10,9 +13,6 @@ mod tel_aviv;
mod utils;
mod xian;
use configuration::{load_configuration, ImporterConfiguration};
use dependencies::are_dependencies_callable;
// TODO Might be cleaner to express as a dependency graph?
struct Job {

View File

@ -1,5 +1,5 @@
mod popdat;
mod trips;
pub use self::popdat::{import_data, PopDat};
pub use self::trips::{make_weekday_scenario, make_weekday_scenario_with_everyone};
mod popdat;
mod trips;

View File

@ -1,6 +1,3 @@
mod model;
mod world;
use abstutil::{CmdArgs, Timer};
use geom::{Distance, Line, Polygon};
use map_model::osm;
@ -11,6 +8,9 @@ use widgetry::{
Outcome, Panel, ScreenPt, Text, VerticalAlignment, Widget, GUI,
};
mod model;
mod world;
struct UI {
model: Model,
state: State,

View File

@ -2,9 +2,6 @@
// the changes to a file (as PermanentMapEdits). See
// https://dabreegster.github.io/abstreet/map/edits.html.
mod compat;
mod perma;
use crate::make::initial::lane_specs::get_lane_specs_ltr;
use crate::{
connectivity, AccessRestrictions, BusRouteID, ControlStopSign, ControlTrafficSignal, Direction,
@ -17,6 +14,9 @@ pub use perma::PermanentMapEdits;
use serde::{Deserialize, Serialize};
use std::collections::{BTreeMap, BTreeSet};
mod compat;
mod perma;
// Represents changes to a map. Note this isn't serializable -- that's what PermanentMapEdits does.
#[derive(Debug, Clone, PartialEq)]
pub struct MapEdits {

View File

@ -21,17 +21,6 @@
// - t = turn
// - ts = traffic signal
mod city;
pub mod connectivity;
mod edits;
mod make;
mod map;
mod objects;
pub mod osm;
mod pathfind;
pub mod raw;
mod traversable;
#[macro_use]
extern crate log;
@ -66,6 +55,17 @@ use geom::{Bounds, Distance, GPSBounds, Polygon};
use serde::{Deserialize, Serialize};
use std::collections::BTreeMap;
mod city;
pub mod connectivity;
mod edits;
mod make;
mod map;
mod objects;
pub mod osm;
mod pathfind;
pub mod raw;
mod traversable;
// TODO Minimize uses of these!
pub const NORMAL_LANE_THICKNESS: Distance = Distance::const_meters(2.5);
pub(crate) const SERVICE_ROAD_LANE_THICKNESS: Distance = Distance::const_meters(1.5);

View File

@ -1,9 +1,6 @@
// Naming is confusing, but RawMap -> InitialMap -> Map. InitialMap is separate pretty much just
// for the step of producing https://dabreegster.github.io/abstreet/map/importing/geometry.html.
mod geometry;
pub mod lane_specs;
pub use self::geometry::intersection_polygon;
use crate::raw::{OriginalRoad, RawMap, RawRoad};
use crate::{osm, DrivingSide, IntersectionType};
@ -12,6 +9,9 @@ use geom::{Bounds, Circle, Distance, PolyLine, Polygon, Pt2D};
use lane_specs::LaneSpec;
use std::collections::{BTreeMap, BTreeSet};
mod geometry;
pub mod lane_specs;
pub struct InitialMap {
pub roads: BTreeMap<OriginalRoad, Road>,
pub intersections: BTreeMap<osm::NodeID, Intersection>,

View File

@ -1,16 +1,6 @@
// See https://dabreegster.github.io/abstreet/map/importing/index.html for an overview. This module
// covers the RawMap->Map stage.
mod bridges;
mod buildings;
pub mod initial;
mod parking_lots;
mod remove_disconnected;
pub mod traffic_signals;
mod transit;
pub mod turns;
mod walking_turns;
use crate::pathfind::Pathfinder;
use crate::raw::{OriginalRoad, RawMap};
use crate::{
@ -22,6 +12,16 @@ use abstutil::{Parallelism, Timer};
use geom::{Bounds, Distance, FindClosest, HashablePt2D, Speed, EPSILON_DIST};
use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet};
mod bridges;
mod buildings;
pub mod initial;
mod parking_lots;
mod remove_disconnected;
pub mod traffic_signals;
mod transit;
pub mod turns;
mod walking_turns;
impl Map {
pub fn create_from_raw(mut raw: RawMap, build_ch: bool, timer: &mut Timer) -> Map {
// Better to defer this and see RawMaps with more debug info in map_editor

View File

@ -1,13 +1,5 @@
// Everything related to pathfinding through a map for different types of agents.
mod ch;
mod dijkstra;
mod driving;
mod node_map;
// TODO tmp
pub mod uber_turns;
mod walking;
pub use self::ch::ContractionHierarchyPathfinder;
pub use self::driving::driving_cost;
pub use self::walking::{walking_cost, WalkingNode};
@ -22,6 +14,14 @@ use serde::{Deserialize, Serialize};
use std::collections::{BTreeSet, VecDeque};
use std::fmt;
mod ch;
mod dijkstra;
mod driving;
mod node_map;
// TODO tmp
pub mod uber_turns;
mod walking;
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub enum PathStep {
// Original direction

View File

@ -1,16 +1,3 @@
mod analytics;
mod cap;
mod events;
mod make;
mod mechanics;
mod pandemic;
mod render;
mod router;
mod scheduler;
mod sim;
mod transit;
mod trips;
#[macro_use]
extern crate log;
@ -47,6 +34,19 @@ use map_model::{
use serde::{Deserialize, Serialize};
use std::fmt;
mod analytics;
mod cap;
mod events;
mod make;
mod mechanics;
mod pandemic;
mod render;
mod router;
mod scheduler;
mod sim;
mod transit;
mod trips;
// http://pccsc.net/bicycle-parking-info/ says 68 inches, which is 1.73m
pub const BIKE_LENGTH: Distance = Distance::const_meters(1.8);
// These two must be < PARKING_SPOT_LENGTH

View File

@ -1,10 +1,5 @@
mod activity_model;
mod external;
mod generator;
mod load;
mod modifier;
mod scenario;
mod spawner;
use rand::{RngCore, SeedableRng};
use rand_xorshift::XorShiftRng;
pub use self::external::{ExternalPerson, ExternalTrip};
pub use self::generator::{
@ -16,8 +11,14 @@ pub use self::scenario::{
IndividTrip, OffMapLocation, PersonSpec, Scenario, SpawnTrip, TripPurpose,
};
pub use self::spawner::{TripSpawner, TripSpec};
use rand::{RngCore, SeedableRng};
use rand_xorshift::XorShiftRng;
mod activity_model;
mod external;
mod generator;
mod load;
mod modifier;
mod scenario;
mod spawner;
// Need to explain this trick -- basically keeps consistency between two different simulations when
// each one might make slightly different sequences of calls to the RNG.

View File

@ -1,12 +1,12 @@
pub use self::driving::DrivingSimState;
pub use self::intersection::IntersectionSimState;
pub use self::parking::{ParkingSim, ParkingSimState};
pub use self::queue::Queue;
pub use self::walking::WalkingSimState;
mod car;
mod driving;
mod intersection;
mod parking;
mod queue;
mod walking;
pub use self::driving::DrivingSimState;
pub use self::intersection::IntersectionSimState;
pub use self::parking::{ParkingSim, ParkingSimState};
pub use self::queue::Queue;
pub use self::walking::WalkingSimState;

View File

@ -1,5 +1,3 @@
mod pandemic;
use geom::{Duration, Time};
pub use pandemic::{Cmd, PandemicModel};
use rand::Rng;
@ -7,6 +5,8 @@ use rand_distr::{Distribution, Exp, Normal};
use rand_xorshift::XorShiftRng;
use std::ops;
mod pandemic;
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
pub struct AnyTime(f64);

View File

@ -1,5 +1,3 @@
mod queries;
pub use self::queries::AgentProperties;
use crate::{
AgentID, AlertLocation, Analytics, CapSimState, CarID, Command, CreateCar, DrawCarInput,
@ -23,6 +21,8 @@ use serde::{Deserialize, Serialize};
use std::collections::{BTreeSet, HashSet};
use std::panic;
mod queries;
// TODO Do something else.
const BLIND_RETRY_TO_SPAWN: Duration = Duration::const_seconds(5.0);

View File

@ -28,33 +28,6 @@
#[macro_use]
extern crate log;
mod assets;
#[cfg(any(feature = "glow-backend", feature = "wasm-backend"))]
mod backend_glow;
#[cfg(feature = "glow-backend")]
mod backend_glow_native;
#[cfg(feature = "wasm-backend")]
mod backend_glow_wasm;
mod canvas;
mod color;
mod drawing;
mod event;
mod event_ctx;
mod geom;
mod input;
mod runner;
mod screen_geom;
mod style;
mod svg;
mod text;
mod tools;
mod widgets;
mod backend {
#[cfg(any(feature = "glow-backend", feature = "wasm-backend"))]
pub use crate::backend_glow::*;
}
pub use crate::backend::Drawable;
pub use crate::canvas::{Canvas, HorizontalAlignment, VerticalAlignment};
pub use crate::color::{Color, Fill, LinearGradient, Texture};
@ -87,6 +60,33 @@ pub use crate::widgets::spinner::Spinner;
pub(crate) use crate::widgets::text_box::TextBox;
pub use crate::widgets::{EdgeInsets, Outcome, Panel, Widget, WidgetImpl, WidgetOutput};
mod assets;
#[cfg(any(feature = "glow-backend", feature = "wasm-backend"))]
mod backend_glow;
#[cfg(feature = "glow-backend")]
mod backend_glow_native;
#[cfg(feature = "wasm-backend")]
mod backend_glow_wasm;
mod canvas;
mod color;
mod drawing;
mod event;
mod event_ctx;
mod geom;
mod input;
mod runner;
mod screen_geom;
mod style;
mod svg;
mod text;
mod tools;
mod widgets;
mod backend {
#[cfg(any(feature = "glow-backend", feature = "wasm-backend"))]
pub use crate::backend_glow::*;
}
pub struct Choice<T> {
pub label: String,
pub data: T,

View File

@ -1,3 +1,18 @@
use crate::widgets::containers::{Container, Nothing};
pub use crate::widgets::panel::Panel;
use crate::{
Button, Choice, Color, DeferDraw, DrawWithTooltips, Drawable, Dropdown, EventCtx, GeomBatch,
GfxCtx, JustDraw, Menu, RewriteColor, ScreenDims, ScreenPt, ScreenRectangle, Text, TextBox,
};
use geom::{Distance, Percent, Polygon};
use std::collections::HashSet;
use stretch::geometry::{Rect, Size};
use stretch::node::{Node, Stretch};
use stretch::number::Number;
use stretch::style::{
AlignItems, Dimension, FlexDirection, FlexWrap, JustifyContent, PositionType, Style,
};
pub mod autocomplete;
pub mod button;
pub mod checkbox;
@ -16,21 +31,6 @@ pub mod slider;
pub mod spinner;
pub mod text_box;
use crate::widgets::containers::{Container, Nothing};
pub use crate::widgets::panel::Panel;
use crate::{
Button, Choice, Color, DeferDraw, DrawWithTooltips, Drawable, Dropdown, EventCtx, GeomBatch,
GfxCtx, JustDraw, Menu, RewriteColor, ScreenDims, ScreenPt, ScreenRectangle, Text, TextBox,
};
use geom::{Distance, Percent, Polygon};
use std::collections::HashSet;
use stretch::geometry::{Rect, Size};
use stretch::node::{Node, Stretch};
use stretch::number::Number;
use stretch::style::{
AlignItems, Dimension, FlexDirection, FlexWrap, JustifyContent, PositionType, Style,
};
/// Create a new widget by implementing this trait. You can instantiate your widget by calling
/// `Widget::new(Box::new(instance of your new widget))`, which gives you the usual style options.
pub trait WidgetImpl: downcast_rs::Downcast {