Changes snap example to allow Circle creations
This commit is contained in:
@@ -29,6 +29,7 @@ tags: "draw, edit, modify, vector, snap"
|
|||||||
<option value="Point">Point</option>
|
<option value="Point">Point</option>
|
||||||
<option value="LineString">LineString</option>
|
<option value="LineString">LineString</option>
|
||||||
<option value="Polygon">Polygon</option>
|
<option value="Polygon">Polygon</option>
|
||||||
|
<option value="Circle">Circle</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -81,6 +81,8 @@ var Draw = {
|
|||||||
this.LineString.setActive(false);
|
this.LineString.setActive(false);
|
||||||
map.addInteraction(this.Polygon);
|
map.addInteraction(this.Polygon);
|
||||||
this.Polygon.setActive(false);
|
this.Polygon.setActive(false);
|
||||||
|
map.addInteraction(this.Circle);
|
||||||
|
this.Circle.setActive(false);
|
||||||
},
|
},
|
||||||
Point: new ol.interaction.Draw({
|
Point: new ol.interaction.Draw({
|
||||||
source: vector.getSource(),
|
source: vector.getSource(),
|
||||||
@@ -94,6 +96,10 @@ var Draw = {
|
|||||||
source: vector.getSource(),
|
source: vector.getSource(),
|
||||||
type: /** @type {ol.geom.GeometryType} */ ('Polygon')
|
type: /** @type {ol.geom.GeometryType} */ ('Polygon')
|
||||||
}),
|
}),
|
||||||
|
Circle: new ol.interaction.Draw({
|
||||||
|
source: vector.getSource(),
|
||||||
|
type: /** @type {ol.geom.GeometryType} */ ('Circle')
|
||||||
|
}),
|
||||||
getActive: function() {
|
getActive: function() {
|
||||||
return this.activeType ? this[this.activeType].getActive() : false;
|
return this.activeType ? this[this.activeType].getActive() : false;
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user