Skip to content

Commit

Permalink
Added support for TySON decoding
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabor Pap committed Mar 24, 2014
1 parent d25574a commit ec782bf
Show file tree
Hide file tree
Showing 2 changed files with 670 additions and 3 deletions.
11 changes: 10 additions & 1 deletion public/javascript/data_loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ define(["THREE", "underscore", "assembly", "product", "shape", "annotation", "sh
switch (filetype) {
case "xml": req.contentType = "application/xml"; break;
case "json": req.contentType = "application/json"; break;
case "tyson": req.contentType = "application/octet-stream"; break;
default:
console.log("DataLoader.resolveUrl error - invalid content type: " + filetype);
}
Expand Down Expand Up @@ -263,6 +264,10 @@ define(["THREE", "underscore", "assembly", "product", "shape", "annotation", "sh
shell = this._shells[event.data.id];
data = event.data.data;
break;
case "application/octet-stream":
shell = this._shells[event.data.id];
data = event.data.data;
break;
default:
console.log("Blahhlal - What the hell is this?");
}
Expand Down Expand Up @@ -551,11 +556,15 @@ define(["THREE", "underscore", "assembly", "product", "shape", "annotation", "sh
this._viewer.add3DObject(rootProduct.getObject3D(), 'geometry');
this._viewer.add3DObject(rootProduct.getOverlay3D(), 'overlay');
this._viewer.add3DObject(rootProduct.getAnnotation3D(), 'annotation');
var batchExtension = '.json'
if (doc.useTyson){
batchExtension = '.tyson';
}
// Do we have batches
if (doc.batches && doc.batches > 0) {
for (var i = 0; i < doc.batches; i++) {
this.addRequest({
url: req.base + "batch" + i + ".json",
url: req.base + "batch" + i + batchExtension,
validateType: "batch"
});
}
Expand Down
Loading

0 comments on commit ec782bf

Please sign in to comment.