/// <summary> /// Runs the detection algorithm und tests for the number of detected parts /// </summary> /// <param name="path"></param> /// <param name="macrocycleType"></param> /// <param name="expectedParts"></param> /// <returns></returns> public static async Task <MacrocycleAnalysis> RunDetection(string path, MacrocycleType macrocycleType, int expectedParts) { var cycle = new Macrocycle(path) { MacrocycleType = macrocycleType }; await cycle.Detect(); Assert.AreEqual(expectedParts, cycle.DetectedParts.Count); return(cycle.DetectedParts[0]); }
public IsolationViewModel(Macrocycle cycle) { if (string.IsNullOrEmpty(_path)) { _path = cycle.Title; } DataObject = cycle; Atoms3D = new ObservableCollection <Atom3D>(DataObject.Atoms.Select(s => new Atom3D(s))); Bonds3D = new ObservableCollection <Bond3D>(DataObject.Bonds.Select(s => new Bond3D(s))); Isolation.CollectionChanged += IsolationOnCollectionChanged; DeleteCommand = new RelayCommand <Atom>(a => Isolation.Remove(a)); }
async Task OnFileChange() { UploadValue = 0; uploadBusy = true; Molecule molecule; DataContext = null; foreach (var file in await fileReaderService.CreateReference(inputFile).EnumerateFilesAsync()) { var fileInfo = await file.ReadFileInfoAsync(); fileInfo.PositionInfo.PositionChanged += (s, e) => { if (e.PercentageDeltaSinceAcknowledge < 2) { return; } UploadValue = e.Percentage; InvokeAsync(StateHasChanged); e.Acknowledge(); }; using MemoryStream memoryStream = await file.CreateMemoryStreamAsync(4096); molecule = await MoleculeFactory.CreateFromStreamAsync(memoryStream, "cif"); var cycle = new Macrocycle(molecule.AtomDataProvider) { Title = fileInfo.Name }; DataContext = new(cycle); break; //stop on first } uploadBusy = false; await fileReaderService.CreateReference(inputFile).ClearValue(); }
public MacrocycleViewModel(Macrocycle cycle) { Macrocycle = cycle; Filename = cycle.Title; }
public MacrocycleViewModel(string path) { Filename = path; Macrocycle = new Macrocycle(Filename); }