Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Calculate stop to subshape mapping during import (#136)
* WIP: Move subshape request into `nigiri` * WIP: Remove `trip_idx_t` from function signature * WIP: Explore wrong shape for merged trips * WIP: Fix missing end segment * Fix trip index on merged trips * Add check for stop order on same section * WIP: Create struct to handle shapes data * WIP: Swap to new shapes storage struct * WIP: Format code * WIP: Remove temporary cache * WIP: Remove mutable cache * WIP: Fix array variant * WIP: Parametrize test * Add missing header * WIP: Calculate shape offsets per stop during load * WIP: Use cache to improve import duration This also adds files missing in last commit * Add test for duplicated shape offsets * Cleanup code * Fix build errors * Fix formatting * Update progress bar * Remove `constexpr` specifier * Ensure mapping uses correct indices * Make `shapes_storage` optional Using a `shapes_storage` instance will now always calculate and store shapes and shape offsets. * WIP: Avoid creating an additional vector * Add test for shared shapes * Cleanup test input * Move initializer used in `if` * Simplify cache offset calculation * Remove aliases used only once * Use lambda expressions for offsets calculation cache This will remove warnings about possibly unused functions in defined function objects. * Add vector to store duplicated shape offsets * WIP: Store trip to shape mapping in shapes_storage * Remove 'trip_shape_indices_' from 'timetable' * Revert accidentally applied formatting * Fix code style * Fix typo * fixup! Revert accidentally applied formatting * Fix missing header * Use uniform formatting library * Simplify equals and hash functions * Fix progess bar update * Duplicate alias defined in osr * Delete dead code * WIP: Add prototype supporting block trips * Fix assertions * Update tests for changes function This will also prepare the data set for multiple tests using a common timetable. * Handle trips without shape * WIP: Add support for runs containing a trip subset * WIP: Handle offsets of merged sub trips * WIP: Add support for runs covering multiple trips * Delete debug output * WIP: Add support for shapes covering two trips Notice that the connection stop will be processed twice for now. * WIP: Fix duplicated connection stop * WIP: Add support for many trips * Fix offsets * Support merged trips with and without shapes * Simplify some code * Fix includes * Remove previous implementation * Simplify shape offset calculation * Use apropiate loop statement * Remove not required namespace * Improve test description * Reduce duplicated code * Fix missing `const` * Fix formatting * WIP: Prepare shape offset calculate by distance * Simplify property access * Fix test data * Remove stop deduplication for merged trips Stops connecting multiple trips in a journey leg will no longer be merged. This will slightly improve code readability without having a notible effect for most data sets. Furthermore, it will support GTFS data sets that may use different coordinates for stops connecting multiple trips. * Calculate offsets based on distance traveled * Add test for different traveled distances * Fix formatting * Fix out of bounds error * Remove lambda function * Swap checks for performance improvement * Fix assertion Fix offset, as 'stop_range_' is inclusive while 'range' is exclusive * Prefer algorithms provided by 'utl' * Use better variable name * Fix missing namespace 'std' * Replace unicode arrows * Use explicit loop to replace 'std::for_each' * Move expected values into assertions * Remove not needed assertion * Fix missing type conversion for interval shifts * Use operations defined for interval * Use enumeration * Use unsigned integers for initialization This is only applied for data types that are based on unsigned integers * Use base type for offset calculation * Revert "Fix assertion" This reverts commit 99da3ed. * Fix variable name * Use 'interval::end()' implementation Notice that using `end(interval)` will attempt to use `frun::end()` instead. * wip * Fix code * Add tests for mixed shape trips * WIP: Simplify shape processing * Cleanup code * Fix behavior for single stops * Format code * Replace call to 'std::views::pairwise' * Remove not supported 'std::views::pairwise' * Use offset cache for shapes with distance traveled * Remove calls to 'std::make_pair' * Change temporary data structure This will use a vector map to avoid an additional hash map. * Simplify inserts * Store median distance traveled This allows minor errors within shape distance traveled * Fix formatting * Reduce memory usage * Remove not required headers * Rename variables to match intended usage * Simplify check for valid distances traveled * Fix offset error for multiple data sets * Fix included headers * Use trailing return type * Improve variable names * Remove no longer used function * Remove no longer relevant information from test * WIP: Change code to operate on segments * Remove duplicated shape points * Move duplicated code into shared lambda with state * Add tests for interval intersection * Remove not needed variable * Use lvalue reference instead of rvalue reference * Remove misleading alias * Use default capture * Update names * Fix naming * Store invalid starting point into constant * Replace comment with assert * Use alias * Replace 'index' with 'idx' * Remove not needed 'inline' * Add brief explanation for stored median * WIP: Setup tests for missing distances * Avoid zero vectors for 'shape_dist_traveled' * Move length check to the end * Improve memory usage for empty shape_dist_traveled As values must increase, only leading `0.0`s are allowed. * Update test to use multiple leading `0.0`s * Simplify check for valid distances * Reduce memory usage when no shapes are used * Mark unused variable * Fix data type * Delete obsolete compare function * Simplify shape offset calculation Assume visual errors will not be noticed by end users. Therefore some optimization can be skipped. * Update cista dependency * Remove unused include --------- Co-authored-by: Felix Gündling <[email protected]>
- Loading branch information