draw interaction changed

parent 52c8e359
...@@ -52,6 +52,19 @@ html, body ...@@ -52,6 +52,19 @@ html, body
} }
.drawControl{
width: 50px;
height: 50px;
position: absolute;
right: 20px; /*270px*/
bottom: 75px;
z-index: 1000;
background-color: white;
border-radius: 5px;
border: none;
}
.iii{ .iii{
color: rgba(220, 121, 40, 0.404); color: rgba(220, 121, 40, 0.404);
width: 50px; width: 50px;
......
...@@ -134,6 +134,47 @@ sidtMap.prototype.addInteraction = function() ...@@ -134,6 +134,47 @@ sidtMap.prototype.addInteraction = function()
}); });
this.map.addInteraction(this.interaction); this.map.addInteraction(this.interaction);
$("#drawControl").val("Polygon");
}
sidtMap.prototype.changeInteraction = function() {
this.map.removeInteraction(this.interaction);
var self = this;
var drawValue = $("#drawControl").val();
if (drawValue !== 'Square') {
this.interaction = new ol.interaction.Draw({
source:this.vectorLayer.getSource(),
geometryFunction: new ol.interaction.Draw.createRegularPolygon(4),
features: this.features,
type: "Circle"
});
$("#drawControl").val("Square");
} else {
this.interaction = new ol.interaction.Draw({
source:this.vectorLayer.getSource(),
features: this.features,
type: "Polygon"
});
$("#drawControl").val("Polygon");
}
this.interaction.on("drawend",function(e){
self.showCoords(e.feature.getGeometry());
let processTreeview = $('li.processTreeview a');
let parentClassList = processTreeview[0].parentElement.classList;
if(!parentClassList.contains('menu-open')){
processTreeview.click();
}
});
this.interaction.on("drawstart",function(e){
self.removePolygon();
});
this.map.addInteraction(this.interaction);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
sidtMap.prototype.onMousemove = function(e) sidtMap.prototype.onMousemove = function(e)
......
...@@ -246,6 +246,12 @@ ...@@ -246,6 +246,12 @@
</div> </div>
<!-- control de version de mapas --> <!-- control de version de mapas -->
<!-- control para dibujar el poligono -->
<div id="drawControl" class="drawControl" onclick="osmap.changeInteraction()">
<i class="fas fa-draw-polygon fa-2x iii"></i>
</div>
<!-- control para dibujar el poligono -->
<footer class=" page-footer font-small special-color-dark pt-5" style="bottom: 0; position: absolute"> <footer class=" page-footer font-small special-color-dark pt-5" style="bottom: 0; position: absolute">
<!-- Footer Elements --> <!-- Footer Elements -->
<div class="container"> <div class="container">
......
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