public void importSeedGrowthData() { string filePath = _view.getImportFilePath(); if (filePath != null) { IFormatter formatter = new BinaryFormatter(); try { Stream stream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read); var data = formatter.Deserialize(stream) as SeedGrowthDo; var width = data.seeds.GetLength(0); var height = data.seeds.GetLength(1); _seedGrowth = SeedGrowthFactory.Create(width, height, _neighbourhoodType, _boundoryConditionType); _seedGrowth.setSeeds(data.seeds); _seedGrowth.setGrainMap(data.grainMap); if (isGBCType) { _seedGrowth.useGBC(true); _seedGrowth._activationThreshold = _activationThreshold; } _seedGrowth.OnGrainChange += _seedGrowth_OnIterationComplette; _seedGrowth.init(); } catch (Exception ex) { _view.showExceptionMessage(ex.Message); } } }
public void initializeDomain() { _seedGrowth = SeedGrowthFactory.Create(_width, _height, _neighbourhoodType, _boundoryConditionType); setInitialSeeds(); if (_numberOfInclusions != 0) { _seedGrowth.setInclusions(_numberOfInclusions, _inclusionMinRadius, _inclusionMaxRadius); } if (isGBCType) { _seedGrowth.useGBC(true); _seedGrowth._activationThreshold = _activationThreshold; } _seedGrowth.OnGrainChange += _seedGrowth_OnIterationComplette; _seedGrowth.init(); }
public void refresh() { _seedGrowth.init(); }