Commit fe5cb124 authored by Caillat Michel's avatar Caillat Michel
Browse files

Seriously modified the YAFITSContoursControl

parent ddf81bf7
......@@ -23,10 +23,10 @@ class ContoursViewer {
stroke: new ol.style.Stroke({
color: 'blue',
lineDash: [2],
width: 2
width: 1
}),
fill: new ol.style.Fill({
color: 'rgba(0, 0, 255, 0.1)'
color: 'rgba(0, 0, 255, 0.6)'
})
}),
'Polygon': new ol.style.Style({
......@@ -57,12 +57,14 @@ class ContoursViewer {
this.closer = document.getElementById('popup-closer');
this.yAFITSContoursControl = new YAFITSContoursControl();
this.yAFITSContoursControl.setHandler(this.onoff.bind(this));
//this.yAFITSContoursControl.setHandler(this.onoff.bind(this));
this.map.addControl(this.yAFITSContoursControl);
this.lastSelectedContour = null;
this.lastBox = null;
$("#slice").append($("#ModalContoursForm"));
console.log("ContoursViewer ctor: exiting");console.trace();
}
......@@ -77,6 +79,7 @@ class ContoursViewer {
}
feature.setStyle(this.highlightStyle);
this.box(feature);
this.grid(feature);
this.lastSelectedContour = feature;
console.log("highlight : exiting");
}
......@@ -95,6 +98,20 @@ class ContoursViewer {
console.log("box : exiting");
}
grid(feature) {
console.log("grid : entering");
let br = feature.get("properties")["measurements"]["boundingRect"];
let segments = new Array();
for (i=0; i < br[2]; i++) {
segments.push(new ol.Feature ({geometry : new ol.geom.LineString([[br[0]+i, br[1]], [br[0]+i, br[1]+br[3]-1]])}));
}
for (i=0; i< br[3]; i++) {
segments.push(new ol.Feature ({geometry : new ol.geom.LineString([[br[0], br[1]+i], [br[0]+br[2]-1, br[1]+i]])}));
}
this.source.addFeatures(segments);
console.log("grid : exiting");
}
importYAFITSContours(yAFITSContours) {
console.log("importYAFITSContours: entering"); console.trace();
this.clear();
......@@ -129,9 +146,10 @@ class ContoursViewer {
}
onoff () {
this.visible = ! this.visible;
if (this.visible) this.show(); else this.hide();
this.yAFITSContoursControl.onoff();
$("#ModalContoursForm").modal();
// this.visible = ! this.visible;
// if (this.visible) this.show(); else this.hide();
// this.yAFITSContoursControl.onoff();
}
}; // End of class ContoursViewer
......@@ -270,21 +288,12 @@ var YAFITSContoursControl = /*@__PURE__*/(function (Control) {
function YAFITSContoursControl(opt_options) {
var options = opt_options || {};
this.button = document.createElement('button');
this.button.innerHTML = '<s>C</s>';
var element = document.createElement('div');
element.className = 'yafitscontourscontrol ol-unselectable ol-control';
element.appendChild(this.button);
ol.control.Control.call(this, {
element: element,
element: document.getElementById("x"),
target: options.target
});
this.handleYAFITSContours = function () {;}
this.button.addEventListener('click', this.handleYAFITSContours.bind(this), false);
this.setHandler = function (handler) {console.log("Changing handler"); this.button.addEventListener('click', handler.bind(this), false)};
document.getElementById("xx").addEventListener('click', this.handleYAFITSContours.bind(this), false);
}
if ( Control ) YAFITSContoursControl.__proto__ = Control;
......@@ -292,17 +301,16 @@ var YAFITSContoursControl = /*@__PURE__*/(function (Control) {
YAFITSContoursControl.prototype.constructor = YAFITSContoursControl;
YAFITSContoursControl.prototype.handleYAFITSContours = function handleYAFITSContours () {
//this.getMap().getView().setRotation(0);
};
YAFITSContoursControl.prototype.onoff = function onoff () {
if (this.button.innerHTML == "C") this.button.innerHTML = "<s>C</s>"; else this.button.innerHTML = "C";
$("#ModalContoursForm").modal("toggle");
};
return YAFITSContoursControl;
}(ol.control.Control));
</script>
<div id="x" class="yafitscontourscontrol ol-unselectable ol-control">
<button id="xx" type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#ModalContoursForm">C</button>
</div>
<div id="ModalContoursForm" class="modal fade">
<div class="modal-dialog" role="document">
......@@ -356,10 +364,3 @@ var YAFITSContoursControl = /*@__PURE__*/(function (Control) {
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal-dialog -->
<div style='display: none'>
<div id="popup" class="ol-popup">
<a href="#" id="popup-closer" class="ol-popup-closer"></a>
<div id="popup-content"></div>
</div>
</div>
Supports Markdown
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