@@ -2092,7 +2092,7 @@ export class MainView extends React.Component<IProps, IStates> {
20922092 private _getVectorSourceFromLayerID = (
20932093 layerID : string ,
20942094 ) : VectorSource | undefined => {
2095- /* get the OL vectorSource corresponding to the JGIS currentDrawLayerID */
2095+ /* get the OpenLayers VectorSource corresponding to the JGIS currentDrawLayerID */
20962096 this . _currentVectorSource = this . _Map
20972097 . getLayers ( )
20982098 . getArray ( )
@@ -2123,8 +2123,8 @@ export class MainView extends React.Component<IProps, IStates> {
21232123 }
21242124 const selectedLayerID = Object . keys ( selectedLayers ) [ 0 ] ;
21252125 this . _currentDrawLayerID = selectedLayerID ;
2126- const jGISLayer = this . _model . getLayer ( selectedLayerID ) ;
2127- this . _currentDrawSourceID = jGISLayer ?. parameters ?. source ;
2126+ const JGISLayer = this . _model . getLayer ( selectedLayerID ) ;
2127+ this . _currentDrawSourceID = JGISLayer ?. parameters ?. source ;
21282128 if ( this . _currentDrawSourceID ) {
21292129 this . _currentDrawSource = this . _model . getSource (
21302130 this . _currentDrawSourceID ,
@@ -2247,9 +2247,16 @@ export class MainView extends React.Component<IProps, IStates> {
22472247 ? Object . keys ( selectedLayers ) [ 0 ]
22482248 : undefined ;
22492249 if ( selectedLayerId && selectedLayerId !== this . _previousDrawLayerID ) {
2250- this . _previousDrawLayerID = selectedLayerId ;
2251- this . _currentDrawLayerID = selectedLayerId ;
2252- this . _editVectorLayer ( ) ;
2250+ const selectedLayer = this . _model . getLayer ( selectedLayerId ) ;
2251+ if ( selectedLayer ) {
2252+ if ( this . _model . checkIfIsADrawVectorLayer ( selectedLayer ) ) {
2253+ this . _previousDrawLayerID = selectedLayerId ;
2254+ this . _currentDrawLayerID = selectedLayerId ;
2255+ this . _editVectorLayer ( ) ;
2256+ } else {
2257+ console . warn ( `${ selectedLayer . name } is not editable` ) ;
2258+ }
2259+ }
22532260 }
22542261 } ;
22552262
0 commit comments