Hello!
I'm new to JavaScript and want to build a web application, which displays 3D shapes on a map using Cesium.
If I understand correctly, Cesium is a Node.js application. In my Node.js directory, I have the file `Apps/HelloWorld.html`, which renders the map:
<html lang="en">
<head>
[...]
</head>
<body>
<div id="cesiumContainer"></div>
<script>
var viewer = new Cesium.Viewer('cesiumContainer',
{
timeline: false,
animation: false,
sceneMode: Cesium.SceneMode.COLUMBUS_VIEW
});
var center = Cesium.Cartesian3.fromDegrees(132.159633, 43.350116);
var heading = Cesium.Math.toRadians(0);
var pitch = Cesium.Math.toRadians(-40.0);
var range = 1000.0;
viewer.camera.lookAt(center, new Cesium.HeadingPitchRange(heading, pitch, range));
var blueBox = viewer.entities.add({
name : 'Blue box',
position: Cesium.Cartesian3.fromDegrees(132.159633, 43.350116, 1000.0),
box : {
dimensions : new Cesium.Cartesian3(4000.0, 3000.0, 5000.0),
material : Cesium.Color.BLUE
}
});
</script>
</body>
</html>
This code simply puts a blue box on the map. I want to display not one box, but several others.
Let's assume that I have a Java server (based on Apache CXF), which knows, which shapes I want to display on that map. I want to re-use that code (don't want to re-implement everything in JavaScript). The Java server understands JSON.
Is it OK (good practice), if I put the code for calling Java server into `Apps/HelloWorld.html` and do something like this in that file:
var shapeRecs = javaServer.getData();
for (var shapeRec in shapeRecs) {
putOnMap(shapeRec);
}
In other words: Is the code for interacting with the Java server supposed to be put into `Apps/HelloWorld.html` or somewhere else (a separate Node.js app maybe?) ?
Thanks in advance and sorry for the stupid question.
Best regards
Dmitri Pisarenko