Beispiel #1
0
        /// <summary>
        /// Sets up all the properties of the aggregate necessary for generation, including
        /// lattice type, attractor type and the dimensions of the aggregate.
        /// </summary>
        private void SetUpAggregateProperties()
        {
            // get the selected dimension type
            ComboBoxItem selected_dimension = (ComboBoxItem)(dimension_ComboBox.SelectedValue);
            string       dimension_str      = (string)(selected_dimension.Content);

            // set corresponding lattice_dimension constant
            switch (dimension_str)
            {
            case "2D":
                lattice_dimension = LatticeDimension._2D;
                break;

            case "3D":
                lattice_dimension = LatticeDimension._3D;
                break;
            }
            // reset simulation view
            ResetViewButtonHandler(null, null);
            // switch on current lattice dimension constant
            switch (lattice_dimension)
            {
            case LatticeDimension._2D:
                dla_2d.SetCoeffStick(stickiness_slider.Value);
                // set the lattice type to current selected item
                // of latticeType_ComboBox ui element
                ComboBoxItem       selected_2DlatticeType = (ComboBoxItem)(latticeType_ComboBox.SelectedValue);
                string             lattice_type2D_str     = (string)(selected_2DlatticeType.Content);
                ManagedLatticeType lattice_type2D         = (ManagedLatticeType)Enum.Parse(typeof(ManagedLatticeType), lattice_type2D_str);
                dla_2d.SetLatticeType(lattice_type2D);
                // set the attractor type to current selected item
                // of attractorType_ComboBox ui element
                ComboBoxItem         selected_2DAttractorType = (ComboBoxItem)(attractorType_ComboBox.SelectedValue);
                string               attractor_type2D_str     = (string)(selected_2DAttractorType.Content);
                ManagedAttractorType attractor_type2D         = (ManagedAttractorType)Enum.Parse(typeof(ManagedAttractorType), attractor_type2D_str);
                dla_2d.SetAttractorType(attractor_type2D);
                break;

            case LatticeDimension._3D:
                dla_3d.SetCoeffStick(stickiness_slider.Value);
                // set the lattice type to current selected item
                // of latticeType_ComboBox ui element
                ComboBoxItem       selected_3DlatticeType = (ComboBoxItem)(latticeType_ComboBox.SelectedValue);
                string             lattice_type3D_str     = (string)(selected_3DlatticeType.Content);
                ManagedLatticeType lattice_type3D         = (ManagedLatticeType)Enum.Parse(typeof(ManagedLatticeType), lattice_type3D_str);
                dla_3d.SetLatticeType(lattice_type3D);
                // set the attractor type to current selected item
                // of attractorType_ComboBox ui element
                ComboBoxItem         selected_3DAttractorType = (ComboBoxItem)(attractorType_ComboBox.SelectedValue);
                string               attractor_type3D_str     = (string)(selected_3DAttractorType.Content);
                ManagedAttractorType attractor_type3D         = (ManagedAttractorType)Enum.Parse(typeof(ManagedAttractorType), attractor_type3D_str);
                dla_3d.SetAttractorType(attractor_type3D);
                break;
            }
        }
Beispiel #2
0
        /// <summary>
        /// Sets the value of the attractor_type field corresponding to
        /// selected item in attractorType_ComboBox.
        /// </summary>
        private void HandleAttractorTypeComboBox()
        {
            // get selected attractor type
            ComboBoxItem selected_attractor_type = (ComboBoxItem)(attractorType_ComboBox.SelectedValue);
            string       attractor_type_str      = (string)(selected_attractor_type.Content);

            // set corresponding attractor_type
            if (attractor_type_str == null)
            {
                attractor_type = ManagedAttractorType.Point;
            }
            else
            {
                attractor_type = (ManagedAttractorType)Enum.Parse(typeof(ManagedAttractorType), attractor_type_str);
                switch (attractor_type)
                {
                case ManagedAttractorType.Point:
                    attractorsize_slider.IsEnabled          = false;
                    aboveoroutsidespawnloc_checkbox.Content = "Above Attractor Point";
                    beloworinsidespawnloc_checkbox.Content  = "Below Attractor Point";
                    break;

                case ManagedAttractorType.Line:
                    attractorsize_slider.IsEnabled          = true;
                    aboveoroutsidespawnloc_checkbox.Content = "Above Attractor Line";
                    beloworinsidespawnloc_checkbox.Content  = "Below Attractor Line";
                    break;

                case ManagedAttractorType.Plane:
                    attractorsize_slider.IsEnabled          = true;
                    aboveoroutsidespawnloc_checkbox.Content = "Above Attractor Plane";
                    beloworinsidespawnloc_checkbox.Content  = "Below Attractor Plane";
                    break;

                case ManagedAttractorType.Circle:
                    attractorsize_slider.IsEnabled          = true;
                    aboveoroutsidespawnloc_checkbox.Content = "Outside Attractor Circle";
                    beloworinsidespawnloc_checkbox.Content  = "Inside Attractor Circle";
                    break;
                }
            }
            if (hasFinished && isCleared && attractor_type_str != null)
            {
                aggregate_manager.ClearAggregate();
                RenderAttractorGeometry();
            }
        }
Beispiel #3
0
        //private readonly AggregateComponentManager comp_manager;
        #endregion

        public MainWindow()
        {
            InitializeComponent();
            // initalise aggregate containers and related properties
            dla_2d                      = new ManagedDLA2DContainer();
            dla_3d                      = new ManagedDLA3DContainer();
            current_particles           = 0;
            lattice_dimension           = LatticeDimension._2D;
            current_executing_dimension = lattice_dimension;
            lattice_type                = ManagedLatticeType.Square;
            attractor_type              = ManagedAttractorType.Point;
            // initialise simulation view properties/handles
            aggregate_manager = new AggregateSystemManager();
            WorldModels.Children.Add(aggregate_manager.AggregateSystemModel()); // add model to view
            colour_list = new List <Color>();
            RenderAttractorGeometry();
            // initialise chart related properties/handles
            nrchart           = new NumberRadiusChart();
            ratechart         = new GenerationRateChart();
            chart_type        = ChartType.NUMBERRADIUS;
            Chart.DataContext = nrchart; // default chart data context to Number-Radius chart
            //comp_manager = new AggregateComponentManager();
        }