Adds data for fourth floor and a simple parser

This commit is contained in:
nikolark committed 2014-05-24 15:46:26 +02:00
1 parent eddd3eace8
commit b3ee534138
7 files changed
+478 -5

No files matched your search

+24 -3
View File
@@ -1,3 +1,24 @@
- import SVG in blender, draw cube meshes up from each room
- format: https://github.com/mrdoob/three.js/tree/master/utils/exporters/blender
- parser,renderer: three
# Install
npm install
npm install -g browserify
node parse.js >> rooms.json
# TODO doesnt work
browserify -t brfs index.js -o bundle.js
open index.html
# TODO / Plan
- Draw SVG-shapes over PDF maps in Inscape and set id to roomnumber.
- parse SVG into suitable json datastructur (room, coordinates, dimensions)
- render with three.js like described below
# Design
- Black backgrund
- Wireframe of room per floor tagged with name of room
- Highlight room by drawing color semitransparent glowing cube on tob of room floor
- Controller by query param and browser controls
+394
View File
@@ -0,0 +1,394 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
id="svg3004"
version="1.1"
inkscape:version="0.48.4 r9939"
width="1000"
height="1000"
xml:space="preserve"
sodipodi:docname="neuf04_simplified_bare.svg"><metadata
id="metadata3010"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs3008" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1366"
inkscape:window-height="692"
id="namedview3006"
showgrid="false"
inkscape:zoom="1.4030467"
inkscape:cx="865.00952"
inkscape:cy="274.74306"
inkscape:window-x="0"
inkscape:window-y="24"
inkscape:window-maximized="1"
inkscape:current-layer="layer1"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0" /><g
inkscape:groupmode="layer"
id="layer1"
inkscape:label="simplified"
style="display:inline"
transform="translate(-21.057139,264.6204)"><rect
id="447"
width="77.904381"
height="77.731247"
x="53.564445"
y="-158.08394"
inkscape:label="#rect10601"
style="fill:none;stroke:#000000;stroke-width:1.94317281;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /><g
transform="matrix(2.4289661,0,0,-2.4289661,-376.55422,980.35867)"
style="display:inline"
id="424"
inkscape:label="#g11406"><rect
transform="matrix(0.8,0,0,-0.8,0,595.276)"
y="145.57603"
x="208.83124"
height="52.653267"
width="12.561948"
id="rect11400"
style="fill:none;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /><rect
ry="0"
transform="matrix(0.8,0,0,-0.8,0,595.276)"
y="145.39787"
x="221.30411"
height="12.740128"
width="40.09132"
id="rect11404"
style="fill:none;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><rect
style="fill:none;stroke:#000000;stroke-width:1.9521215;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
id="450"
width="36.000183"
height="69.93187"
x="318.01108"
y="-185.0863"
inkscape:label="#rect11410" /><rect
style="fill:none;stroke:#000000;stroke-width:1.95646858;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
id="448"
width="112.169"
height="100.39677"
x="354.71475"
y="-185.08415"
inkscape:label="#rect11412" /><rect
style="fill:none;stroke:#000000;stroke-width:1.94317281;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
id="423"
width="146.80646"
height="101.79505"
x="466.89041"
y="-185.09079"
inkscape:label="#rect11414" /><g
style="display:inline"
id="426"
transform="matrix(2.4059219,0,0,-2.4289661,-195.75846,1062.1318)"
inkscape:label="#g11557"><rect
inkscape:label="#rect11416"
transform="scale(1,-1)"
y="-513.16895"
x="336.41077"
height="27.369009"
width="59.299522"
id="asdf12313123"
style="fill:none;stroke:#000000;stroke-width:0.80000001;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /><g
transform="translate(-70.703277,33.926169)"
inkscape:label="#g11537"
id="426a"><g
id="g6508"
transform="matrix(1,0,0,-1,0,595.276)" /><rect
style="fill:none;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="rect11535"
width="25.302063"
height="16.036528"
x="510.67438"
y="128.64861"
transform="matrix(0.8,0,0,-0.8,0,595.276)" /></g></g><rect
style="fill:none;stroke:#000000;stroke-width:1.92631853;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
id="427"
width="76.190018"
height="45.028267"
x="665.62469"
y="-230.11064"
inkscape:label="#rect11418" /><rect
style="fill:none;stroke:#000000;stroke-width:1.940938;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
id="437"
width="35.318886"
height="291.53769"
x="756.34747"
y="-184.39943"
inkscape:label="#rect11533" /><rect
style="fill:none;stroke:#000000;stroke-width:1.96609926;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
id="428,429"
width="117.69923"
height="146.09106"
x="791.67664"
y="-184.38683"
inkscape:label="#rect11420" /><rect
style="fill:none;stroke:#000000;stroke-width:1.94317281;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
id="430"
width="117.72215"
height="68.555847"
x="793.05017"
y="-36.899376"
inkscape:label="#rect11422" /><rect
style="fill:none;stroke:#000000;stroke-width:1.94317281;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
id="431"
width="118.41465"
height="76.865646"
x="793.05017"
y="30.963974"
inkscape:label="#rect11424" /><rect
style="fill:none;stroke:#000000;stroke-width:1.94317281;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
id="440"
width="118.41465"
height="146.11398"
x="792.3576"
y="107.82961"
inkscape:label="#rect11426" /><rect
style="fill:none;stroke:#000000;stroke-width:2.02009368;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
id="436"
width="35.932209"
height="294.92099"
x="756.38678"
y="107.17565"
inkscape:label="#rect11531" /><rect
style="fill:none;stroke:#000000;stroke-width:1.94317281;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
id="435"
width="117.02967"
height="81.020546"
x="792.3576"
y="321.80695"
inkscape:label="#rect11430" /><rect
style="fill:none;stroke:#000000;stroke-width:1.94317281;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
id="444"
width="72.710747"
height="71.325775"
x="685.02264"
y="474.84579"
inkscape:label="#rect11521" /><g
transform="matrix(2.4289661,0,0,-2.4289661,-376.55422,980.35867)"
style="display:inline"
id="432"
inkscape:label="#g11527"><rect
transform="matrix(0.8,0,0,-0.8,0,595.276)"
y="443.67731"
x="692.42169"
height="52.385998"
width="24.589346"
id="rect11523"
style="fill:none;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /><rect
transform="matrix(0.8,0,0,-0.8,0,595.276)"
y="482.87772"
x="662.13049"
height="38.844028"
width="31.003958"
id="rect11525"
style="fill:none;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><rect
style="fill:none;stroke:#000000;stroke-width:1.94317281;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
id="402"
width="72.710747"
height="44.318932"
x="827.67426"
y="498.39026"
inkscape:label="#rect11432" /><rect
style="fill:none;stroke:#000000;stroke-width:1.93751752;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
id="420"
width="69.047668"
height="115.85214"
x="758.47394"
y="581.2832"
inkscape:label="#rect11436" /><g
id="438"
inkscape:label="#g14922"><rect
y="546.17163"
x="612.31195"
height="35.316593"
width="214.66977"
id="rect11507"
style="fill:none;stroke:#000000;stroke-width:1.94317281;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline" /><rect
y="402.13504"
x="758.4259"
height="96.255173"
width="94.177734"
id="rect11509"
style="fill:none;stroke:#000000;stroke-width:1.94317281;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /><rect
y="477.61569"
x="852.60364"
height="21.466982"
width="58.168594"
id="rect11511"
style="fill:none;stroke:#000000;stroke-width:1.94317281;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /><rect
y="498.73642"
x="758.07959"
height="47.088917"
width="69.248306"
id="rect11597"
style="fill:none;stroke:#000000;stroke-width:1.94317281;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><g
transform="matrix(2.4179901,0,0,-2.414943,-374.06504,978.73312)"
style="display:inline"
id="410"
inkscape:label="#g11464"><rect
transform="matrix(0.8,0,0,-0.8,0,595.276)"
y="537.96735"
x="232.83853"
height="43.342224"
width="39.058411"
id="rect11460"
style="fill:none;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /><rect
transform="matrix(0.8,0,0,-0.8,0,595.276)"
y="581.05762"
x="205.11966"
height="17.639294"
width="77.864838"
id="rect11462"
style="fill:none;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><rect
style="fill:none;stroke:#000000;stroke-width:1.93530822;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
id="411"
width="53.380753"
height="82.557472"
x="22.717258"
y="580.50562"
inkscape:label="#rect11468" /><rect
style="fill:none;stroke:#000000;stroke-width:1.94317281;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
id="403"
width="43.090046"
height="38.193451"
x="152.27817"
y="580.30676"
inkscape:label="#rect11458" /><rect
style="fill:none;stroke:#000000;stroke-width:1.95152652;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
id="409"
width="49.447254"
height="78.540001"
x="195.37247"
y="580.31085"
inkscape:label="#rect11456" /><g
transform="matrix(2.4289661,0,0,-2.4289661,-376.55422,980.35867)"
style="display:inline"
id="408"
inkscape:label="#g11452"><rect
transform="matrix(0.8,0,0,-0.8,0,595.276)"
y="578.78967"
x="282.9845"
height="19.655201"
width="75.344933"
id="rect11448"
style="fill:none;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /><rect
transform="matrix(0.8,0,0,-0.8,0,595.276)"
y="538.21936"
x="319.52301"
height="40.318382"
width="38.806419"
id="rect11450"
style="fill:none;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><rect
style="fill:none;stroke:#000000;stroke-width:1.94428205;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
id="412"
width="589.30219"
height="33.930614"
x="23.009211"
y="546.86469"
inkscape:label="#rect11505" /><rect
style="fill:none;stroke:#000000;stroke-width:1.92605865;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
id="407"
width="75.99839"
height="117.53546"
x="319.73325"
y="580.29822"
inkscape:label="#rect11446" /><rect
style="fill:none;stroke:#000000;stroke-width:1.94317281;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
id="406"
width="70.021324"
height="118.00798"
x="395.63904"
y="580.30676"
inkscape:label="#rect11444" /><rect
style="fill:none;stroke:#000000;stroke-width:1.94317281;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
id="405"
width="146.89789"
height="117.02865"
x="465.17068"
y="580.79633"
inkscape:label="#rect11442" /><rect
style="fill:none;stroke:#000000;stroke-width:1.94317281;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
id="404"
width="76.386887"
height="115.55968"
x="612.0686"
y="581.7757"
inkscape:label="#rect11440" /><rect
style="fill:none;stroke:#000000;stroke-width:1.93188918;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
id="421"
width="70.522224"
height="115.65492"
x="688.44983"
y="581.48309"
inkscape:label="#rect11438" /><rect
style="fill:none;stroke:#000000;stroke-width:1.94532692;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
id="419"
width="80.791679"
height="153.60759"
x="827.03021"
y="543.58331"
inkscape:label="#rect11434" /><rect
style="fill:none;stroke:#000000;stroke-width:1.92396557;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
id="422"
width="34.29538"
height="32.623585"
x="22.019121"
y="108.75488"
inkscape:label="#rect11484" /><rect
style="fill:none;stroke:#000000;stroke-width:1.94317281;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
id="417"
width="105.27682"
height="205.65706"
x="22.518375"
y="141.57167"
inkscape:label="#rect11482" /><g
transform="matrix(2.4289661,0,0,-2.4289661,-376.55422,980.35867)"
style="display:inline"
id="415"
inkscape:label="#g11478"><rect
transform="matrix(0.8,0,0,-0.8,0,595.276)"
y="417.76825"
x="205.37164"
height="28.222853"
width="22.427088"
id="rect11474"
style="fill:none;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /><rect
transform="matrix(0.8,0,0,-0.8,0,595.276)"
y="429.35977"
x="227.54674"
height="16.127344"
width="32.50668"
id="rect11476"
style="fill:none;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><rect
style="fill:none;stroke:#000000;stroke-width:1.94317281;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
id="414"
width="71.490303"
height="43.579708"
x="23.008051"
y="401.58087"
inkscape:label="#rect11472" /><rect
style="fill:none;stroke:#000000;stroke-width:1.94317281;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
id="413"
width="71.490265"
height="102.8285"
x="23.008051"
y="444.6709"
inkscape:label="#rect11470" /></g></svg>

After

Width:  |  Height:  |  Size: 16 KiB

+1
View File
@@ -0,0 +1 @@
{"rooms":[{"number":"447","pos":{"x":"53.564445","y":"-158.08394"},"size":{"height":"77.731247","width":"77.904381"}},{"number":"450","pos":{"x":"318.01108","y":"-185.0863"},"size":{"height":"69.93187","width":"36.000183"}},{"number":"448","pos":{"x":"354.71475","y":"-185.08415"},"size":{"height":"100.39677","width":"112.169"}},{"number":"423","pos":{"x":"466.89041","y":"-185.09079"},"size":{"height":"101.79505","width":"146.80646"}},{"number":"427","pos":{"x":"665.62469","y":"-230.11064"},"size":{"height":"45.028267","width":"76.190018"}},{"number":"437","pos":{"x":"756.34747","y":"-184.39943"},"size":{"height":"291.53769","width":"35.318886"}},{"number":["428","429"],"pos":{"x":"791.67664","y":"-184.38683"},"size":{"height":"146.09106","width":"117.69923"}},{"number":"430","pos":{"x":"793.05017","y":"-36.899376"},"size":{"height":"68.555847","width":"117.72215"}},{"number":"431","pos":{"x":"793.05017","y":"30.963974"},"size":{"height":"76.865646","width":"118.41465"}},{"number":"440","pos":{"x":"792.3576","y":"107.82961"},"size":{"height":"146.11398","width":"118.41465"}},{"number":"436","pos":{"x":"756.38678","y":"107.17565"},"size":{"height":"294.92099","width":"35.932209"}},{"number":"435","pos":{"x":"792.3576","y":"321.80695"},"size":{"height":"81.020546","width":"117.02967"}},{"number":"444","pos":{"x":"685.02264","y":"474.84579"},"size":{"height":"71.325775","width":"72.710747"}},{"number":"402","pos":{"x":"827.67426","y":"498.39026"},"size":{"height":"44.318932","width":"72.710747"}},{"number":"420","pos":{"x":"758.47394","y":"581.2832"},"size":{"height":"115.85214","width":"69.047668"}},{"number":"411","pos":{"x":"22.717258","y":"580.50562"},"size":{"height":"82.557472","width":"53.380753"}},{"number":"403","pos":{"x":"152.27817","y":"580.30676"},"size":{"height":"38.193451","width":"43.090046"}},{"number":"409","pos":{"x":"195.37247","y":"580.31085"},"size":{"height":"78.540001","width":"49.447254"}},{"number":"412","pos":{"x":"23.009211","y":"546.86469"},"size":{"height":"33.930614","width":"589.30219"}},{"number":"407","pos":{"x":"319.73325","y":"580.29822"},"size":{"height":"117.53546","width":"75.99839"}},{"number":"406","pos":{"x":"395.63904","y":"580.30676"},"size":{"height":"118.00798","width":"70.021324"}},{"number":"405","pos":{"x":"465.17068","y":"580.79633"},"size":{"height":"117.02865","width":"146.89789"}},{"number":"404","pos":{"x":"612.0686","y":"581.7757"},"size":{"height":"115.55968","width":"76.386887"}},{"number":"421","pos":{"x":"688.44983","y":"581.48309"},"size":{"height":"115.65492","width":"70.522224"}},{"number":"419","pos":{"x":"827.03021","y":"543.58331"},"size":{"height":"153.60759","width":"80.791679"}},{"number":"422","pos":{"x":"22.019121","y":"108.75488"},"size":{"height":"32.623585","width":"34.29538"}},{"number":"417","pos":{"x":"22.518375","y":"141.57167"},"size":{"height":"205.65706","width":"105.27682"}},{"number":"414","pos":{"x":"23.008051","y":"401.58087"},"size":{"height":"43.579708","width":"71.490303"}},{"number":"413","pos":{"x":"23.008051","y":"444.6709"},"size":{"height":"102.8285","width":"71.490265"}}]}
+17
View File
@@ -0,0 +1,17 @@
<!doctype html>
<html>
<head>
<title>Indoor map of Chateau Neuf</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!--<link rel="stylesheet" href="style.css" type="text/css">-->
<script src="bundle.js"></script>
</head>
<body>
<div class="map"></div>
</body>
</html>
-1
View File
@@ -1 +0,0 @@
// Ref: http://education-eco.blogspot.no/2014/02/venueindoor-map-using-d3js-and-geojson.html
+3 -1
View File
@@ -9,6 +9,8 @@
"author": "",
"license": "BSD-2-Clause",
"dependencies": {
"three": "~0.66.2"
"three": "~0.66.2",
"libxml-to-js": "~0.3.11",
"brfs": "~1.1.1"
}
}
+39
View File
@@ -0,0 +1,39 @@
// Ref: http://education-eco.blogspot.no/2014/02/venueindoor-map-using-d3js-and-geojson.html
var util = require("util"),
fs = require("fs"),
parser = require('libxml-to-js');
var xml = fs.readFileSync(__dirname + "/data/neuf04.svg", "utf-8");
parser(xml, function (err, result) {
if (err) { throw err; }
var width = result['@'].width;
var height = result['@'].height;
// rooms
var g = result.g.rect;
var rooms = [];
Object.keys(g).forEach(function(key) {
var r = g[key]['@'];
var number = r.id;
// more than one room number per shape?
if(r.id.indexOf(',') > -1) {
number = r.id.split(",");
}
rooms.push({
number: number,
pos: {
x: r.x,
y: r.y
},
size: {
height: r.height,
width: r.width,
}
});
});
fs.writeFileSync(__dirname + "/data/rooms.json", JSON.stringify({rooms: rooms}), "utf-8");
});