File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ import { Actions, Mutations } from 'simput/src/stores/types';
1919
2020import registerDefaultProperties from 'simput/src/components/properties/registerDefaults' ;
2121import HookManager from 'simput/src/core/HookManager' ;
22+ import ReaderFactory from 'simput/src/io/ReaderFactory' ;
2223
2324Vue . use ( Vuetify ) ;
2425
@@ -70,10 +71,26 @@ export function createViewer() {
7071
7172 return {
7273 processURLArgs ( ) {
73- const { type } = vtkURLExtract . extractURLParameters ( ) ;
74- if ( type ) {
74+ const { url , type } = vtkURLExtract . extractURLParameters ( ) ;
75+ if ( url || type ) {
7576 // don't flash landing
7677 Store . commit ( Mutations . SHOW_APP ) ;
78+ }
79+
80+ // try URL first, then load type
81+ if ( url ) {
82+ return ReaderFactory . downloadDataset ( 'data.zip' , url ) . then ( ( result ) => {
83+ const { dataset } = result ;
84+ if ( dataset . type && dataset . data ) {
85+ Store . commit ( Mutations . SET_MODEL , {
86+ type : dataset . type ,
87+ data : dataset . data ,
88+ } ) ;
89+ return Store . dispatch ( Actions . LOAD_TEMPLATE , dataset . type ) ;
90+ }
91+ return Promise . reject ( new Error ( 'No model found in download' ) ) ;
92+ } ) ;
93+ } else if ( type ) {
7794 Store . commit ( Mutations . SET_MODEL , {
7895 type,
7996 data : { } ,
You can’t perform that action at this time.
0 commit comments