@@ -31,6 +31,7 @@ import Swipe from 'ol-ext/control/Swipe'
31
31
import UndoRedo from 'ol-ext/interaction/UndoRedo'
32
32
import ModifyFeature from 'ol-ext/interaction/ModifyFeature'
33
33
import LayerSwitcher from 'ol-ext/control/LayerSwitcher'
34
+ import DrawRegular from 'ol-ext/interaction/DrawRegular'
34
35
35
36
///Local import
36
37
import RotateNorthControl from './RotateNorthControl'
@@ -55,7 +56,6 @@ function Geo(props) {
55
56
// Vector layer for drawing
56
57
const [ drawVector ] = useState ( new VectorLayer ( {
57
58
name : 'draw' ,
58
- title : "Drawing" ,
59
59
displayInLayerSwitcher : false ,
60
60
source : new VectorSource ( ) ,
61
61
style : geoJsonStyleFunction
@@ -223,7 +223,8 @@ function Geo(props) {
223
223
if ( ! featureEnabled ( 'menu' ) ) mainbar . element . classList . add ( 'nomenu' )
224
224
if ( ( featureEnabled ( 'modify' )
225
225
&& ( featureEnabled ( 'modify:move' ) || featureEnabled ( 'modify:point' ) || featureEnabled ( 'modify:line' )
226
- || featureEnabled ( 'modify:polygon' ) || featureEnabled ( 'modify:undo' ) || featureEnabled ( 'modify:redo' )
226
+ || featureEnabled ( 'modify:polygon' ) || featureEnabled ( 'modify:oval' )
227
+ || featureEnabled ( 'modify:undo' ) || featureEnabled ( 'modify:redo' )
227
228
|| featureEnabled ( 'modify:delete' ) ) )
228
229
|| featureEnabled ( 'save' )
229
230
|| featureEnabled ( 'center' ) )
@@ -250,7 +251,8 @@ function Geo(props) {
250
251
group : false // group controls together
251
252
} ) ;
252
253
if ( featureEnabled ( 'modify:move' ) || featureEnabled ( 'modify:point' ) || featureEnabled ( 'modify:line' )
253
- || featureEnabled ( 'modify:polygon' ) || featureEnabled ( 'modify:undo' ) || featureEnabled ( 'modify:redo' )
254
+ || featureEnabled ( 'modify:polygon' ) || featureEnabled ( 'modify:oval' )
255
+ || featureEnabled ( 'modify:undo' ) || featureEnabled ( 'modify:redo' )
254
256
|| featureEnabled ( 'modify:delete' ) )
255
257
mainbar . addControl ( editbar ) ;
256
258
@@ -291,6 +293,24 @@ function Geo(props) {
291
293
} ) ;
292
294
if ( featureEnabled ( 'modify:point' ) ) editbar . addControl ( pedit ) ;
293
295
296
+ // Add editing tools
297
+ var cedit = new Toggle ( {
298
+ html : '<i class="fa fa-circle" ></i>' ,
299
+ title : 'Oval' ,
300
+ onToggle : ( active ) => {
301
+ olMap . removeInteraction ( snap ) ;
302
+ olMap . removeInteraction ( modify ) ;
303
+ } ,
304
+ interaction : new DrawRegular ( {
305
+ source : drawVector . getSource ( ) ,
306
+ // geometryName: 'geom',
307
+ // condition: ol.events.condition.altKeyOnly,
308
+ sides : 0 ,
309
+ //canRotate: $("#rotation").prop('checked')
310
+ } )
311
+ } ) ;
312
+ if ( featureEnabled ( 'modify:oval' ) ) editbar . addControl ( cedit ) ;
313
+
294
314
var ledit = new Toggle ( {
295
315
html : '<i class="fa fa-share-alt" ></i>' ,
296
316
title : 'Line' ,
@@ -597,7 +617,7 @@ function Geo(props) {
597
617
olMap . forEachFeatureAtPixel ( evt . pixel , function ( feature , layer ) {
598
618
// Vector feature click logic
599
619
if ( ! ( featureEnabled ( 'modify' ) &&
600
- ( pdelete . getActive ( ) || pmove . getActive ( ) ||
620
+ ( pdelete . getActive ( ) || pmove . getActive ( ) || cedit . getActive ( ) ||
601
621
pedit . getActive ( ) || ledit . getActive ( ) || fedit . getActive ( ) ) )
602
622
&& layer && layer . get ( "selectable" ) !== false && feature ) { //only fire event if we are not drawing
603
623
fireEvent ( 'click:feature' , {
0 commit comments