Skip to content
Snippets Groups Projects
Commit 7435630c authored by Piotr Gawron's avatar Piotr Gawron
Browse files

model contains information about references

parent bebf065d
No related branches found
No related tags found
1 merge request!708Resolve "add handling of annotations for model"
......@@ -23,6 +23,7 @@ var Reaction = require('./Reaction');
* @property {number} defaultCenterX
* @property {number} defaultCenterY
* @property {number} defaultZoomLevel
* @property {Annotation[]|AnnotationOptions[]} references
*/
/**
......@@ -70,6 +71,7 @@ function MapModel(configuration) {
this.setDefaultCenterX(configuration.getDefaultCenterX());
this.setDefaultCenterY(configuration.getDefaultCenterY());
this.setDefaultZoomLevel(configuration.getDefaultZoomLevel());
this.setReferences(configuration.getReferences());
} else {
this.setId(configuration.idObject);
this.setName(configuration.name);
......@@ -82,6 +84,7 @@ function MapModel(configuration) {
this.setDefaultCenterX(configuration.defaultCenterX);
this.setDefaultCenterY(configuration.defaultCenterY);
this.setDefaultZoomLevel(configuration.defaultZoomLevel);
this.setReferences(configuration.references);
}
}
}
......@@ -871,5 +874,27 @@ MapModel.prototype.getSbmlParameterById = function (id) {
}
};
/**
*
* @returns {Annotation[]}
*/
MapModel.prototype.getReferences = function () {
return this.references;
};
/**
*
* @param {Annotation[]} references
*/
MapModel.prototype.setReferences = function (references) {
if (references === undefined) {
throw new Error("references must be defined");
}
this.references = [];
for (var i = 0; i < references.length; i++) {
this.references.push(new Annotation(references[i]));
}
};
module.exports = MapModel;
......@@ -18,7 +18,8 @@ describe('MapModel', function () {
it("constructor", function () {
var model = new MapModel({
idObject: 123
idObject: 123,
references: []
});
assert.equal(123, model.getId());
......
[{"version":null,"name":"UNKNOWN DISEASE MAP","idObject":20637,"tileSize":256,"width":1305,"height":473,"defaultCenterX":null,"defaultCenterY":null,"defaultZoomLevel":null,"minZoom":2,"maxZoom":5,"submodelType":"UNKNOWN"}]
\ No newline at end of file
[{"version":null,"name":"UNKNOWN DISEASE MAP","idObject":20637,"tileSize":256,"width":1305,"height":473,"defaultCenterX":null,"defaultCenterY":null,"defaultZoomLevel":null,"minZoom":2,"maxZoom":5,"submodelType":"UNKNOWN","references":[]}]
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment