sageroad 1.0.0__tar.gz → 1.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sageroad-1.0.0/src/sageroad.egg-info → sageroad-1.0.2}/PKG-INFO +4 -3
- {sageroad-1.0.0 → sageroad-1.0.2}/PYPI.md +3 -2
- {sageroad-1.0.0 → sageroad-1.0.2}/pyproject.toml +1 -1
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/index.html +1 -1
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/lib/planView.js +186 -7
- sageroad-1.0.2/src/sageroad/static/sageroad.svg +11 -0
- {sageroad-1.0.0 → sageroad-1.0.2/src/sageroad.egg-info}/PKG-INFO +4 -3
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad.egg-info/SOURCES.txt +1 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/LICENSE +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/README.md +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/setup.cfg +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/__init__.py +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/__main__.py +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/app.py +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/main.py +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/app.css +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/lib/app.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/lib/args.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/lib/canvas.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/lib/doc.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/lib/draw.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/lib/explore.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/lib/form.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/lib/format.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/lib/geo.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/lib/homePage.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/lib/mapPage.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/lib/markdown.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/lib/model.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/lib/models.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/lib/modelsPage.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/lib/planData.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/lib/report.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/lib/schemaDoc.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/lib/smoothing.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/lib/tables.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/lib/view3d.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/lib/viewPages.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/plan/lib/auto.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/plan/lib/browser/buffer.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/plan/lib/browser/io.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/plan/lib/browser/zlib.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/plan/lib/design.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/plan/lib/draft.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/plan/lib/draws.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/plan/lib/elevationImage.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/plan/lib/engineer.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/plan/lib/features.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/plan/lib/numeric.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/plan/lib/ollama.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/plan/lib/planFile.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/plan/lib/plot.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/plan/lib/png.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/plan/lib/profile.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/plan/lib/roads.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/plan/lib/route.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/plan/lib/siteCommand.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/plan/lib/structures.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/plan/lib/terrain.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/plan/lib/usgs.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/schema-markdown/lib/parser.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/schema-markdown/lib/schema.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/schema-markdown/lib/schemaUtil.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad/static/schema-markdown/lib/typeModel.js +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad.egg-info/dependency_links.txt +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad.egg-info/entry_points.txt +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad.egg-info/requires.txt +0 -0
- {sageroad-1.0.0 → sageroad-1.0.2}/src/sageroad.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sageroad
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.2
|
|
4
4
|
Summary: SageRoad engineers low-volume roads on USGS lidar terrain and views the resulting road plans
|
|
5
5
|
Author: Craig A. Hobbs
|
|
6
6
|
License-Expression: MIT
|
|
@@ -264,8 +264,9 @@ and cost score, then shows:
|
|
|
264
264
|
- **Plan options** - a comparison of every option's length, maximum grade, cut, fill, net import or
|
|
265
265
|
export, retaining walls, design warnings, and cost score (select an option to view it)
|
|
266
266
|
- **Plan view** - a contour map with the road footprint (cut and fill slopes), structures, station
|
|
267
|
-
ticks, the other options' centerlines, and the outlines of the 3D views.
|
|
268
|
-
|
|
267
|
+
ticks, the other options' centerlines, and the outlines of the 3D views. The site's streams, roads,
|
|
268
|
+
and areas are named where their names fit - clear of each other, the road, and the drawing's labels
|
|
269
|
+
(the longest first). Click it to explore the 3D landscape from that point.
|
|
269
270
|
- **Profile** - the ground and road grade along the road, with cut and fill areas, structures, and
|
|
270
271
|
grades over the maximum highlighted
|
|
271
272
|
- **3D views** - the terrain (with contours) graded to the road's finished surface: the road, cut and
|
|
@@ -239,8 +239,9 @@ and cost score, then shows:
|
|
|
239
239
|
- **Plan options** - a comparison of every option's length, maximum grade, cut, fill, net import or
|
|
240
240
|
export, retaining walls, design warnings, and cost score (select an option to view it)
|
|
241
241
|
- **Plan view** - a contour map with the road footprint (cut and fill slopes), structures, station
|
|
242
|
-
ticks, the other options' centerlines, and the outlines of the 3D views.
|
|
243
|
-
|
|
242
|
+
ticks, the other options' centerlines, and the outlines of the 3D views. The site's streams, roads,
|
|
243
|
+
and areas are named where their names fit - clear of each other, the road, and the drawing's labels
|
|
244
|
+
(the longest first). Click it to explore the 3D landscape from that point.
|
|
244
245
|
- **Profile** - the ground and road grade along the road, with cut and fill areas, structures, and
|
|
245
246
|
grades over the maximum highlighted
|
|
246
247
|
- **3D views** - the terrain (with contours) graded to the road's finished surface: the road, cut and
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="utf-8">
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
6
|
<title>SageRoad</title>
|
|
7
|
-
<link rel="icon" href="
|
|
7
|
+
<link rel="icon" href="sageroad.svg">
|
|
8
8
|
<link rel="stylesheet" href="app.css">
|
|
9
9
|
<script type="importmap">
|
|
10
10
|
{"imports": {
|
|
@@ -13,6 +13,130 @@ import {unproject} from './view3d.js';
|
|
|
13
13
|
export const planPad = 10;
|
|
14
14
|
|
|
15
15
|
|
|
16
|
+
// The features' names' font size, the space kept around a name and around the road (its highlighted centerline's half
|
|
17
|
+
// width), and the farthest that the road's edge is from a name's place for the name to be beside the road there, in
|
|
18
|
+
// pixels - and the places along a line feature that its name is tried at (fractions of its length - its middle first)
|
|
19
|
+
const nameSize = 11;
|
|
20
|
+
const nameGap = 2;
|
|
21
|
+
const roadGap = 3;
|
|
22
|
+
const besideMax = 2 * nameSize;
|
|
23
|
+
const nameFractions = [0.5, 0.4, 0.6, 0.3, 0.7, 0.2, 0.8];
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
// Get a label's box - a [left, top, right, bottom] array - from its center and its font size
|
|
27
|
+
function labelBox(label, fontSize, x, y) {
|
|
28
|
+
const halfWidth = labelHalfWidth(label, fontSize);
|
|
29
|
+
const halfHeight = fontSize * 0.6;
|
|
30
|
+
return [x - halfWidth, y - halfHeight, x + halfWidth, y + halfHeight];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
// Get a line's points (a coordinates array's) at fractions of its length
|
|
35
|
+
function linePoints(coords, length, fractions) {
|
|
36
|
+
return fractions.map((fraction) => {
|
|
37
|
+
let remaining = fraction * length;
|
|
38
|
+
let ix = 2;
|
|
39
|
+
let segment = Math.hypot(coords[2] - coords[0], coords[3] - coords[1]);
|
|
40
|
+
while (remaining > segment) {
|
|
41
|
+
remaining -= segment;
|
|
42
|
+
ix += 2;
|
|
43
|
+
segment = Math.hypot(coords[ix] - coords[ix - 2], coords[ix + 1] - coords[ix - 1]);
|
|
44
|
+
}
|
|
45
|
+
const ratio = remaining / Math.max(segment, Number.EPSILON);
|
|
46
|
+
return [coords[ix - 2] + (coords[ix] - coords[ix - 2]) * ratio, coords[ix - 1] + (coords[ix + 1] - coords[ix - 1]) * ratio];
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
// Get the boxes that a label's box - its center and its half width and half height - is over
|
|
52
|
+
function boxesOver(boxes, x, y, halfWidth, halfHeight) {
|
|
53
|
+
const left = x - halfWidth;
|
|
54
|
+
const right = x + halfWidth;
|
|
55
|
+
const top = y - halfHeight;
|
|
56
|
+
const bottom = y + halfHeight;
|
|
57
|
+
return boxes.filter((box) => left < box[2] && right > box[0] && top < box[3] && bottom > box[1]);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
// The road's boxes are kept by the cells of a grid that they're in (a map of a cell's key to its boxes), so a label's
|
|
62
|
+
// box is tested against the road's boxes near it - a road has thousands. This is the cells' size, in pixels.
|
|
63
|
+
const cellSize = 64;
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
// Add a box to the cells it's in
|
|
67
|
+
function cellsAdd(cells, box) {
|
|
68
|
+
for (let cellX = Math.floor(box[0] / cellSize); cellX <= Math.floor(box[2] / cellSize); cellX++) {
|
|
69
|
+
for (let cellY = Math.floor(box[1] / cellSize); cellY <= Math.floor(box[3] / cellSize); cellY++) {
|
|
70
|
+
const key = `${cellX},${cellY}`;
|
|
71
|
+
const boxes = cells.get(key) ?? [];
|
|
72
|
+
boxes.push(box);
|
|
73
|
+
cells.set(key, boxes);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
// Get the cells' boxes that a label's box is over - a box that's in more than one cell may be there more than once
|
|
80
|
+
function cellsOver(cells, x, y, halfWidth, halfHeight) {
|
|
81
|
+
const near = [];
|
|
82
|
+
for (let cellX = Math.floor((x - halfWidth) / cellSize); cellX <= Math.floor((x + halfWidth) / cellSize); cellX++) {
|
|
83
|
+
for (let cellY = Math.floor((y - halfHeight) / cellSize); cellY <= Math.floor((y + halfHeight) / cellSize); cellY++) {
|
|
84
|
+
near.push(...cells.get(`${cellX},${cellY}`) ?? []);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return boxesOver(near, x, y, halfWidth, halfHeight);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
// Create the features' names' markup - "names" is an array of [name, color, points] arrays, in the order they're placed.
|
|
92
|
+
// A name is at the first of its points where it's within the drawing and clear of the boxes ("boxes" - the drawing's
|
|
93
|
+
// other labels, and the names placed before it) and of the road ("roadCells"). A name that has no such point is beside
|
|
94
|
+
// the road, at the first of its points that the road is over - above the road there, below it, left of it, or right of
|
|
95
|
+
// it, where the road's edge is near the point - and a name that fits nowhere isn't drawn.
|
|
96
|
+
function featureNames(names, boxes, roadCells, width, height) {
|
|
97
|
+
const elements = [];
|
|
98
|
+
for (const [name, color, points] of names) {
|
|
99
|
+
const halfWidth = labelHalfWidth(name, nameSize) + nameGap;
|
|
100
|
+
const halfHeight = nameSize * 0.6 + nameGap;
|
|
101
|
+
const fits = ([x, y]) => (
|
|
102
|
+
x - halfWidth >= 0 && y - halfHeight >= 0 && x + halfWidth <= width && y + halfHeight <= height &&
|
|
103
|
+
boxesOver(boxes, x, y, halfWidth, halfHeight).length === 0
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
// The name's places on its feature, and its places beside the road
|
|
107
|
+
const beside = [];
|
|
108
|
+
let place = null;
|
|
109
|
+
for (const point of points) {
|
|
110
|
+
const [x, y] = point;
|
|
111
|
+
const over = cellsOver(roadCells, x, y, halfWidth, halfHeight);
|
|
112
|
+
if (over.length === 0 && fits(point)) {
|
|
113
|
+
place = point;
|
|
114
|
+
break;
|
|
115
|
+
} else if (over.length > 0) {
|
|
116
|
+
const top = Math.min(...over.map((box) => box[1]));
|
|
117
|
+
const bottom = Math.max(...over.map((box) => box[3]));
|
|
118
|
+
const left = Math.min(...over.map((box) => box[0]));
|
|
119
|
+
const right = Math.max(...over.map((box) => box[2]));
|
|
120
|
+
beside.push(...[
|
|
121
|
+
[x, top - halfHeight - 0.5, y - top],
|
|
122
|
+
[x, bottom + halfHeight + 0.5, bottom - y],
|
|
123
|
+
[left - halfWidth - 0.5, y, x - left],
|
|
124
|
+
[right + halfWidth + 0.5, y, right - x]
|
|
125
|
+
].filter(([, , distance]) => distance <= besideMax));
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
place ??= beside.find((point) => fits(point) && cellsOver(roadCells, point[0], point[1], halfWidth, halfHeight).length === 0) ??
|
|
129
|
+
null;
|
|
130
|
+
if (place !== null) {
|
|
131
|
+
const [x, y] = place;
|
|
132
|
+
boxes.push([x - halfWidth + nameGap, y - halfHeight + nameGap, x + halfWidth - nameGap, y + halfHeight - nameGap]);
|
|
133
|
+
elements.push(svgText(name, x, y, nameSize, 'middle', color, false));
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return elements.join('');
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
|
|
16
140
|
// Create the plan view SVG markup - "outlines" is an array of [number, view, [x, y]] arrays of 3D views (projection)
|
|
17
141
|
// whose visible areas are outlined, with their numbers marked on the road at [x, y]. Returns the markup and the plan
|
|
18
142
|
// view's scale and height (for the click handler).
|
|
@@ -60,15 +184,26 @@ export function planView(plan, topo, analyses, ixOption, width, outlines) {
|
|
|
60
184
|
elements.push(`<path d="${minorPath.join('')}" fill="none" stroke="#b89a72" stroke-width="0.6"/>`);
|
|
61
185
|
elements.push(`<path d="${indexPath.join('')}" fill="none" stroke="#8a6a45" stroke-width="1.3"/>`);
|
|
62
186
|
|
|
63
|
-
// Features
|
|
187
|
+
// Features - their names are drawn where they fit (featureNames), once the drawing's other labels and its road are
|
|
188
|
+
// known: an area's name is at its center or, if it doesn't fit there, halfway to one of its corners, and a line's is
|
|
189
|
+
// at its middle or, if it doesn't fit there, elsewhere along it. The pieces of a line (the features of its type and
|
|
190
|
+
// name) have one name.
|
|
191
|
+
const boxes = [];
|
|
192
|
+
const roadCells = new Map();
|
|
193
|
+
const areaNames = [];
|
|
194
|
+
const lineNames = new Map();
|
|
64
195
|
for (const feature of topo.features) {
|
|
65
196
|
const {type} = feature;
|
|
66
197
|
const coords = [];
|
|
67
198
|
let sumX = 0;
|
|
68
199
|
let sumY = 0;
|
|
200
|
+
let lineLength = 0;
|
|
69
201
|
for (const point of feature.points) {
|
|
70
202
|
const pxValue = pad + point.x * scale;
|
|
71
203
|
const pyValue = pad + (topoHeight - point.y) * scale;
|
|
204
|
+
if (coords.length > 0) {
|
|
205
|
+
lineLength += Math.hypot(pxValue - coords[coords.length - 2], pyValue - coords[coords.length - 1]);
|
|
206
|
+
}
|
|
72
207
|
coords.push(pxValue, pyValue);
|
|
73
208
|
sumX += pxValue;
|
|
74
209
|
sumY += pyValue;
|
|
@@ -86,9 +221,20 @@ export function planView(plan, topo, analyses, ixOption, width, outlines) {
|
|
|
86
221
|
elements.push(svgPolygon(coords, 'rgba(208,49,45,0.12)', '#d0312d', 1.5));
|
|
87
222
|
}
|
|
88
223
|
const name = feature.name ?? null;
|
|
89
|
-
if (name !== null) {
|
|
90
|
-
const
|
|
91
|
-
|
|
224
|
+
if (name !== null && (type === 'stream' || type === 'road' || type === 'trail')) {
|
|
225
|
+
const key = `${type} ${name}`;
|
|
226
|
+
const line = lineNames.get(key) ?? {name, 'color': type === 'stream' ? '#1d4f9e' : '#444', 'length': 0, 'pieces': []};
|
|
227
|
+
line.length += lineLength;
|
|
228
|
+
line.pieces.push([lineLength, coords]);
|
|
229
|
+
lineNames.set(key, line);
|
|
230
|
+
} else if (name !== null) {
|
|
231
|
+
const centerX = sumX / feature.points.length;
|
|
232
|
+
const centerY = sumY / feature.points.length;
|
|
233
|
+
const points = [[centerX, centerY]];
|
|
234
|
+
for (let ix = 0; ix < coords.length; ix += 2) {
|
|
235
|
+
points.push([(centerX + coords[ix]) * 0.5, (centerY + coords[ix + 1]) * 0.5]);
|
|
236
|
+
}
|
|
237
|
+
areaNames.push([name, '#444', points]);
|
|
92
238
|
}
|
|
93
239
|
}
|
|
94
240
|
|
|
@@ -103,6 +249,10 @@ export function planView(plan, topo, analyses, ixOption, width, outlines) {
|
|
|
103
249
|
}
|
|
104
250
|
}
|
|
105
251
|
|
|
252
|
+
// The features' names' place in the drawing - over the features and the other options, and under the road
|
|
253
|
+
const ixNames = elements.length;
|
|
254
|
+
elements.push('');
|
|
255
|
+
|
|
106
256
|
// The selected option's footprint
|
|
107
257
|
const analysis = analyses[ixOption];
|
|
108
258
|
const option = plan.options[ixOption];
|
|
@@ -148,6 +298,18 @@ export function planView(plan, topo, analyses, ixOption, width, outlines) {
|
|
|
148
298
|
elements.push(svgPolygon([
|
|
149
299
|
prevCoords[2], prevCoords[3], coords[2], coords[3], coords[4], coords[5], prevCoords[4], prevCoords[5]
|
|
150
300
|
], fill, fill, 0.5));
|
|
301
|
+
|
|
302
|
+
// The features' names are clear of the road - its sample interval's surface and slopes, and its centerline
|
|
303
|
+
const box = [Infinity, Infinity, -Infinity, -Infinity];
|
|
304
|
+
for (const intervalCoords of [prevCoords, coords]) {
|
|
305
|
+
for (let ix = 0; ix < 8; ix += 2) {
|
|
306
|
+
box[0] = Math.min(box[0], intervalCoords[ix] - roadGap);
|
|
307
|
+
box[1] = Math.min(box[1], intervalCoords[ix + 1] - roadGap);
|
|
308
|
+
box[2] = Math.max(box[2], intervalCoords[ix] + roadGap);
|
|
309
|
+
box[3] = Math.max(box[3], intervalCoords[ix + 1] + roadGap);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
cellsAdd(roadCells, box);
|
|
151
313
|
}
|
|
152
314
|
prevCoords = coords;
|
|
153
315
|
}
|
|
@@ -183,7 +345,9 @@ export function planView(plan, topo, analyses, ixOption, width, outlines) {
|
|
|
183
345
|
const pxValue = pad + x * scale;
|
|
184
346
|
const pyValue = pad + (topoHeight - y) * scale;
|
|
185
347
|
elements.push(`<circle cx="${px(pxValue)}" cy="${px(pyValue)}" r="2.5" fill="#222"/>`);
|
|
186
|
-
|
|
348
|
+
const label = formatStation(stationValue, units);
|
|
349
|
+
elements.push(svgText(label, pxValue + 6, pyValue - 8, 10, 'start', '#222', false));
|
|
350
|
+
boxes.push(labelBox(label, 10, pxValue + 6 + labelHalfWidth(label, 10), pyValue - 8));
|
|
187
351
|
}
|
|
188
352
|
|
|
189
353
|
// Start and end markers
|
|
@@ -192,6 +356,8 @@ export function planView(plan, topo, analyses, ixOption, width, outlines) {
|
|
|
192
356
|
const pyValue = pad + (topoHeight - point.y) * scale;
|
|
193
357
|
elements.push(`<circle cx="${px(pxValue)}" cy="${px(pyValue)}" r="6" fill="${color}" stroke="white" stroke-width="2"/>`);
|
|
194
358
|
elements.push(svgText(label, labelX(label, 13, pxValue, width), pyValue - 14, 13, 'middle', color, true));
|
|
359
|
+
boxes.push([pxValue - 7, pyValue - 7, pxValue + 7, pyValue + 7]);
|
|
360
|
+
boxes.push(labelBox(label, 13, labelX(label, 13, pxValue, width), pyValue - 14));
|
|
195
361
|
}
|
|
196
362
|
|
|
197
363
|
// Scale bar
|
|
@@ -200,12 +366,15 @@ export function planView(plan, topo, analyses, ixOption, width, outlines) {
|
|
|
200
366
|
const barY = height - pad - 12;
|
|
201
367
|
elements.push(`<rect x="${pad + 8}" y="${barY - 14}" width="${px(barPx + 16)}" height="26" fill="white" fill-opacity="0.8"/>`);
|
|
202
368
|
elements.push(svgPolyline([pad + 16, barY, pad + 16 + barPx, barY], '#222', 3));
|
|
203
|
-
|
|
204
|
-
`${unitLabel(units, 'length')}
|
|
369
|
+
const barLabel = `${number(barLength, 0)} ${unitLabel(units, 'length')} — contours ${fixedTrim(interval, 2)} ` +
|
|
370
|
+
`${unitLabel(units, 'length')}`;
|
|
371
|
+
elements.push(svgText(barLabel, pad + 16, barY - 7, 10, 'start', '#222', false));
|
|
372
|
+
boxes.push([pad + 8, barY - 14, pad + 16 + Math.max(barPx + 8, 2 * labelHalfWidth(barLabel, 10)), barY + 12]);
|
|
205
373
|
|
|
206
374
|
// North arrow
|
|
207
375
|
elements.push(svgPolygon([width - 30, pad + 8, width - 37, pad + 28, width - 23, pad + 28], '#222', '#222', 1));
|
|
208
376
|
elements.push(svgText('N', width - 30, pad + 38, 11, 'middle', '#222', true));
|
|
377
|
+
boxes.push([width - 37, pad + 8, width - 23, pad + 45]);
|
|
209
378
|
|
|
210
379
|
// The 3D views' visible areas - their corners projected onto the ground - as light dashed outlines, then their
|
|
211
380
|
// numbers marked on the road (on top of the outlines)
|
|
@@ -223,10 +392,20 @@ export function planView(plan, topo, analyses, ixOption, width, outlines) {
|
|
|
223
392
|
const pxValue = pad + marker[0] * scale;
|
|
224
393
|
const pyValue = pad + (topoHeight - marker[1]) * scale;
|
|
225
394
|
elements.push(`<circle cx="${px(pxValue)}" cy="${px(pyValue)}" r="9" fill="#1f4e8c" stroke="white" stroke-width="1.5"/>`);
|
|
395
|
+
boxes.push([pxValue - 10, pyValue - 10, pxValue + 10, pyValue + 10]);
|
|
226
396
|
elements.push(`<text x="${px(pxValue)}" y="${px(pyValue)}" font-size="11" font-family="sans-serif" font-weight="bold" ` +
|
|
227
397
|
`text-anchor="middle" dominant-baseline="central" fill="white">${outlineNumber}</text>`);
|
|
228
398
|
}
|
|
229
399
|
|
|
400
|
+
// The features' names - the areas', then the lines' from the longest line to the shortest, each at its longest piece
|
|
401
|
+
// that has a place for it
|
|
402
|
+
const names = [...areaNames];
|
|
403
|
+
for (const {name, color, pieces} of [...lineNames.values()].sort((line, other) => other.length - line.length)) {
|
|
404
|
+
pieces.sort((piece, other) => other[0] - piece[0]);
|
|
405
|
+
names.push([name, color, pieces.flatMap(([pieceLength, coords]) => linePoints(coords, pieceLength, nameFractions))]);
|
|
406
|
+
}
|
|
407
|
+
elements[ixNames] = featureNames(names, boxes, roadCells, width, height);
|
|
408
|
+
|
|
230
409
|
const svgElement = svgOpen(
|
|
231
410
|
width, height, `Plan view of the ${option.name} road plan option`, `${svgStyle} cursor: crosshair;`, ' class="sageroad-plan"'
|
|
232
411
|
);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="0 0 64 64">
|
|
2
|
+
<title>SageRoad</title>
|
|
3
|
+
<defs>
|
|
4
|
+
<clipPath id="disc"><circle cx="32" cy="32" r="29"/></clipPath>
|
|
5
|
+
<mask id="road"><rect width="64" height="64" fill="#fff"/><path d="M27.2 72.4 L30 70 L32.3 67.5 L34.1 65 L35.5 62.4 L36.5 59.8 L37 57.3 L37.2 54.8 L37.1 52.5 L36.8 50.3 L36.3 48.2 L35.6 46.2 L34.9 44.3 L34.2 42.5 L33.5 40.7 L32.9 39 L32.3 37.3 L31.8 35.7 L31.4 34 L31.3 32.4 L31.3 30.7 L31.6 29 L32.2 27.2 L33.1 25.3 L34.4 23.4 L33.6 22.6 L31.8 24.4 L30.4 26.3 L29.3 28.2 L28.5 30.1 L28 32.1 L27.8 34.2 L27.8 36.2 L27.9 38.2 L28.1 40.2 L28.4 42.1 L28.7 44.1 L29.1 45.9 L29.3 47.7 L29.5 49.4 L29.5 51.1 L29.4 52.6 L29.1 54 L28.7 55.4 L28.1 56.6 L27.3 57.9 L26.2 59.2 L24.8 60.6 L23 62 L20.8 63.6Z" fill="#000"/></mask>
|
|
6
|
+
</defs>
|
|
7
|
+
<g clip-path="url(#disc)" mask="url(#road)">
|
|
8
|
+
<rect width="64" height="64" fill="#adbf9f"/>
|
|
9
|
+
<path d="M0 26 C14 18 24 24 34 21 C44 18 54 16 64 22 V64 H0 Z" fill="#66805d"/>
|
|
10
|
+
</g>
|
|
11
|
+
</svg>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sageroad
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.2
|
|
4
4
|
Summary: SageRoad engineers low-volume roads on USGS lidar terrain and views the resulting road plans
|
|
5
5
|
Author: Craig A. Hobbs
|
|
6
6
|
License-Expression: MIT
|
|
@@ -264,8 +264,9 @@ and cost score, then shows:
|
|
|
264
264
|
- **Plan options** - a comparison of every option's length, maximum grade, cut, fill, net import or
|
|
265
265
|
export, retaining walls, design warnings, and cost score (select an option to view it)
|
|
266
266
|
- **Plan view** - a contour map with the road footprint (cut and fill slopes), structures, station
|
|
267
|
-
ticks, the other options' centerlines, and the outlines of the 3D views.
|
|
268
|
-
|
|
267
|
+
ticks, the other options' centerlines, and the outlines of the 3D views. The site's streams, roads,
|
|
268
|
+
and areas are named where their names fit - clear of each other, the road, and the drawing's labels
|
|
269
|
+
(the longest first). Click it to explore the 3D landscape from that point.
|
|
269
270
|
- **Profile** - the ground and road grade along the road, with cut and fill areas, structures, and
|
|
270
271
|
grades over the maximum highlighted
|
|
271
272
|
- **3D views** - the terrain (with contours) graded to the road's finished surface: the road, cut and
|
|
@@ -14,6 +14,7 @@ src/sageroad.egg-info/requires.txt
|
|
|
14
14
|
src/sageroad.egg-info/top_level.txt
|
|
15
15
|
src/sageroad/static/app.css
|
|
16
16
|
src/sageroad/static/index.html
|
|
17
|
+
src/sageroad/static/sageroad.svg
|
|
17
18
|
src/sageroad/static/lib/app.js
|
|
18
19
|
src/sageroad/static/lib/args.js
|
|
19
20
|
src/sageroad/static/lib/canvas.js
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|