Commit f8a7e613 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch '308-main-view-compartments-are-not-selectable' into 'master'

Resolve "Main view: Compartments are not selectable"

Closes #308

See merge request piotr.gawron/minerva!254
parents 6da94fbe 18c89c6c
Pipeline #4314 passed with stage
in 1 minute and 5 seconds
......@@ -1369,7 +1369,8 @@ ServerConnector.getClosestElementsByCoordinates = function (params) {
};
var filterParams = {
coordinates: params.coordinates,
count: params.count
count: params.count,
type: params.type
};
return self.getProjectId(params.projectId).then(function (result) {
queryParams.projectId = result;
......
......@@ -67,6 +67,7 @@ Alias.prototype.update = function (javaObject) {
this.setOther(javaObject.getOther());
this.setHierarchyVisibilityLevel(javaObject.getHierarchyVisibilityLevel());
this.setComplexId(javaObject.getComplexId());
this.setTransparencyLevel(javaObject.getTransparencyLevel());
this.setLinkedSubmodelId(javaObject.getLinkedSubmodelId());
this.setCompartmentId(javaObject.getCompartmentId());
this.setDescription(javaObject.getDescription());
......@@ -101,6 +102,7 @@ Alias.prototype.update = function (javaObject) {
this.setOther(javaObject.other);
this.setHierarchyVisibilityLevel(javaObject.hierarchyVisibilityLevel);
this.setComplexId(javaObject.complexId);
this.setTransparencyLevel(javaObject.transparencyLevel);
this.setLinkedSubmodelId(javaObject.linkedSubmodel);
this.setCompartmentId(javaObject.compartmentId);
......@@ -245,4 +247,12 @@ Alias.prototype.setComplexId = function (complexId) {
}
};
Alias.prototype.getTransparencyLevel = function() {
return this._transparencyLevel;
};
Alias.prototype.setTransparencyLevel = function(transparencyLevel) {
this._transparencyLevel = transparencyLevel;
};
module.exports = Alias;
......@@ -88,6 +88,12 @@ SearchDbOverlay.prototype._getFirstVisibleParentOrObject = function (identifiedE
var model = self.getMap().getSubmapById(identifiedElement.getModelId()).getModel();
return model.getByIdentifiedElement(identifiedElement, true).then(function (fullElement) {
if (fullElement.getHierarchyVisibilityLevel() <= zoomLevel) {
if (fullElement instanceof Alias) {
//transparent compartments shouldn't be clickable
if (fullElement.getTransparencyLevel() <= zoomLevel && fullElement.getType() === "Compartment") {
return undefined;
}
}
return identifiedElement;
} else {
var parentId;
......@@ -191,9 +197,33 @@ SearchDbOverlay.prototype.searchByCoordinates = function (params) {
if (distance <= maxDistance) {
self._elementsByQuery[query] = searchResult;
} else {
self._elementsByQuery[query] = [];
return ServerConnector.getClosestElementsByCoordinates({
modelId: modelId,
coordinates: coordinates,
count: 1,
type: ["Compartment"]
}).then(function (elements) {
var nestedOverlay = "Pathways and compartments";
if (elements.length === 0) {
return undefined;
} else {
if (self.getMap().getBackgroundDataOverlay().getName() === nestedOverlay) {
return self._getFirstVisibleParentOrObject(elements[0], zoom - model.getMinZoom());
} else {
return undefined;
}
}
}).then(function (visibleObject) {
if (visibleObject !== undefined) {
self._elementsByQuery[query] = [visibleObject];
} else {
self._elementsByQuery[query] = [];
}
});
}
}).then(function () {
self.setQueries([query]);
return self.callListeners('onSearch', {
fitBounds: params.fitBounds,
identifiedElements: [self._elementsByQuery[query]],
......
......@@ -179,7 +179,7 @@ describe('SearchDbOverlay', function () {
var searchParams = {
modelId: map.getModel().getId(),
coordinates: new google.maps.Point(316.05, 253.61),
zoom: 4
zoom: 10
};
return searchDb.searchByCoordinates(searchParams);
}).then(function (result) {
......
[{"abbreviation":null,"boundaryCondition":null,"bounds":{"height":142.0,"width":144.0,"x":35.0,"y":45.0},"compartmentId":null,"complexId":null,"constant":null,"elementId":"ca1","formerSymbols":[],"formula":null,"fullName":null,"hierarchyVisibilityLevel":"0","id":345323,"initialAmount":null,"initialConcentration":null,"linkedSubmodel":null,"modelId":16728,"name":"c1","notes":"","other":{"modifications":[],"structuralState":null,"structures":{}},"references":[],"symbol":null,"synonyms":[],"type":"Compartment"},{"abbreviation":null,"boundaryCondition":null,"bounds":{"height":296.0,"width":291.0,"x":189.0,"y":33.0},"compartmentId":null,"complexId":null,"constant":null,"elementId":"ca2","formerSymbols":[],"formula":null,"fullName":null,"hierarchyVisibilityLevel":"0","id":345332,"initialAmount":null,"initialConcentration":null,"linkedSubmodel":null,"modelId":16728,"name":"c2","notes":"","other":{"modifications":[],"structuralState":null,"structures":{}},"references":[],"symbol":null,"synonyms":[],"type":"Compartment"}]
\ No newline at end of file
[{"abbreviation":null,"boundaryCondition":null,"bounds":{"height":142.0,"width":144.0,"x":35.0,"y":45.0},"compartmentId":null,"complexId":null,"constant":null,"elementId":"ca1","formerSymbols":[],"formula":null,"fullName":null,"hierarchyVisibilityLevel":"0","id":345323,"initialAmount":null,"initialConcentration":null,"linkedSubmodel":null,"modelId":16728,"name":"c1","notes":"","other":{"modifications":[],"structuralState":null,"structures":{}},"references":[],"symbol":null,"synonyms":[],"transparencyLevel":"2","type":"Compartment"},{"abbreviation":null,"boundaryCondition":null,"bounds":{"height":296.0,"width":291.0,"x":189.0,"y":33.0},"compartmentId":null,"complexId":null,"constant":null,"elementId":"ca2","formerSymbols":[],"formula":null,"fullName":null,"hierarchyVisibilityLevel":"0","id":345332,"initialAmount":null,"initialConcentration":null,"linkedSubmodel":null,"modelId":16728,"name":"c2","notes":"","other":{"modifications":[],"structuralState":null,"structures":{}},"references":[],"symbol":null,"synonyms":[],"transparencyLevel":"1","type":"Compartment"}]
\ No newline at end of file
[{"abbreviation":null,"boundaryCondition":false,"bounds":{"height":40.0,"width":80.0,"x":148.0,"y":172.0},"compartmentId":null,"complexId":null,"constant":false,"elementId":"sa2","formerSymbols":[],"formula":null,"fullName":null,"hierarchyVisibilityLevel":"0","id":345325,"initialAmount":0.0,"initialConcentration":null,"linkedSubmodel":null,"modelId":16729,"name":"x2","notes":"","other":{"modifications":[],"structuralState":null,"structures":{}},"references":[],"symbol":null,"synonyms":[],"type":"Protein"}]
\ No newline at end of file
[{"abbreviation":null,"boundaryCondition":false,"bounds":{"height":40.0,"width":80.0,"x":148.0,"y":172.0},"compartmentId":null,"complexId":null,"constant":false,"elementId":"sa2","formerSymbols":[],"formula":null,"fullName":null,"hierarchyVisibilityLevel":"0","id":345325,"initialAmount":0.0,"initialConcentration":null,"linkedSubmodel":null,"modelId":16729,"name":"x2","notes":"","other":{"modifications":[],"structuralState":null,"structures":{}},"references":[],"symbol":null,"synonyms":[],"transparencyLevel":"0","type":"Protein"}]
\ No newline at end of file
[{"abbreviation":null,"boundaryCondition":false,"bounds":{"height":40.0,"width":80.0,"x":65.0,"y":64.0},"compartmentId":null,"complexId":null,"constant":false,"elementId":"sa1","formerSymbols":[],"formula":null,"fullName":null,"hierarchyVisibilityLevel":"0","id":345330,"initialAmount":0.0,"initialConcentration":null,"linkedSubmodel":16730,"modelId":16729,"name":"s1","notes":"","other":{"modifications":[],"structuralState":null,"structures":{}},"references":[],"symbol":null,"synonyms":[],"type":"Protein"}]
\ No newline at end of file
[{"abbreviation":null,"boundaryCondition":false,"bounds":{"height":40.0,"width":80.0,"x":65.0,"y":64.0},"compartmentId":null,"complexId":null,"constant":false,"elementId":"sa1","formerSymbols":[],"formula":null,"fullName":null,"hierarchyVisibilityLevel":"0","id":345330,"initialAmount":0.0,"initialConcentration":null,"linkedSubmodel":16730,"modelId":16729,"name":"s1","notes":"","other":{"modifications":[],"structuralState":null,"structures":{}},"references":[],"symbol":null,"synonyms":[],"transparencyLevel":"0","type":"Protein"}]
\ No newline at end of file
[{"abbreviation":null,"boundaryCondition":false,"bounds":{"height":40.0,"width":80.0,"x":59.0,"y":73.0},"compartmentId":345323,"complexId":null,"constant":false,"elementId":"sa1","formerSymbols":[],"formula":null,"fullName":null,"hierarchyVisibilityLevel":"2","id":345331,"initialAmount":0.0,"initialConcentration":null,"linkedSubmodel":16729,"modelId":16728,"name":"s1","notes":"","other":{"modifications":[],"structuralState":null,"structures":{}},"references":[],"symbol":null,"synonyms":[],"type":"Protein"}]
\ No newline at end of file
[{"abbreviation":null,"boundaryCondition":false,"bounds":{"height":40.0,"width":80.0,"x":59.0,"y":73.0},"compartmentId":345323,"complexId":null,"constant":false,"elementId":"sa1","formerSymbols":[],"formula":null,"fullName":null,"hierarchyVisibilityLevel":"2","id":345331,"initialAmount":0.0,"initialConcentration":null,"linkedSubmodel":16729,"modelId":16728,"name":"s1","notes":"","other":{"modifications":[],"structuralState":null,"structures":{}},"references":[],"symbol":null,"synonyms":[],"transparencyLevel":"0","type":"Protein"}]
\ No newline at end of file
[{"abbreviation":null,"boundaryCondition":false,"bounds":{"height":40.0,"width":80.0,"x":190.0,"y":44.0},"compartmentId":null,"complexId":null,"constant":false,"elementId":"sa1","formerSymbols":[],"formula":null,"fullName":null,"hierarchyVisibilityLevel":"0","id":345337,"initialAmount":0.0,"initialConcentration":null,"linkedSubmodel":null,"modelId":16731,"name":"s1","notes":"","other":{"modifications":[],"structuralState":null,"structures":{}},"references":[],"symbol":null,"synonyms":[],"type":"Protein"}]
\ No newline at end of file
[{"abbreviation":null,"boundaryCondition":false,"bounds":{"height":40.0,"width":80.0,"x":190.0,"y":44.0},"compartmentId":null,"complexId":null,"constant":false,"elementId":"sa1","formerSymbols":[],"formula":null,"fullName":null,"hierarchyVisibilityLevel":"0","id":345337,"initialAmount":0.0,"initialConcentration":null,"linkedSubmodel":null,"modelId":16731,"name":"s1","notes":"","other":{"modifications":[],"structuralState":null,"structures":{}},"references":[],"symbol":null,"synonyms":[],"transparencyLevel":"0","type":"Protein"}]
\ No newline at end of file
[{"abbreviation":null,"boundaryCondition":false,"bounds":{"height":40.0,"width":80.0,"x":1225.7682370820667,"y":66.0},"compartmentId":null,"complexId":null,"constant":false,"elementId":"sa32","formerSymbols":[],"formula":null,"fullName":null,"hierarchyVisibilityLevel":"0","id":436152,"initialAmount":0.0,"initialConcentration":null,"linkedSubmodel":null,"modelId":20637,"name":"BDH1","notes":"","other":{"modifications":[],"structuralState":null,"structures":{}},"references":[{"annotatorClassName":"","descriptionByType":"","descriptionByTypeRelation":"","id":1104500,"link":"http://www.ncbi.nlm.nih.gov/gene/622","resource":"622","type":"ENTREZ"}],"symbol":null,"synonyms":[],"type":"Protein"}]
\ No newline at end of file
[{"abbreviation":null,"boundaryCondition":false,"bounds":{"height":40.0,"width":80.0,"x":1225.7682370820667,"y":66.0},"compartmentId":null,"complexId":null,"constant":false,"elementId":"sa32","formerSymbols":[],"formula":null,"fullName":null,"hierarchyVisibilityLevel":"0","id":436152,"initialAmount":0.0,"initialConcentration":null,"linkedSubmodel":null,"modelId":20637,"name":"BDH1","notes":"","other":{"modifications":[],"structuralState":null,"structures":{}},"references":[{"annotatorClassName":"","descriptionByType":"","descriptionByTypeRelation":"","id":1104500,"link":"http://www.ncbi.nlm.nih.gov/gene/622","resource":"622","type":"ENTREZ"}],"symbol":null,"synonyms":[],"transparencyLevel":"0","type":"Protein"}]
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment