• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Beakerboy / OSMBuilding / 9053462394

12 May 2024 06:36PM UTC coverage: 12.331% (-0.04%) from 12.37%
9053462394

push

github

web-flow
Update multibuildingpart.js

7 of 14 branches covered (50.0%)

Branch coverage included in aggregate %.

0 of 2 new or added lines in 1 file covered. (0.0%)

5 existing lines in 1 file now uncovered.

184 of 1535 relevant lines covered (11.99%)

0.14 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/multibuildingpart.js
1
import {BuildingShapeUtils} from './extras/BuildingShapeUtils.js';
×
2
import {BuildingPart} from './buildingpart.js';
×
3
/**
×
4
 * An OSM Building Part
×
5
 *
×
6
 * A building part includes a main building and a roof.
×
7
 */
×
8
class MultiBuildingPart extends BuildingPart {
×
9

×
10
  buildShape() {
×
11
    this.type = 'multipolygon';
×
12
    const innerMembers = this.way.querySelectorAll('member[role="inner"]');
×
13
    const outerMembers = this.way.querySelectorAll('member[role="outer"]');
×
14
    const innerShapes = [];
×
15
    var shapes = [];
×
16
    window.printError('Inner members: ' + innerMembers.length);
×
17
    for (let i = 0; i < innerMembers.length; i++) {
×
18
      const way = this.fullXmlData.getElementById(innerMembers[i].getAttribute('ref'));
×
19
      innerShapes.push(BuildingShapeUtils.createShape(way, this.nodelist));
×
20
    }
×
21
    window.printError('Outer members: ' + outerMembers.length);
×
22
    const ways = [];
×
23
    for (let j = 0; j < outerMembers.length; j++) {
×
24
      const way = this.fullXmlData.getElementById(outerMembers[j].getAttribute('ref'));
×
25
      ways.push(way);
×
26
    }
×
27
    const closedWays = BuildingShapeUtils.combineWays(ways);
×
NEW
28
    for (let k = 0; k < closedWays.length; k++) {
×
NEW
29
      const shape = BuildingShapeUtils.createShape(closedWays[k], this.nodelist);
×
30
      shape.holes.push(...innerShapes);
×
31
      shapes.push(shape);
×
32
    }
×
33
    if (outerMembers.length === 1) {
×
34
      return shapes[0];
×
35
    }
×
36
    // Multiple outer members
×
37
    return shapes;
×
38
  }
×
39

×
40
  getWidth() {
×
41
    var xy = [[], []];
×
42
    for (let i = 0; i < this.shape.length; i++){
×
43
      const shape = this.shape[i];
×
44
      const newXy = BuildingShapeUtils.combineCoordinates(shape);
×
45
      xy[0] = xy[0].concat(newXy[0]);
×
46
      xy[1] = xy[1].concat(newXy[1]);
×
47
    }
×
48

×
49
    const x = xy[0];
×
50
    const y = xy[1];
×
51
    window.printError('Multibuilding x: ' + x);
×
52
    window.printError('Multibuilding y: ' + y);
×
53
    const widths = Math.max(Math.max(...x) - Math.min(...x), Math.max(...y) - Math.min(...y));
×
UNCOV
54
    window.printError('Multibuilding Width: ' + widths);
×
UNCOV
55
    return widths;
×
UNCOV
56
  }
×
UNCOV
57
}
×
UNCOV
58
export {MultiBuildingPart};
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc