@@ -33,7 +33,7 @@ import {
33
33
} from './processing' ;
34
34
import { fromLonLat } from 'ol/proj' ;
35
35
import { Coordinate } from 'ol/coordinate' ;
36
- import { targetWithCenterIcon } from './icons' ;
36
+ import { pencilSolidIcon , targetWithCenterIcon } from './icons' ;
37
37
38
38
interface ICreateEntry {
39
39
tracker : JupyterGISTracker ;
@@ -1027,6 +1027,32 @@ export function addCommands(
1027
1027
icon : targetWithCenterIcon
1028
1028
} ) ;
1029
1029
1030
+ commands . addCommand ( CommandIDs . newDrawVectorLayer , {
1031
+ label : trans . __ ( 'Create New Draw Vector Layer' ) ,
1032
+ isToggled : ( ) => {
1033
+ if ( tracker . currentWidget instanceof JupyterGISDocumentWidget ) {
1034
+ const model = tracker . currentWidget ?. content . currentViewModel
1035
+ . jGISModel as IJupyterGISModel ;
1036
+ return model . isDrawVectorLayerEnabled ;
1037
+ } else {
1038
+ return false ;
1039
+ }
1040
+ } ,
1041
+ execute : async ( ) => {
1042
+ if ( tracker . currentWidget instanceof JupyterGISDocumentWidget ) {
1043
+ const model = tracker . currentWidget ?. content . currentViewModel
1044
+ . jGISModel as IJupyterGISModel ;
1045
+ if ( model . isDrawVectorLayerEnabled === true ) {
1046
+ model . isDrawVectorLayerEnabled = false ;
1047
+ } else {
1048
+ model . isDrawVectorLayerEnabled = true ;
1049
+ }
1050
+ commands . notifyCommandChanged ( CommandIDs . newDrawVectorLayer ) ;
1051
+ }
1052
+ } ,
1053
+ icon : pencilSolidIcon
1054
+ } ) ;
1055
+
1030
1056
loadKeybindings ( commands , keybindings ) ;
1031
1057
}
1032
1058
0 commit comments