Skip to content

Commit

Permalink
wtf... hardlink madness
Browse files Browse the repository at this point in the history
  • Loading branch information
Tie-fighter committed Apr 14, 2011
1 parent a08a99a commit 06a62a0
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 111 deletions.
71 changes: 0 additions & 71 deletions banditvis.js

This file was deleted.

92 changes: 67 additions & 25 deletions interactive/banditvis.js
@@ -1,29 +1,71 @@
<!-- This file is part of the project Banditvis and licensed under GNU LGPL. -->

var map;
function init(){
map = new OpenLayers.Map('map');
var osm = new OpenLayers.Layer.OSM("OpenStreetMaps");
map.addLayer(osm);

map.setCenter(
new OpenLayers.LonLat(10.75, 49.1).transform(
new OpenLayers.Projection("EPSG:4326"),
map.getProjectionObject()
), 2
);
map.addControl(new OpenLayers.Control.LayerSwitcher());

data_layers = load_data();
for(i in data_layers){
map.addLayer(data_layers[i]);
}
var map, dataLayers, debug;

function init(){
map = new OpenLayers.Map('map');
var osm = new OpenLayers.Layer.OSM("OpenStreetMaps");
map.addLayer(osm);

map.setCenter(
new OpenLayers.LonLat(10.75, 49.1).transform(
new OpenLayers.Projection("EPSG:4326"),
map.getProjectionObject()
), 2
);
map.addControl(new OpenLayers.Control.LayerSwitcher());

debug = document.getElementById("debug");

loadData();

dataLayers[1].events.on({
'featureselected': function(evt) { showPopup(evt.feature) },
'featureunselected': function(evt) { evt.feature.popup.destroy() }
});

hover = new OpenLayers.Control.SelectFeature(dataLayers, {multiple: true, toggle: true});
map.addControl(hover);
hover.activate(true);

}

function loadData() {
dataLayers = new Array();
dataLayers.push(new OpenLayers.Layer.GML("Server", "server.kml", {format: OpenLayers.Format.KML}));
dataLayers.push(new OpenLayers.Layer.GML("ssh", "output/ssh.kml", {format: OpenLayers.Format.KML}));
<!-- more data here -->

for(i in dataLayers){
map.addLayer(dataLayers[i]);
}

function load_data() {
data_layers = new Array();
data_layers.push(new OpenLayers.Layer.GML("Server", "server.kml", {format: OpenLayers.Format.KML}));
data_layers.push(new OpenLayers.Layer.GML("ssh jail", "output/data.kml", {format: OpenLayers.Format.KML}));
return data_layers;
}
return;
}

function showPopup(feature) {
console.log(feature);
feature.popup = new OpenLayers.Popup(null, feature.geometry.getBounds().getCenterLonLat(), new OpenLayers.Size(50, 20), providePopupContent(feature), false, null);
feature.popup.autoSize = true;
feature.popup.displayClass = "Popup";
feature.popup.contentDisplayClass = "PopupContent";
feature.popup.setBorder("1px solid black");
feature.popup.setOpacity(0.7);
map.addPopup(feature.popup);
feature.popup.show();
return;
}

function providePopupContent(feature) {

match = feature.data.description.search("offence: (.*?), count: (.*?), last_seen: (.*)");
if (match == -1) {
console.log("Regex failed");
content = "<h3>" + feature.data.name + "</h3><p>" + feature.data.description + "</p>";
} else {
content = "<h3>" + feature.data.name + "</h3><p>Offence: " + RegExp.$1 + "<br/>Count: " + RegExp.$2 + "<br/>Last time seen: " + RegExp.$3 + "</p>";
console.log(feature.data.description);
console.log(content);
}

return content;
}
6 changes: 4 additions & 2 deletions interactive/map.htm
Expand Up @@ -3,9 +3,11 @@
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<title>Banditvis - Interactive</title>
<script src="http://openlayers.org/api/OpenLayers.js"></script>
<script src="banditvis.js"></script>
<link rel="stylesheet" type="text/css" href="banditvis.css">
<script type="text/javascript" src="http://openlayers.org/api/OpenLayers.js"></script>
<script type="text/javascript" src="banditvis.js"></script>
<body onload="init()">
<div id="map"></div>
<div id="debug"></div>
</body>
</html>
13 changes: 0 additions & 13 deletions map.htm

This file was deleted.

0 comments on commit 06a62a0

Please sign in to comment.