diff --git a/frontend-js/src/main/js/map/canvas/OpenLayers/OpenLayerPolyline.js b/frontend-js/src/main/js/map/canvas/OpenLayers/OpenLayerPolyline.js index e87a516537fcec87d8c331c54d834e7413f6ac08..6ee77ee55986f8721bb867c97b5d81b45482e6e7 100644 --- a/frontend-js/src/main/js/map/canvas/OpenLayers/OpenLayerPolyline.js +++ b/frontend-js/src/main/js/map/canvas/OpenLayers/OpenLayerPolyline.js @@ -83,7 +83,7 @@ OpenLayerPolyline.prototype.isShown = function () { OpenLayerPolyline.prototype.getBounds = function () { var self = this; - var extent = self.getOpenLayersRectangle().getGeometry().getExtent(); + var extent = self.getOpenLayersPolyline().getGeometry().getExtent(); var projection1 = [extent[0], extent[1]]; var p1 = self.getMap().fromProjectionToPoint(projection1); diff --git a/frontend-js/src/main/js/map/surface/ReactionSurface.js b/frontend-js/src/main/js/map/surface/ReactionSurface.js index b750368fcbf609325c0c9f31d3c5835b3cf59167..2ceeb217ea0c1e6937105dccb991150ceca44dfa 100644 --- a/frontend-js/src/main/js/map/surface/ReactionSurface.js +++ b/frontend-js/src/main/js/map/surface/ReactionSurface.js @@ -87,7 +87,7 @@ ReactionSurface.prototype.setColor = function (color) { strokeColor: color }); } - this.customized = true; + this.setCustomized(true); }; /** @@ -163,7 +163,7 @@ ReactionSurface.prototype.changedToDefault = function () { strokeWeight: 5 }); } - this.customized = false; + this.setCustomized(false); }; /** @@ -177,7 +177,7 @@ ReactionSurface.prototype.changedToCustomized = function () { strokeWeight: this.getWidth() }); } - this.customized = true; + this.setCustomized(true); }; /** diff --git a/frontend-js/src/test/js/map/canvas/OpenLayers/OpenLayersPolyline-test.js b/frontend-js/src/test/js/map/canvas/OpenLayers/OpenLayersPolyline-test.js new file mode 100644 index 0000000000000000000000000000000000000000..f6107f6b544f5c27ed3e063da5ffa39433a5fdc4 --- /dev/null +++ b/frontend-js/src/test/js/map/canvas/OpenLayers/OpenLayersPolyline-test.js @@ -0,0 +1,44 @@ +"use strict"; +require("../../../mocha-config"); + +// noinspection JSUnusedLocalSymbols +var logger = require('../../../logger'); + +var OpenLayerCanvas = require('../../../../../main/js/map/canvas/OpenLayers/OpenLayerCanvas'); +var OpenLayerPolyline = require('../../../../../main/js/map/canvas/OpenLayers/OpenLayerPolyline'); +var Bounds = require('../../../../../main/js/map/canvas/Bounds'); +var Point = require('../../../../../main/js/map/canvas/Point'); + +var SelectionContextMenu = require('../../../../../main/js/gui/SelectionContextMenu'); + +var chai = require('chai'); +var assert = chai.assert; + +describe('OpenLayerPolyline', function () { + var testOptions = { + center: new Point(0, 0), + tileSize: 256, + width: 300, + height: 600, + zoom: 3, + minZoom: 2, + maxZoom: 10, + backgroundOverlays: [{ + id: 1, + name: "overlay", + directory: "overlay_dir" + }] + }; + it("getBounds", function () { + var canvas = new OpenLayerCanvas(testDiv, testOptions); + var path = [new Point(0, 0), new Point(10, 5)]; + + var polyline = canvas.createPolyline({ + strokeWeight: 1, + strokeColor: "#00ff00", + path: path + }); + polyline.show(); + assert.ok(polyline.getBounds()); + }); +}); diff --git a/rest-api/src/main/java/lcsb/mapviewer/api/projects/overlays/OverlayRestImpl.java b/rest-api/src/main/java/lcsb/mapviewer/api/projects/overlays/OverlayRestImpl.java index de4428df9f88304e9b3591f8c7f2d899d4935bda..c0540b1f76da9760f3947807504d305998ca2202 100644 --- a/rest-api/src/main/java/lcsb/mapviewer/api/projects/overlays/OverlayRestImpl.java +++ b/rest-api/src/main/java/lcsb/mapviewer/api/projects/overlays/OverlayRestImpl.java @@ -143,7 +143,7 @@ public class OverlayRestImpl extends BaseRestImpl { if (columns != null && !columns.trim().isEmpty()) { columnSet = columns.split(","); } else { - columnSet = new String[] { "modelId", "idObject", "value", "color", "uniqueId" }; + columnSet = new String[] { "modelId", "idObject", "value", "color", "uniqueId", "width" }; } List<Map<String, Object>> result = new ArrayList<>(); @@ -426,6 +426,12 @@ public class OverlayRestImpl extends BaseRestImpl { } } else if (column.equals("description")) { value = colorSchema.getDescription(); + } else if (column.equals("width")) { + if (bioEntity instanceof Reaction) { + value = colorSchema.getLineWidth(); + } else { + continue; + } } else if (column.equals("type")) { if (colorSchema instanceof GeneVariationColorSchema) { value = ColorSchemaType.GENETIC_VARIANT;