@@ -2092,7 +2092,7 @@ export class MainView extends React.Component<IProps, IStates> {
2092
2092
private _getVectorSourceFromLayerID = (
2093
2093
layerID : string ,
2094
2094
) : VectorSource | undefined => {
2095
- /* get the OL vectorSource corresponding to the JGIS currentDrawLayerID */
2095
+ /* get the OpenLayers VectorSource corresponding to the JGIS currentDrawLayerID */
2096
2096
this . _currentVectorSource = this . _Map
2097
2097
. getLayers ( )
2098
2098
. getArray ( )
@@ -2123,8 +2123,8 @@ export class MainView extends React.Component<IProps, IStates> {
2123
2123
}
2124
2124
const selectedLayerID = Object . keys ( selectedLayers ) [ 0 ] ;
2125
2125
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 ;
2128
2128
if ( this . _currentDrawSourceID ) {
2129
2129
this . _currentDrawSource = this . _model . getSource (
2130
2130
this . _currentDrawSourceID ,
@@ -2247,9 +2247,16 @@ export class MainView extends React.Component<IProps, IStates> {
2247
2247
? Object . keys ( selectedLayers ) [ 0 ]
2248
2248
: undefined ;
2249
2249
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
+ }
2253
2260
}
2254
2261
} ;
2255
2262
0 commit comments