mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 05:30:35 +02:00
add number of nodes information to measurement panel
This commit is contained in:
@@ -318,6 +318,7 @@ en:
|
||||
location: Location
|
||||
metric: Metric
|
||||
imperial: Imperial
|
||||
node_count: Number of nodes
|
||||
geometry:
|
||||
point: point
|
||||
vertex: vertex
|
||||
|
||||
Vendored
+2
-1
@@ -397,7 +397,8 @@
|
||||
"centroid": "Centroid",
|
||||
"location": "Location",
|
||||
"metric": "Metric",
|
||||
"imperial": "Imperial"
|
||||
"imperial": "Imperial",
|
||||
"node_count": "Number of nodes"
|
||||
}
|
||||
},
|
||||
"geometry": {
|
||||
|
||||
@@ -42,6 +42,14 @@ export function uiPanelMeasurement(context) {
|
||||
return result;
|
||||
}
|
||||
|
||||
function nodeCount(feature) {
|
||||
if (feature.type === 'LineString') return feature.coordinates.length;
|
||||
|
||||
if (feature.type === 'Polygon') {
|
||||
return feature.coordinates[0].length - 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function displayLength(m) {
|
||||
var d = m * (isImperial ? 3.28084 : 1),
|
||||
@@ -170,6 +178,15 @@ export function uiPanelMeasurement(context) {
|
||||
(closed ? t('info_panels.measurement.closed') + ' ' : '') + t('geometry.' + geometry)
|
||||
);
|
||||
|
||||
if (entity.type !== 'relation') {
|
||||
list
|
||||
.append('li')
|
||||
.text(t('info_panels.measurement.node_count') + ':')
|
||||
.append('span')
|
||||
.text(nodeCount(feature)
|
||||
);
|
||||
}
|
||||
|
||||
if (closed) {
|
||||
var area = steradiansToSqmeters(entity.area(resolver));
|
||||
list
|
||||
@@ -179,6 +196,7 @@ export function uiPanelMeasurement(context) {
|
||||
.text(displayArea(area));
|
||||
}
|
||||
|
||||
|
||||
list
|
||||
.append('li')
|
||||
.text(lengthLabel + ':')
|
||||
@@ -193,7 +211,6 @@ export function uiPanelMeasurement(context) {
|
||||
centroid[1].toFixed(OSM_PRECISION) + ', ' + centroid[0].toFixed(OSM_PRECISION)
|
||||
);
|
||||
|
||||
|
||||
var toggle = isImperial ? 'imperial' : 'metric';
|
||||
|
||||
selection
|
||||
|
||||
Reference in New Issue
Block a user