/// <summary> /// Initializes a new instance of the <see cref="MainForm"/> class. /// </summary> public MainForm() { InitializeComponent(); taskList = new List <Action>(); needsUpdate = true; processTasks = ProcessTasks; methodType = BlockMethodType.Precise; objectDiameter = trackObjectDiameter.Value; getOption = checkbox => checkbox.Checked; updateCaption = caption => Text = caption; updateImage = image => graphics.DrawImageUnscaled(image, 0, 0); getFormPosition = PointToClient; MouseUp += (sender, args) => { if (args.Button == MouseButtons.Right) { taskList.Add(() => RecreateDefaultImage()); } }; ClientSize = new Size(DefaultAreaWidth + 250, DefaultAreaHeight); // creates functions stopFunction = (x, y) => activeScenario.IsBlocked(x, y, objectDiameter); }
private void RadioMethodPreciseCheckedChanged(object sender, EventArgs e) { taskList.Add(() => { methodType = radioMethodPrecise.Checked ? BlockMethodType.Precise : BlockMethodType.Fast; RecreateDefaultImage(false); needsUpdate = true; }); }
/// <summary> /// Creates the default image, that will be used as a reset image. /// </summary> /// <param name="obstacleDetectionMethod">Type of the method used to determine whether point is blocked (speed/quality).</param> /// <param name="generateNew">Whether to generate new variant of scenario (where applicable).</param> /// <param name="minimizeHollowAreas">Whether to minimize hollow areas, or not.</param> /// <param name="updateDistanceMap">Whether to recreate the distance map.</param> /// <param name="showDistanceMap">Whether the distance map should be visualized in the target image.</param> public Bitmap CreateDefaultImage(BlockMethodType obstacleDetectionMethod = BlockMethodType.Precise, bool generateNew = true, bool minimizeHollowAreas = false, bool updateDistanceMap = true, bool showDistanceMap = true) { ObstacleDetectionMethod = obstacleDetectionMethod; AreHollowAreasMinimized = minimizeHollowAreas; return(OnCreateDefaultImage(generateNew, updateDistanceMap, showDistanceMap)); }
/// <summary> /// Initializes a new instance of the <see cref="BasePathScenario" /> class. /// </summary> /// <param name="width">The width.</param> /// <param name="height">The height.</param> protected BasePathScenario(int width, int height) { Width = width; Height = height; int volume = Width * Height; Directions = DirectionHelper.GetValues().ToList(); Cache = UseCache ? new BitArray(volume) : null; DistanceMap = new ushort[volume]; IsFirstRun = true; AreHollowAreasMinimized = true; ObstacleDetectionMethod = BlockMethodType.Precise; }