This file is indexed.

/usr/share/games/flightgear/Phi/topics/Map/RouteLayer.js is in flightgear-phi 2016.4.2+dfsg1-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
(function(factory) {
    if (typeof define === "function" && define.amd) {
        // AMD. Register as an anonymous module.
        define([
                'leaflet', 'props', './MapIcons', 'knockout', 'geodesic'
        ], factory);
    } else {
        // Browser globals
        factory();
    }
}(function(leaflet, SGPropertyNode, MAP_ICON, ko) {

    leaflet.RouteLayer = leaflet.GeoJSON.extend({
        options : {

            style : function(feature) {
                if (feature.geometry.type == "LineString")
                    return {
                        'color' : '#4d56db',
                        'lineCap' : 'round',
                        'dashArray' : '20,10,5,5,5,10',
                        'weight' : '2',
                    }
            },
        },
        onAdd : function(map) {
            var self = this;
            leaflet.GeoJSON.prototype.onAdd.call(self, map);
            self.waypointCount = ko.observable(0).extend({
                observedProperty : '/autopilot/route-manager/route/num'
            });
            self.waypointCountSubscription = self.waypointCount.subscribe(function() {
                self.update();
            });

            self.geodesic = L.geodesic([], {
                weight: 5,
                opacity: 0.5,
                color: 'blue',
                steps: 20,
            }).addTo(map);
        },

        onRemove : function(map) {
            var self = this;
            self.waypointCountSubscription.dispose();
            self.waypointCount.dispose();
            map.removeLayer(self.geodesic);
            leaflet.GeoJSON.prototype.onRemove.call(this, map);
        },

        stop : function() {
            if (this.waypointCountSubscription) {
                this.waypointCountSubscription.dispose();
                this.waypointCount.dispose();
            }
        },

        update : function(id) {
            var self = this;

            var url = "/json/autopilot/route-manager/route?d=3";
            var jqxhr = $.get(url).done(function(data) {
                self.clearLayers();
                var geoJSON = self.routePropsToGeoJson(data);
                if (geoJSON) {
                    self.addData(geoJSON);
                    var latlngs = [];
                    geoJSON.features.forEach( function(f) {
                        if( f.geometry && f.geometry.coordinates )
                            latlngs.push( new L.LatLng(f.geometry.coordinates[1], f.geometry.coordinates[0] ) );
                    });
                    self.geodesic.setLatLngs([latlngs]);
                }
            }).fail(function(a, b) {
                // self.stop(); // TODO: Should we?
                alert('failed to load RouteManager data');
            }).always(function() {
            });
        },

        routePropsToGeoJson : function(props) {
            var geoJSON = {
                type : "FeatureCollection",
                features : [],
            };

            var root = new SGPropertyNode(props);
            root.getChildren("wp").forEach(function(wp) {
                var id = wp.getNode("id");
                var lon = wp.getNode("longitude-deg").getValue();
                var lat = wp.getNode("latitude-deg").getValue();

                var position = [
                        lon, lat
                ];

                geoJSON.features.push({
                    "type" : "Feature",
                    "geometry" : {
                        "type" : "Point",
                        "coordinates" : position,
                    },
                    "id" : id,
                    "properties" : {},
                });
            });

            if (geoJSON.features.length >= 2)
                return geoJSON;
        },

    });

    leaflet.routeLayer = function(options) {
        return new leaflet.RouteLayer(null, options);
    }

}));