-
Notifications
You must be signed in to change notification settings - Fork 12
RESTful API
The users can use InFactory regardless of the development environment via RESTful API of InFactory. RESTful API is based on CRUD function on IndoorGML complex features. Users can create IndoorGML by writing their own indoor space information according to the predefined JSON(Javascript Object Notation) based form. Please note that the current version of InFactory supports one user per each InFactory server instance.
All IndoorGML complex features can be represented by this JSON format. The details are described at JSON-format
First of all, the users need to implement their own client program which sends HTTP requests to the server. If there is no client program, it is recommended to use InSomnia, which is a debugging tool for RESTful API by by communicating HTTP request to the server program.
- POST: Request to create a new entity including a document and features in IndoorGML
- GET: Retrieve information from InFactory server.
- PUT: Request to update the existing entity. InFactory supports fully-patched Update.
- DELETE: Request to remove a resource; however, the resource does not have to be removed immediately.
- Quick start for POST, GET, PUT, DELETE
- The form of the HTTP request including the form of url, body, and the response code.
- The sample code based on HTML and Javascript. Copy and paste it at a blank file, save it, and open it.
After installing InFactory as explained in Readme, you have to make the InFactory server ready to receive the HTTP requests from your client.
$ mvn clean install
$ mvn jetty:run "-Djetty.port=9797"
You can create an IndoorGML document by sending a set of HTTP requests to the InFactory server. The creation procedure is in general composed of the following steps;
- Step 1: Creating IndoorGML document (POST request)
- Step 2: Creating IndoorGML Features (POST request)
- Step 3: Downloading IndoorGML document (GET request)
The detail for step 1 and 2 is described at the section 3.POST and the detail for step 3 is described at the section 4.GET.
First of all, you have to give the name of IndoorGML document as a URL, for example, http://localhost:9797/documents/doc1
. Although the users of InFactory do not need to care the sequence of feature creations and the IndoorGML class hierarchy, the key features shown in figure 1 should not be missing anyway.
IndoorFeatures
|-> PrimalSpaceFeatures
|-> CellSpace
|-> CellSpaceBoundary
|-> MultiLayeredGraph -> SpaceLayers -> SpaceLayer
|-> Nodes -> State
|-> Edges -> Transition
Figure 1. Basic IndoorGML Hierarchical Structure
When the users send GET request to the InFactory server, the server generates the IndoorGML document by arranging the hierarchical structure of the document.
Before creating the features of IndoorGML, the users need to create the instance of IndoorGML document at the server of InFactory first. When the server of InFactory creats the IndoorGML document, the identifier of the document is needed. Usually the name of the IndoorGML document is used as the identifier of the document.
http://{baseurl}/documents/{id}
-
{id}
: alphanumeric id which starts as a alphabet
$ POST http://localhost:9797/documents/doc1
- Status : 201 CREATED / 404 NOT FOUND
- Content-Type : None
<!DOCTYPE html>
<html>
<body>
<h2>The XMLHttpRequest Object</h2>
<button type="button" onclick="loadDoc()">Request data</button>
<p id="demo"></p>
<script>
function loadDoc() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 201) {
document.getElementById("demo").innerHTML = this.responseText;
}
};
var url = 'http://localhost:9797/documents/doc1';
var contentType = 'application/json';
var data = {
"docId":"doc1"
}
xhttp.open("POST", url, true);
xhttp.setRequestHeader("Content-type", contentType);
xhttp.send(JSON.stringify(data));
}
</script>
</body>
</html>
After the instance of the IndoorGML document is created at the server of InFactory, the features including Indoorfeatures feature can be created. In this part, how to send the request for creating IndoorFeatures will be described. The other features such as PrimalSpaceFeatures and CellSpace can be created similar with creating Indoorfeatures. The example of creating those two types of features are also introduced at the section 3.3 and 3.4.
https://{baseurl}/documents/{docId}/indoorfeatures/{id}
-
{docId}
: alphanumeric id which starts as a alphabet -
{id}
: alphanumeric id which starts as a alphabet
$ POST http://localhost:9797/documents/doc1/indoorfeatures/If1
- Content-Type : "application/json"
- Accept : "application/json"
- The content of the body
{
"docId":"doc1",
"id":"If1"
}
- Status : 201 created / 404 NOT FOUND
- Content-Type : None
https://{baseurl}/documents/{docId}/primalspacefeatures/{id}
-
{docId}
: alphanumeric id which starts as a alphabet -
{id}
: alphanumeric id which starts as a alphabet
$ POST http://localhost:9797/documents/doc1/primalspacefeatures/psf1
- Content-Type : "application/json"
- Accept : "application/json"
- The content of the body
{
"docId":"doc1",
"parentId":"If1",
"id":"psf1"
}
- Status : 201 created / 404 NOT FOUND
- Content-Type : None
https://{baseurl}/documents/{docId}/cellspace/{id}
-
{docId}
: alphanumeric id which starts as a alphabet -
{id}
: alphanumeric id which starts as a alphabet
$ POST http://localhost:9797/documents/doc1/cellspace/C1
- Content-Type : "application/json"
- Accept : "application/json"
- The content of the body
{
"id":"C1",
"parentId":"psf1",
"docId":"doc1",
"type":"CellSpace",
"geometry":{
"type":"Solid",
"coordinates":"SOLID ((((53.24976683924437 233.87626224093967 20, 52.72066631014385 174.43181779649524 20, 127.85294144241898 177.209595574273 20, 126.79474038421792 233.87626224093967 20, 53.24976683924437 233.87626224093967 20)), ((53.24976683924437 233.87626224093967 0, 52.72066631014385 174.43181779649524 0, 52.72066631014385 174.43181779649524 20, 53.24976683924437 233.87626224093967 20, 53.24976683924437 233.87626224093967 0)), ((52.72066631014385 174.43181779649524 0, 127.85294144241898 177.209595574273 0, 127.85294144241898 177.209595574273 20, 52.72066631014385 174.43181779649524 20, 52.72066631014385 174.43181779649524 0)), ((127.85294144241898 177.209595574273 0, 126.79474038421792 233.87626224093967 0, 126.79474038421792 233.87626224093967 20, 127.85294144241898 177.209595574273 20, 127.85294144241898 177.209595574273 0)), ((126.79474038421792 233.87626224093967 0, 53.24976683924437 233.87626224093967 0, 53.24976683924437 233.87626224093967 20, 126.79474038421792 233.87626224093967 20, 126.79474038421792 233.87626224093967 0)), ((53.24976683924437 233.87626224093967 0, 126.79474038421792 233.87626224093967 0, 127.85294144241898 177.209595574273 0, 52.72066631014385 174.43181779649524 0, 53.24976683924437 233.87626224093967 0))))",
"properties":{
"id":"CG-C1",
"type":"wkt",
"extrude":"true"
}
},
"properties":{
"name":"C1",
"description":"storey=\"F1\":",
"partialboundedBy":["B1-REVERSE"],
"duality":"S1",
"height":"20",
"bottom":0
}
}
$ POST http://localhost:9797/documents/doc1/cellspace/C2
{
"id":"C2",
"parentId":"psf1",
"docId":"doc1",
"type":"CellSpace",
"geometry":{
"type":"Solid",
"coordinates":"SOLID ((((52.72066631014385 174.43181779649524 20, 53.778867368344905 120.54292890760634 20, 127.32384091331845 122.20959557427301 20, 127.85294144241898 177.209595574273 20, 52.72066631014385 174.43181779649524 20)), ((52.72066631014385 174.43181779649524 0, 53.778867368344905 120.54292890760634 0, 53.778867368344905 120.54292890760634 20, 52.72066631014385 174.43181779649524 20, 52.72066631014385 174.43181779649524 0)), ((53.778867368344905 120.54292890760634 0, 127.32384091331845 122.20959557427301 0, 127.32384091331845 122.20959557427301 20, 53.778867368344905 120.54292890760634 20, 53.778867368344905 120.54292890760634 0)), ((127.32384091331845 122.20959557427301 0, 127.85294144241898 177.209595574273 0, 127.85294144241898 177.209595574273 20, 127.32384091331845 122.20959557427301 20, 127.32384091331845 122.20959557427301 0)), ((127.85294144241898 177.209595574273 0, 52.72066631014385 174.43181779649524 0, 52.72066631014385 174.43181779649524 20, 127.85294144241898 177.209595574273 20, 127.85294144241898 177.209595574273 0)), ((52.72066631014385 174.43181779649524 0, 127.85294144241898 177.209595574273 0, 127.32384091331845 122.20959557427301 0, 53.778867368344905 120.54292890760634 0, 52.72066631014385 174.43181779649524 0))))",
"properties":{
"id":"CG-C2",
"type":"wkt",
"extrude":"true"}
},
"properties":{
"name":"C2",
"description":"storey=\"F1\":",
"partialboundedBy":["B1"],
"duality":"S2",
"height":"20",
"bottom":0}
}
- Status : 201 created / 404 NOT FOUND
- Content-Type : None
<!DOCTYPE html>
<html>
<body>
<h2>The XMLHttpRequest Object</h2>
<button type="button" onclick="loadDoc()">Request data</button>
<p id="demo"></p>
<script>
function loadDoc() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 201) {
document.getElementById("demo").innerHTML = this.responseText;
}
};
var url = 'http://localhost:9797/documents/doc1/cellspace/C1';
var contentType = 'application/json';
var data = {
"docId":"doc1",
"parentId":"psf1",
"id":"C1",
"geometry": {
"type" : "Solid",
"coordinates" : "SOLID (( ((0 0 0, 0 1 0, 1 1 0, 1 0 0, 0 0 0)), ((0 0 0, 0 1 0, 0 1 1, 0 0 1, 0 0 0)), ((0 0 0, 1 0 0, 1 0 1, 0 0 1, 0 0 0)), ((1 1 1, 1 0 1, 0 0 1, 0 1 1, 1 1 1)), ((1 1 1, 1 0 1, 1 0 0, 1 1 0, 1 1 1)), ((1 1 1, 1 1 0, 0 1 0, 0 1 1, 1 1 1)) ))",
"properties" : {
"id" : "c1g",
"type" : "wkt"
}
}
}
xhttp.open("POST", url, true);
xhttp.setRequestHeader("Content-type", contentType);
xhttp.send(JSON.stringify(data));
}
</script>
</body>
</html>
https://{baseurl}/documents/{docId}/cellspaceboundary/{id}
-
{docId}
: alphanumeric id which starts as a alphabet -
{id}
: alphanumeric id which starts as a alphabet
$ POST http://localhost:9797/documents/doc1/cellspaceboundary/B1
- Content-Type : "application/json"
- Accept : "application/json"
- The content of the body
{
"id":"B1",
"parentId":"psf1",
"docId":"doc1",
"type":"CellSpaceBoundary",
"geometry":{
"type":"Surface",
"coordinates":"POLYGON ((106.14946783939612 176.40717841641478 0, 90.29610749150903 175.82105065707387 0, 75.4438161421153 175.2719342515505 0, 75.4438161421153 175.2719342515505 15, 90.29610749150903 175.82105065707387 15, 106.14946783939612 176.40717841641478 15, 106.14946783939612 176.40717841641478 0))",
"properties":{
"id":"CBG-B1",
"height":"",
"type":"wkt",
"extrude":"false"
}
},
"properties":{
"name":"B1",
"description":"",
"duality":"T2"
}
}
- Status : 201 created / 404 NOT FOUND
- Content-Type : None
https://{baseurl}/documents/{docId}/multilayeredgraph/{id}
-
{docId}
: alphanumeric id which starts as a alphabet -
{id}
: alphanumeric id which starts as a alphabet
$ POST http://localhost:9797/documents/doc1/multilayeredgraph/MLG1
- Content-Type : "application/json"
- Accept : "application/json"
- The content of the body
{"docId":"doc1","parentId":"If1","id":"MLG1"}
- Status : 201 created / 404 NOT FOUND
- Content-Type : None
https://{baseurl}/documents/{docId}/spacelayers/{id}
-
{docId}
: alphanumeric id which starts as a alphabet -
{id}
: alphanumeric id which starts as a alphabet
$ POST http://localhost:9797/documents/doc1/spacelayers/SLs1
- Content-Type : "application/json"
- Accept : "application/json"
- The content of the body
{"docId":"doc1","parentId":"MLG1","id":"SLs1"}
- Status : 201 created / 404 NOT FOUND
- Content-Type : None
https://{baseurl}/documents/{docId}/spacelayer/{id}
-
{docId}
: alphanumeric id which starts as a alphabet -
{id}
: alphanumeric id which starts as a alphabet
$ POST http://localhost:9797/documents/doc1/spacelayer/base
- Content-Type : "application/json"
- Accept : "application/json"
- The content of the body
{"docId":"doc1","parentId":"SLs1","id":"base"}
- Status : 201 created / 404 NOT FOUND
- Content-Type : None
https://{baseurl}/documents/{docId}/nodes/{id}
-
{docId}
: alphanumeric id which starts as a alphabet -
{id}
: alphanumeric id which starts as a alphabet
$ POST http://localhost:9797/documents/doc1/nodes/node1
- Content-Type : "application/json"
- Accept : "application/json"
- The content of the body
{"docId":"doc1","parentId":"base","id":"node1"}
- Status : 201 created / 404 NOT FOUND
- Content-Type : None
https://{baseurl}/documents/{docId}/edges/{id}
-
{docId}
: alphanumeric id which starts as a alphabet -
{id}
: alphanumeric id which starts as a alphabet
$ POST http://localhost:9797/documents/doc1/edges/edge1
- Content-Type : "application/json"
- Accept : "application/json"
- The content of the body
{"docId":"doc1","parentId":"base","id":"edge1"}
- Status : 201 created / 404 NOT FOUND
- Content-Type : None
https://{baseurl}/documents/{docId}/state/{id}
-
{docId}
: alphanumeric id which starts as a alphabet -
{id}
: alphanumeric id which starts as a alphabet
$ POST http://localhost:9797/documents/doc1/state/S1
- Content-Type : "application/json"
- Accept : "application/json"
- The content of the body
{
"id":"S1",
"parentId":"node1",
"docId":"doc1",
"type":"State",
"geometry":{
"type":"Point",
"coordinates":"POINT (89.8617866296617 204.73888960423105 0)",
"properties":{
"id":"SG-S1",
"type":"wkt"
}
},
"properties":{
"name":"S1",
"description":"",
"duality":"C1",
"connects":["T1","T2"]
}
}
$ POST http://localhost:9797/documents/doc1/state/S2
{
"id":"S2",
"parentId":"node1",
"docId":"doc1",
"type":"State",
"geometry":{
"type":"Point",
"coordinates":"POINT (90.53961641578336 148.6992934632883 0)",
"properties":{
"id":"SG-S2",
"type":"wkt"
}
},
"properties":{
"name":"S2",
"description":"",
"duality":"C2",
"connects":["T1","T2"]
}
}
- Status : 201 created / 404 NOT FOUND
- Content-Type : None
https://{baseurl}/documents/{docId}/transition/{id}
-
{docId}
: alphanumeric id which starts as a alphabet -
{id}
: alphanumeric id which starts as a alphabet
$ POST http://localhost:9797/documents/doc1/transition/T1
- Content-Type : "application/json"
- Accept : "application/json"
- The content of the body
{
"id":"T1",
"parentId":"edge1",
"docId":"doc1",
"type":"Transition",
"geometry":{
"type":"LineString",
"coordinates":"LINESTRING (89.8617866296617 204.73888960423105 0, 90.29610749150903 175.82105065707387 0, 90.53961641578336 148.6992934632883 0)",
"properties":{
"id":"TG-T1",
"type":"wkt"
}
},
"properties":{
"connects":["S1","S2"],
"name":"T1",
"description":"",
"duality":"B1"
}
}
- Status : 201 created / 404 NOT FOUND
- Content-Type : None
After creating the IndoorGML document, the users can download the document from the InFactory server. Or the users can get each feature of IndoorGML elements. In this section, we will explain how to get the IndoorGML document and a single CellSpace feature.
<!DOCTYPE html>
<html>
<body>
<h2>The XMLHttpRequest Object</h2>
<button type="button" onclick="loadDoc()">Request data</button>
<p id="demo"></p>
<script>
function loadDoc() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 302) {
console.log(this.responseText);
}
};
var url = 'http://localhost:9797/documents/doc1/';
var contentType = 'application/json';
xhttp.open("GET", url, true);
xhttp.setRequestHeader("Content-type", contentType);
xhttp.send(0);
}
</script>
</body>
</html>
When the users send this request to the InFactory server, then the server return the XML document. If there is any schema error at the data in the server, then the predefined error will be returned.
https://{baseurl}/documents/{docId}
-
{docId}
: alphanumeric id which starts as a alphabet -
{id}
: alphanumeric id which starts as a alphabet
- Content-Type : None
- Accept : None
- Status : 302 FOUND / 404 NOT FOUND
- Content-Type : "application/xml"
<core:IndoorFeatures
xmlns:gml="http://www.opengis.net/gml/3.2"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:core="http://www.opengis.net/indoorgml/1.0/core"
xmlns:navi="http://www.opengis.net/indoorgml/1.0/navigation"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" gml:id="If1" xsi:schemaLocation="http://www.opengis.net/indoorgml/1.0/core http://schemas.opengis.net/indoorgml/1.0/indoorgmlcore.xsd http://www.opengis.net/indoorgml/1.0/navigation http://schemas.opengis.net/indoorgml/1.0/indoorgmlnavi.xsd">
<gml:boundedBy xsi:nil="true"/>
<core:primalSpaceFeatures>
<core:PrimalSpaceFeatures gml:id="psf1">
<gml:boundedBy xsi:nil="true"/>
<core:cellSpaceMember>
<core:CellSpace gml:id="C1">
<gml:description>storey="F1":</gml:description>
<gml:name>C1</gml:name>
<gml:boundedBy xsi:nil="true"/>
<core:cellSpaceGeometry>
<core:Geometry3D>
<gml:Solid gml:id="CG-C1">
<gml:exterior>
<gml:Shell>
<gml:surfaceMember>
<gml:Polygon gml:id="Poly6b53074d-d024-4b6f-9147-293c54a71d05">
<gml:exterior>
<gml:LinearRing>
<gml:pos srsDimension="3">53.24976683924437 233.87626224093967 20.0</gml:pos>
<gml:pos srsDimension="3">52.72066631014385 174.43181779649524 20.0</gml:pos>
<gml:pos srsDimension="3">127.85294144241898 177.209595574273 20.0</gml:pos>
<gml:pos srsDimension="3">126.79474038421792 233.87626224093967 20.0</gml:pos>
<gml:pos srsDimension="3">53.24976683924437 233.87626224093967 20.0</gml:pos>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="Poly28eb5e69-ef03-49dd-83d2-8a27824a5225">
<gml:exterior>
<gml:LinearRing>
<gml:pos srsDimension="3">53.24976683924437 233.87626224093967 0.0</gml:pos>
<gml:pos srsDimension="3">52.72066631014385 174.43181779649524 0.0</gml:pos>
<gml:pos srsDimension="3">52.72066631014385 174.43181779649524 20.0</gml:pos>
<gml:pos srsDimension="3">53.24976683924437 233.87626224093967 20.0</gml:pos>
<gml:pos srsDimension="3">53.24976683924437 233.87626224093967 0.0</gml:pos>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="Polyc2ee1462-9869-4c04-9d27-17347419b8c7">
<gml:exterior>
<gml:LinearRing>
<gml:pos srsDimension="3">52.72066631014385 174.43181779649524 0.0</gml:pos>
<gml:pos srsDimension="3">127.85294144241898 177.209595574273 0.0</gml:pos>
<gml:pos srsDimension="3">127.85294144241898 177.209595574273 20.0</gml:pos>
<gml:pos srsDimension="3">52.72066631014385 174.43181779649524 20.0</gml:pos>
<gml:pos srsDimension="3">52.72066631014385 174.43181779649524 0.0</gml:pos>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="Poly218b50f9-1fb5-49d6-997e-0f60bd4ee8f8">
<gml:exterior>
<gml:LinearRing>
<gml:pos srsDimension="3">127.85294144241898 177.209595574273 0.0</gml:pos>
<gml:pos srsDimension="3">126.79474038421792 233.87626224093967 0.0</gml:pos>
<gml:pos srsDimension="3">126.79474038421792 233.87626224093967 20.0</gml:pos>
<gml:pos srsDimension="3">127.85294144241898 177.209595574273 20.0</gml:pos>
<gml:pos srsDimension="3">127.85294144241898 177.209595574273 0.0</gml:pos>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="Poly08dccc6f-44e8-4040-abd6-7e02b9e42ec3">
<gml:exterior>
<gml:LinearRing>
<gml:pos srsDimension="3">126.79474038421792 233.87626224093967 0.0</gml:pos>
<gml:pos srsDimension="3">53.24976683924437 233.87626224093967 0.0</gml:pos>
<gml:pos srsDimension="3">53.24976683924437 233.87626224093967 20.0</gml:pos>
<gml:pos srsDimension="3">126.79474038421792 233.87626224093967 20.0</gml:pos>
<gml:pos srsDimension="3">126.79474038421792 233.87626224093967 0.0</gml:pos>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="Polydd8182a2-3f49-4490-9057-0fe87eb2800d">
<gml:exterior>
<gml:LinearRing>
<gml:pos srsDimension="3">53.24976683924437 233.87626224093967 0.0</gml:pos>
<gml:pos srsDimension="3">126.79474038421792 233.87626224093967 0.0</gml:pos>
<gml:pos srsDimension="3">127.85294144241898 177.209595574273 0.0</gml:pos>
<gml:pos srsDimension="3">52.72066631014385 174.43181779649524 0.0</gml:pos>
<gml:pos srsDimension="3">53.24976683924437 233.87626224093967 0.0</gml:pos>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
</gml:Shell>
</gml:exterior>
</gml:Solid>
</core:Geometry3D>
</core:cellSpaceGeometry>
<core:duality xlink:href="#S1"/>
<core:partialboundedBy xlink:href="#B1-REVERSE"/>
</core:CellSpace>
</core:cellSpaceMember>
<core:cellSpaceMember>
<core:CellSpace gml:id="C2">
<gml:description>storey="F1":</gml:description>
<gml:name>C2</gml:name>
<gml:boundedBy xsi:nil="true"/>
<core:cellSpaceGeometry>
<core:Geometry3D>
<gml:Solid gml:id="CG-C2">
<gml:exterior>
<gml:Shell>
<gml:surfaceMember>
<gml:Polygon gml:id="Polybd128c9a-b3b4-4b4b-be36-5e29bd5bbe1f">
<gml:exterior>
<gml:LinearRing>
<gml:pos srsDimension="3">52.72066631014385 174.43181779649524 20.0</gml:pos>
<gml:pos srsDimension="3">53.778867368344905 120.54292890760634 20.0</gml:pos>
<gml:pos srsDimension="3">127.32384091331845 122.20959557427301 20.0</gml:pos>
<gml:pos srsDimension="3">127.85294144241898 177.209595574273 20.0</gml:pos>
<gml:pos srsDimension="3">52.72066631014385 174.43181779649524 20.0</gml:pos>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="Poly71bd9da2-76bf-4e3a-8262-3a82bfaaabf7">
<gml:exterior>
<gml:LinearRing>
<gml:pos srsDimension="3">52.72066631014385 174.43181779649524 0.0</gml:pos>
<gml:pos srsDimension="3">53.778867368344905 120.54292890760634 0.0</gml:pos>
<gml:pos srsDimension="3">53.778867368344905 120.54292890760634 20.0</gml:pos>
<gml:pos srsDimension="3">52.72066631014385 174.43181779649524 20.0</gml:pos>
<gml:pos srsDimension="3">52.72066631014385 174.43181779649524 0.0</gml:pos>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="Poly8b1b45ea-a2d8-48a1-8711-5551593979a3">
<gml:exterior>
<gml:LinearRing>
<gml:pos srsDimension="3">53.778867368344905 120.54292890760634 0.0</gml:pos>
<gml:pos srsDimension="3">127.32384091331845 122.20959557427301 0.0</gml:pos>
<gml:pos srsDimension="3">127.32384091331845 122.20959557427301 20.0</gml:pos>
<gml:pos srsDimension="3">53.778867368344905 120.54292890760634 20.0</gml:pos>
<gml:pos srsDimension="3">53.778867368344905 120.54292890760634 0.0</gml:pos>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="Polye9acb3dd-6bfc-43c4-b7fd-19d393f0e7be">
<gml:exterior>
<gml:LinearRing>
<gml:pos srsDimension="3">127.32384091331845 122.20959557427301 0.0</gml:pos>
<gml:pos srsDimension="3">127.85294144241898 177.209595574273 0.0</gml:pos>
<gml:pos srsDimension="3">127.85294144241898 177.209595574273 20.0</gml:pos>
<gml:pos srsDimension="3">127.32384091331845 122.20959557427301 20.0</gml:pos>
<gml:pos srsDimension="3">127.32384091331845 122.20959557427301 0.0</gml:pos>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="Polyd2cc0c48-8564-4284-a9f5-c9ea4722dbcb">
<gml:exterior>
<gml:LinearRing>
<gml:pos srsDimension="3">127.85294144241898 177.209595574273 0.0</gml:pos>
<gml:pos srsDimension="3">52.72066631014385 174.43181779649524 0.0</gml:pos>
<gml:pos srsDimension="3">52.72066631014385 174.43181779649524 20.0</gml:pos>
<gml:pos srsDimension="3">127.85294144241898 177.209595574273 20.0</gml:pos>
<gml:pos srsDimension="3">127.85294144241898 177.209595574273 0.0</gml:pos>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="Poly3d9baf86-e752-4659-b600-47a99e0e2e38">
<gml:exterior>
<gml:LinearRing>
<gml:pos srsDimension="3">52.72066631014385 174.43181779649524 0.0</gml:pos>
<gml:pos srsDimension="3">127.85294144241898 177.209595574273 0.0</gml:pos>
<gml:pos srsDimension="3">127.32384091331845 122.20959557427301 0.0</gml:pos>
<gml:pos srsDimension="3">53.778867368344905 120.54292890760634 0.0</gml:pos>
<gml:pos srsDimension="3">52.72066631014385 174.43181779649524 0.0</gml:pos>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
</gml:Shell>
</gml:exterior>
</gml:Solid>
</core:Geometry3D>
</core:cellSpaceGeometry>
<core:duality xlink:href="#S2"/>
<core:partialboundedBy xlink:href="#B1"/>
</core:CellSpace>
</core:cellSpaceMember>
<core:cellSpaceBoundaryMember>
<core:CellSpaceBoundary gml:id="B1">
<gml:description></gml:description>
<gml:name>B1</gml:name>
<gml:boundedBy xsi:nil="true"/>
<core:duality xlink:href="#T1"/>
<core:cellSpaceBoundaryGeometry>
<core:geometry3D>
<gml:Polygon gml:id="CBG-B1">
<gml:exterior>
<gml:LinearRing>
<gml:pos srsDimension="3">106.14946783939612 176.40717841641478 0.0</gml:pos>
<gml:pos srsDimension="3">90.29610749150903 175.82105065707387 0.0</gml:pos>
<gml:pos srsDimension="3">75.4438161421153 175.2719342515505 0.0</gml:pos>
<gml:pos srsDimension="3">75.4438161421153 175.2719342515505 15.0</gml:pos>
<gml:pos srsDimension="3">90.29610749150903 175.82105065707387 15.0</gml:pos>
<gml:pos srsDimension="3">106.14946783939612 176.40717841641478 15.0</gml:pos>
<gml:pos srsDimension="3">106.14946783939612 176.40717841641478 0.0</gml:pos>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</core:geometry3D>
</core:cellSpaceBoundaryGeometry>
</core:CellSpaceBoundary>
</core:cellSpaceBoundaryMember>
</core:PrimalSpaceFeatures>
</core:primalSpaceFeatures>
<core:multiLayeredGraph>
<core:MultiLayeredGraph gml:id="MLG1">
<gml:boundedBy xsi:nil="true"/>
<core:spaceLayers gml:id="SLs1">
<gml:boundedBy xsi:nil="true"/>
<core:spaceLayerMember>
<core:SpaceLayer gml:id="base">
<gml:boundedBy xsi:nil="true"/>
<core:nodes gml:id="node1">
<gml:boundedBy xsi:nil="true"/>
<core:stateMember>
<core:State gml:id="S1">
<gml:description></gml:description>
<gml:name>S1</gml:name>
<gml:boundedBy xsi:nil="true"/>
<core:duality xlink:href="#C1"/>
<core:connects xlink:href="#T1"/>
<core:connects xlink:href="#T2"/>
<core:geometry>
<gml:Point gml:id="SG-S1">
<gml:pos srsDimension="3">89.8617866296617 204.73888960423105 0.0</gml:pos>
</gml:Point>
</core:geometry>
</core:State>
</core:stateMember>
<core:stateMember>
<core:State gml:id="S2">
<gml:description></gml:description>
<gml:name>S2</gml:name>
<gml:boundedBy xsi:nil="true"/>
<core:duality xlink:href="#C2"/>
<core:connects xlink:href="#T1"/>
<core:connects xlink:href="#T2"/>
<core:geometry>
<gml:Point gml:id="SG-S2">
<gml:pos srsDimension="3">90.53961641578336 148.6992934632883 0.0</gml:pos>
</gml:Point>
</core:geometry>
</core:State>
</core:stateMember>
</core:nodes>
<core:edges gml:id="edge1">
<gml:boundedBy xsi:nil="true"/>
<core:transitionMember>
<core:Transition gml:id="T1">
<gml:description></gml:description>
<gml:name>T1</gml:name>
<gml:boundedBy xsi:nil="true"/>
<core:weight>0.0</core:weight>
<core:connects xlink:href="#S1"/>
<core:connects xlink:href="#S2"/>
<core:duality xlink:href="#B1"/>
<core:geometry>
<gml:LineString gml:id="TG-T1">
<gml:pos srsDimension="3">89.8617866296617 204.73888960423105 0.0</gml:pos>
<gml:pos srsDimension="3">90.29610749150903 175.82105065707387 0.0</gml:pos>
<gml:pos srsDimension="3">90.53961641578336 148.6992934632883 0.0</gml:pos>
</gml:LineString>
</core:geometry>
</core:Transition>
</core:transitionMember>
</core:edges>
</core:SpaceLayer>
</core:spaceLayerMember>
</core:spaceLayers>
</core:MultiLayeredGraph>
</core:multiLayeredGraph>
</core:IndoorFeatures>
Figure 2. the XML document received as the result of GET request.
When the server of InFactory receives a request that asks the server to return a feature of IndoorGML, the server will return the data of the feature in the JSON format defined at JSON format.
https://{baseurl}/documents/{docId}/cellspace/{id}
-
{docId}
: alphanumeric id which starts as a alphabet -
{id}
: alphanumeric id which starts as a alphabet
- Content-Type : None
- Accept : None
- Status : 302 FOUND / 404 NOT FOUND
- Content-Type : "application/json"
{
"docId":"doc1",
"parentId":"psf1",
"id":"c1",
"geometry": {
"type" : "Solid",
"coordinates" : "SOLID (( ((0 0 0, 0 1 0, 1 1 0, 1 0 0, 0 0 0)), ((0 0 0, 0 1 0, 0 1 1, 0 0 1, 0 0 0)), ((0 0 0, 1 0 0, 1 0 1, 0 0 1, 0 0 0)), ((1 1 1, 1 0 1, 0 0 1, 0 1 1, 1 1 1)), ((1 1 1, 1 0 1, 1 0 0, 1 1 0, 1 1 1)), ((1 1 1, 1 1 0, 0 1 0, 0 1 1, 1 1 1)) ))",
"properties" : {
"id" : "c1g",
"type" : "wkt"
}
}
}
Figure 3. The JSON data of the CellSpace feature received as the result of the request.
The server of InFactory fully updates the contents of the existing features when the server receives the request. The users need to write full content of the feature when the users send PUT request to the server.
<!DOCTYPE html>
<html>
<body>
<h2>The XMLHttpRequest Object</h2>
<button type="button" onclick="loadDoc()">Request data</button>
<p id="demo"></p>
<script>
function loadDoc() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 201) {
document.getElementById("demo").innerHTML = this.responseText;
}
};
var url = 'http://localhost:9797/documents/doc1';
var contentType = 'application/json';
var data = {
"docId":"doc1"
}
xhttp.open("PUT", url, true);
xhttp.setRequestHeader("Content-type", contentType);
xhttp.send(JSON.stringify(data));
}
</script>
</body>
</html>
https://{baseurl}/documents/{docId}/cellspace/{id}
-
{docId}
: alphanumeric id which starts as a alphabet -
{id}
: alphanumeric id which starts as a alphabet
- Content-Type : "application/json"
- Accept : "application/json"
- The content of the body
{
"docId":"doc1",
"parentId":"psf1",
"id":"c1",
"geometry": {
"type" : "Solid",
"coordinates" : "SOLID (( ((0 0 0, 0 1 0, 1 1 0, 1 0 0, 0 0 0)), ((0 0 0, 0 1 0, 0 1 1, 0 0 1, 0 0 0)), ((0 0 0, 1 0 0, 1 0 1, 0 0 1, 0 0 0)), ((1 1 1, 1 0 1, 0 0 1, 0 1 1, 1 1 1)), ((1 1 1, 1 0 1, 1 0 0, 1 1 0, 1 1 1)), ((1 1 1, 1 1 0, 0 1 0, 0 1 1, 1 1 1)) ))",
"properties" : {
"id" : "c1g",
"type" : "wkt"
}
}
}
- Status : 201 CREATED / 404 NOT FOUND
- Content-Type : None
When the server of InFactory receives this request for deleting the document, then the document is deleted. If the server receives this request for deleting a feature in IndoorGML, then only the feature is deleted. This example removes CellSpace "c1" at the server.
<!DOCTYPE html>
<html>
<body>
<h2>The XMLHttpRequest Object</h2>
<button type="button" onclick="loadDoc()">Request data</button>
<p id="demo"></p>
<script>
function loadDoc() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 201) {
document.getElementById("demo").innerHTML = this.responseText;
}
};
var url = 'http://localhost:9797/documents/doc1';
var contentType = 'application/json';
xhttp.open("DELETE", url, true);
xhttp.setRequestHeader("Content-type", contentType);
xhttp.send(0);
}
</script>
</body>
</html>
https://{baseurl}/documents/{docId}/cellspace/{id}
-
{docId}
: alphanumeric id which starts as a alphabet -
{id}
: alphanumeric id which starts as a alphabet
- Content-Type : None
- Accept : None
- Status : 204 NO CONTENT / 404 NOT FOUND
- Content-Type : None