mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2026-05-11 09:35:23 +01:00
now calleable from Django
This commit is contained in:
@@ -102,7 +102,7 @@ def generate_performance_test(num_points=200):
|
||||
|
||||
return test_points
|
||||
|
||||
def export_random_points_gpx(points_with_results, filename="random_test_points.gpx"):
|
||||
def export_random_points_gpx(points_with_results, filename="/tmp/random_test_points.gpx"):
|
||||
root = ET.Element("gpx", version="1.1", creator="PerformanceTester",
|
||||
xmlns="http://www.topografix.com/GPX/1/1")
|
||||
|
||||
|
||||
+14
-1
@@ -99,7 +99,20 @@ def split_into_monotonic_segments(points):
|
||||
|
||||
|
||||
def generate_boundary_segments():
|
||||
points = load_and_clean_gpx('1623-6_border.gpx')
|
||||
filename = '1623-6_border.gpx'
|
||||
# Check if we are running inside Django
|
||||
try:
|
||||
from django.conf import settings
|
||||
# If settings is configured, use the troggle path
|
||||
if hasattr(settings, 'TROGGLE_PATH'):
|
||||
gpx_path = Path(settings.TROGGLE_PATH) / 'core' / filename
|
||||
else:
|
||||
gpx_path = Path(filename)
|
||||
except (ImportError, Exception):
|
||||
# Fallback for standalone testing outside of Django
|
||||
gpx_path = Path(filename)
|
||||
|
||||
points = load_and_clean_gpx(gpx_path)
|
||||
# save_cleaned_gpx(points, "cleaned_border_output.gpx") # done once, not needed
|
||||
mono_segments = split_into_monotonic_segments(points)
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user