@@ -1016,71 +1016,73 @@ function convertGeometries(features, data) {
10161016 } ;
10171017 }
10181018
1019- async function storePresetLabel ( labelData ) {
1020- const execId = randomId ( ) ;
1021- const labelId = labelData . id ;
1022- const labelName = labelData . type ;
1023- // const parent = labelData.type;
1024- const noteData = {
1025- id : execId ,
1026- labelId : labelId ,
1027- name : labelName ,
1028- notes : labelData . type ,
1029- } ;
10301019
1031- for ( let i = 0 ; i < $CAMIC . viewer . canvasDrawInstance . getImageFeatureCollection ( )
1032- . features . length ; i ++ ) {
1033- let feature = $CAMIC . viewer . canvasDrawInstance . getImageFeatureCollection ( )
1034- . features [ i ] ;
1035- let collectionName = ( await $CAMIC . store . getCollection ( $CAMIC . slideData . collections [ 0 ] ) ) [ 0 ] . name
1036- let annotJson = {
1037- creator : getUserId ( ) ,
1038- created_date : new Date ( ) ,
1039- collectionId : $CAMIC . slideData [ 'collections' ] [ 0 ] ,
1040- collectionName : collectionName ,
1041- parent : $D . params . labelId ,
1042- provenance : {
1043- image : {
1044- slide : $D . params . slideId ,
1045- name : $CAMIC . slideData [ 'name' ] ,
1020+ async function storePresetLabel ( labelData ) {
1021+ const execId = randomId ( ) ;
1022+ const labelId = labelData . id ;
1023+ const labelName = labelData . type ;
1024+ // const parent = labelData.type;
1025+ const noteData = {
1026+ id : execId ,
1027+ labelId : labelId ,
1028+ name : labelName ,
1029+ notes : labelData . type ,
1030+ } ;
1031+
1032+ for ( let i = 0 ; i < $CAMIC . viewer . canvasDrawInstance . getImageFeatureCollection ( )
1033+ . features . length ; i ++ ) {
1034+ let feature = $CAMIC . viewer . canvasDrawInstance . getImageFeatureCollection ( )
1035+ . features [ i ] ;
1036+ let collectionName = ( await $CAMIC . store . getCollection ( $CAMIC . slideData . collections [ 0 ] ) ) [ 0 ] . name
1037+ var annotJson = {
1038+ creator : getUserId ( ) ,
1039+ created_date : new Date ( ) ,
1040+ collectionId : $CAMIC . slideData [ 'collections' ] [ 0 ] ,
1041+ collectionName : collectionName ,
1042+ parent : $D . params . labelId ,
1043+ provenance : {
1044+ image : {
1045+ slide : $D . params . slideId ,
1046+ name : $CAMIC . slideData [ 'name' ] ,
1047+ } ,
1048+ analysis : {
1049+ coordinates : 'image' ,
1050+ source : 'human' ,
1051+ execution_id : execId , // randomId
1052+ name : labelName , // labelName
1053+ labelId : labelId ,
1054+ type : 'label' ,
1055+ } ,
10461056 } ,
1047- analysis : {
1048- coordinates : 'image' ,
1049- source : 'human' ,
1050- execution_id : execId , // randomId
1051- name : labelName , // labelName
1052- labelId : labelId ,
1053- type : 'label' ,
1057+ properties : {
1058+ annotations : noteData ,
10541059 } ,
1055- } ,
1056- properties : {
1057- annotations : noteData ,
1058- } ,
10591060 } ;
1060- if ( labelData . mode == "grid" ) {
1061- // brush
1062- const values = getGrids (
1063- feature . geometry . coordinates [ 0 ] ,
1064- feature . properties . size ,
1065- ) ;
1066- const set = new Set ( ) ;
1067- values . map ( ( i ) => i . toString ( ) ) . forEach ( ( v ) => set . add ( v ) ) ;
1068- const points = Array . from ( set ) . map ( ( d ) => d . split ( ',' ) ) ;
1069- annotJson . geometries = convertGeometries ( points , {
1070- note : labelData . type ,
1071- size : feature . properties . size ,
1072- color : feature . properties . style . color ,
1073- } )
1074- annotJson . isGrid = true ;
1075- } else {
1076- // point / polygon / stringLine
1077- annotJson . geometries = $CAMIC . viewer . canvasDrawInstance . getImageFeatureCollection ( )
1078- }
1061+ if ( labelData . mode == "grid" ) {
1062+ // brush
1063+ const values = getGrids (
1064+ feature . geometry . coordinates [ 0 ] ,
1065+ feature . properties . size ,
1066+ ) ;
1067+ const set = new Set ( ) ;
1068+ values . map ( ( i ) => i . toString ( ) ) . forEach ( ( v ) => set . add ( v ) ) ;
1069+ const points = Array . from ( set ) . map ( ( d ) => d . split ( ',' ) ) ;
1070+ annotJson . geometries = convertGeometries ( points , {
1071+ note : labelData . type ,
1072+ size : feature . properties . size ,
1073+ color : feature . properties . style . color ,
1074+ } )
1075+ annotJson . isGrid = true ;
1076+ } else {
1077+ // point / polygon / stringLine
1078+ annotJson . geometries = $CAMIC . viewer . canvasDrawInstance . getImageFeatureCollection ( )
1079+ }
10791080 }
10801081 labelsToSave . push ( annotJson )
10811082 annotJson . _id = Date ( ) + randomId ( ) ;
10821083 showAnnotation ( annotJson )
10831084}
1085+
10841086let spen = { }
10851087let mtool = { }
10861088let camicOverrides = x => {
0 commit comments