@@ -87,6 +87,8 @@ import { MainViewModel } from './mainviewmodel';
8787import { Spinner } from './spinner' ;
8888import { Geometry , Point } from 'ol/geom' ;
8989import Draw from 'ol/interaction/Draw.js' ;
90+ import Modify from 'ol/interaction/Modify.js' ;
91+ import Snap from 'ol/interaction/Snap.js' ;
9092import { Type } from 'ol/geom/Geometry' ;
9193
9294const drawGeometries = [ 'Point' , 'LineString' , 'Polygon' , 'Circle' ] ;
@@ -2028,11 +2030,27 @@ export class MainView extends React.Component<IProps, IStates> {
20282030 this . _removeCurrentDrawInteraction ( ) ;
20292031 }
20302032 const source = new VectorSource ( ) ;
2033+ const vectorLayer = new VectorLayer ( {
2034+ source : source ,
2035+ style : {
2036+ 'fill-color' : 'rgba(255, 255, 255, 0.2)' ,
2037+ 'stroke-color' : '#ffcc33' ,
2038+ 'stroke-width' : 2 ,
2039+ 'circle-radius' : 7 ,
2040+ 'circle-fill-color' : '#ffcc33'
2041+ }
2042+ } ) ;
2043+ this . _Map . addLayer ( vectorLayer ) ;
2044+ const modify = new Modify ( { source : source } ) ;
2045+ this . _Map . addInteraction ( modify ) ;
20312046 const draw = new Draw ( {
20322047 source : source ,
20332048 type : drawGeometryType as Type // Type being a geometry type here
20342049 } ) ;
2050+ const snap = new Snap ( { source : source } ) ;
2051+
20352052 this . _Map . addInteraction ( draw ) ;
2053+ this . _Map . addInteraction ( snap ) ;
20362054 this . _currentDrawInteraction = draw ;
20372055 this . setState ( old => ( {
20382056 ...old ,
0 commit comments