Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Alfakhori
M4labplatform
Commits
0081cef7
Commit
0081cef7
authored
Nov 16, 2020
by
Patrick
Browse files
delete the planner
parent
4dae3afa
Changes
2
Hide whitespace changes
Inline
Side-by-side
serveralternative.js
0 → 100644
View file @
0081cef7
const
http
=
require
(
'
http
'
);
const
fs
=
require
(
'
fs
'
);
const
express
=
require
(
'
express
'
)
const
app
=
express
();
const
bodyParser
=
require
(
'
body-parser
'
)
const
soap
=
require
(
'
soap
'
);
app
.
use
(
bodyParser
.
urlencoded
({
extended
:
false
}))
app
.
use
(
bodyParser
.
json
())
const
request
=
require
(
'
ajax-request
'
);
app
.
use
(
express
.
static
(
'
vcm
'
));
app
.
listen
(
process
.
env
.
PORT
||
8083
);
console
.
log
(
"
on 8083
"
);
var
IDGeojson
=
100000
var
ballonContent
=
{
header
:
"
Test
"
,
Content
:
"
This is a test
"
,
lat
:
""
,
lon
:
""
,
categorie
:
"
locationSM.png
"
}
app
.
post
(
'
/newBallon
'
,
function
(
req
,
res
){
try
{
const
data
=
req
.
body
;
console
.
log
(
"
data ==============
"
)
console
.
log
(
data
.
header
);
console
.
log
(
data
.
Content
);
console
.
log
(
data
.
lat
);
console
.
log
(
data
.
lon
);
console
.
log
(
data
.
categorie
);
ballonContent
.
header
=
data
.
header
;
ballonContent
.
Content
=
data
.
Content
;
ballonContent
.
lat
=
data
.
lat
;
ballonContent
.
lon
=
data
.
lon
;
ballonContent
.
categorie
=
data
.
categorie
;
console
.
log
(
"
args ==============
"
)
// console.log(args);
//asdf
// const returnedTarget = Object.assign(args.ui,data);
// args.ui = data;
// args.gmlid = data.id;
// console.log("returned ==============")
// console.log(returnedTarget)
// console.log("args ==============")
// console.log(args);
getCurrentFilenames
();
writeGeojsonFile
();
writeConfigFile
();
res
.
end
(
'
It worked!
'
);
}
catch
(
err
)
{
console
.
log
(
'
.../getSimS failed!
\n
'
+
err
);
}
});
// List all the filenames before renaming
function
getCurrentFilenames
()
{
console
.
log
(
"
Current filenames:
"
);
fs
.
readdirSync
(
__dirname
+
'
/vcm/templates
'
).
forEach
(
file
=>
{
if
(
file
.
includes
(
'
.geojson
'
)){
var
tempid
=
file
.
replace
(
'
.geojson
'
,
''
)
// console.log(tempid)
if
(
isNaN
(
tempid
)
==
false
){
var
tempid
=
parseInt
(
tempid
,
10
);
if
(
tempid
>=
IDGeojson
){
IDGeojson
=
tempid
console
.
log
(
"
this one -
"
+
IDGeojson
)
}
}
else
{
console
.
log
(
"
not this one -
"
+
tempid
)
}
}
// console.log(file);
});
IDGeojson
+=
1
}
function
writeGeojsonFile
()
{
var
geojsontemplate
=
'
{
'
+
'
"type": "FeatureCollection",
'
+
'
"name": "data_point",
'
+
'
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
'
+
'
"features": [
'
+
'
{ "type": "Feature", "properties": { "id": null, "name": "datapoint" }, "geometry": { "type": "Point", "coordinates": [
'
+
ballonContent
.
lon
+
'
,
'
+
ballonContent
.
lat
+
'
] } }
'
+
'
]
'
+
'
}
'
console
.
log
(
geojsontemplate
);
try
{
console
.
log
(
geojsontemplate
);
fs
.
writeFile
(
__dirname
+
"
/vcm/templates/
"
+
IDGeojson
+
'
.geojson
'
,
geojsontemplate
,
function
(
err
)
{
if
(
err
)
throw
err
;
console
.
log
(
'
Saved!
'
);
});
}
catch
(
err
)
{
console
.
error
(
err
);
}
}
function
writeConfigFile
(){
// name of the file
var
filename
=
'
vcm/config.json
'
;
var
contentSync
=
fs
.
readFileSync
(
filename
);
console
.
log
(
'
Content of the file :
'
+
contentSync
);
console
.
log
(
contentSync
.
includes
(
'
"balloonTypes":
'
));
var
newtext
=
contentSync
.
toString
().
replace
(
'
"layers": [
'
,
'
"layers": [
'
+
'
{
'
+
'
"name": "
'
+
IDGeojson
+
'
",
'
+
'
"url": "./templates/
'
+
IDGeojson
+
'
.geojson",
'
+
'
"type": "vcs.vcm.layer.GeoJSON",
'
+
'
"datasourceId": "...",
'
+
'
"activeOnStartup": true,
'
+
'
"exclusive": false,
'
+
'
"projection": {
'
+
'
"epsg": "4326",
'
+
'
"proj4": ""
'
+
'
},
'
+
'
"altitudeMode": "relativeToGround",
'
+
'
"style": {
'
+
'
"image": {
'
+
'
"icon": {
'
+
'
"src": "./templates/
'
+
ballonContent
.
categorie
+
'
",
'
+
'
"scale": 0.5
'
+
'
}
'
+
'
}
'
+
'
},
'
+
'
"heightAboveGround": 0
'
+
'
},
'
)
var
ballonText
=
"
\"
balloonTypes
\"
: [
"
+
"
{
"
+
"
\"
template
\"
: [
"
+
"
\"
<div class='balloon' onclick='' id='myBalloon'>
\"
,
"
+
"
\"
<h1 class='balloon-title'>
"
+
ballonContent
.
header
+
"
</h1>
\"
,
"
+
"
\"
<div class='balloon-content' style='height:290px; margin-right: 0px;'
\"
,
"
+
"
\"
</div>
\"
,
"
+
"
\"
<p class='balloon-text'><span>
"
+
ballonContent
.
Content
+
"
</span><br></p>
\"
,
"
+
// "\"<img style='padding-top:10px' src='images/content/contentboeckingerstrasse/station3_outdoorkiosk1.jpg' alt='Simply Easy Learning' width='375'>\"," +
"
\"
</div>
\"
,
"
+
"
\"
<% %>
\"
"
+
// "\"<% openquestionaire() %>\"" +
"
],
"
+
"
\"
minTop
\"
:
\"
balloonHeight + 10
\"
,
"
+
"
\"
minLeft
\"
:
\"
70
\"
,
"
+
"
\"
layerTypes
\"
: [
"
+
"
\"\"
"
+
"
],
"
+
"
\"
layerNames
\"
: [
"
+
"
\"
"
+
IDGeojson
+
"
\"
"
+
"
]
"
+
"
},
"
var
newtext
=
newtext
.
toString
().
replace
(
"
\"
balloonTypes
\"
: [
"
,
ballonText
)
console
.
log
(
newtext
);
fs
.
writeFile
(
filename
,
newtext
,
'
utf8
'
,
function
(
err
)
{
if
(
err
)
return
console
.
log
(
err
);
});
}
function
writeBallon
()
{
var
ballonText
=
"
{
"
+
"
\"
template
\"
: [
"
+
"
\"
<div class='balloon' onclick='showtourSpecific()' id='myBalloon'>
\"
,
"
+
"
\"
<h1 class='balloon-title'>Station 3</h1>
\"
,
"
+
"
\"
<div class='balloon-content' style='height:290px; margin-right: 0px;'
\"
,
"
+
"
\"
</div>
\"
,
"
+
"
\"
<p class='balloon-text'><span>hier wurde eine Outdoorkiosk errichtet.</span><br></p>
\"
,
"
+
"
\"
<img style='padding-top:10px' src='images/content/contentboeckingerstrasse/station3_outdoorkiosk1.jpg' alt='Simply Easy Learning' width='375'>
\"
,
"
+
"
\"
</div>
\"
,
"
+
"
\"
<% %>
\"
,
"
+
"
\"
<% openquestionaire() %>
\"
"
+
"
],
"
+
"
\"
minTop
\"
:
\"
balloonHeight + 10
\"
,
"
+
"
\"
minLeft
\"
:
\"
70
\"
,
"
+
"
\"
layerTypes
\"
: [
"
+
"
\"\"
"
+
"
],
"
+
"
\"
layerNames
\"
: [
"
+
"
\"
LocationThree
\"
"
+
"
]
"
+
"
},
"
}
\ No newline at end of file
vcm/config.json
View file @
0081cef7
...
...
@@ -754,15 +754,7 @@
"showCompass"
:
true
,
"rotationPerFrame"
:
0.5
},
{
"useLocalCRS"
:
false
,
"type"
:
"vcs.vcm.widgets.Planning"
,
"serviceUrl"
:
"http://smartvillages.online/"
,
"projectId"
:
"Q4at5xXnP93Erwtm5"
,
"scenarioId"
:
"2JQ3od8igw4LRzTR5"
,
"userLocalCRS"
:
true
},
{
{
"type"
:
"vcs.vcm.widgets.OverviewMap"
,
"name"
:
"Overview Map"
,
"layerName"
:
"Openstreetmap layer"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment