Пример #1
0
        public MainForm()
        {
            InitializeComponent();

            hasOutput = false;
            hasInput = false;
            hasPostProcessor = false;
            hasPreProcessor = false;
            canSave = false;

            currentSelectedLayer = new LayerView();
            copyLayer = new LayerView();

            metaData = new MetaDataPoolModel();

            metaData.SetFactory("standard", new StandLibFactory());
            metaData.SetInputLayer("BasicInputLayer");
            metaData.SetHiddenLayer("BasicLayer");
            metaData.SetHiddenLayer("ThreadedHiddenLayer");
            metaData.SetOutputLayer("BasicOutputLayer");
            metaData.SetNode("BasicNode");
            metaData.SetNode("CustomizableNode");
            metaData.SetTrainingAlgorithm("HillClimbAlgo");

            topologyMetaData = new Dictionary<string, string>();
            topologyMetaDataView = new TopologyMetaDataView(ref metaData);
            topologyMetaDataView.InformationChanged += TopologyMetaDataUpdate;
        }
Пример #2
0
 /// <summary>
 /// Gets the nodes that are currently in the layer.
 /// </summary>
 public LayerView[] GetNodes()
 {
     LayerView[] nodes = new LayerView[nodeLayout.Controls.Count];
     for (int i = 0; i < nodes.Length; i++)
     {
         nodes[i] = (LayerView)nodeLayout.Controls[i];
     }
     return(nodes);
 }
Пример #3
0
        /// <summary>
        /// Loads a topology from a file into the gui.
        /// </summary>
        private void LoadTopology(object sender, EventArgs e)
        {
            openTopology.ShowDialog();
            Dictionary<string, IUserObjectFactory> factories = metaData.GetFactories();
            NetworkSettings settings = new NetworkSettings();
            NetworkTopology topology =
                Topology.Load(openTopology.FileName, ref factories, ref settings,
                            openTopology.FileName.EndsWith(".nntc", true, null));

            topologyMetaData = topology.MetaData;

            AddPreProcessor(null, null);
            GetLayer(0).SetMetaData(topology.PreProcessor.MetaData);

            AddInputLayer(null, null);
            GetLayer(1).SetMetaData(topology.InputLayer.MetaData);

            int row = 2;
            for(int i = 0; i < topology.HiddenLayers.Length; i++)
            {
                AddHiddenLayer(null, null);
                HiddenLayerView layer = (HiddenLayerView)GetLayer(row);
                layer.SetMetaData(topology.HiddenLayers[i].MetaData);
                currentSelectedLayer = layer;

                row++;
            }

            AddOutputLayer(null, null);

            AddPostProcessor(null, null);
        }
Пример #4
0
        /// <summary>
        /// Gets the row of the layer in the topologyDisplay.
        /// </summary>
        /// <param name="layer">The layer to find.</param>
        /// <returns>Returns the row that the layer is at. If the layer could not be
        /// found then -1 is returned.</returns>
        private int GetLayerRow(LayerView layer)
        {
            int row = -1;

            if (topologyDisplay.Controls.Contains(layer))
            {
                row = topologyDisplay.Controls.GetChildIndex(layer, false);
            }

            return row;
        }
Пример #5
0
        /// <summary>
        /// Creates a copy of the currently selected layer.
        /// </summary>
        private void CopySelectedLayer(object sender, EventArgs e)
        {
            if(currentSelectedLayer.GetType() != typeof(HiddenLayerView))
            {
                MessageBox.Show("You can only copy and paste hidden layers.");
                return;
            }

            copyLayer = (LayerView)((HiddenLayerView)currentSelectedLayer).Clone();
        }
Пример #6
0
 /// <summary>
 /// Changes the currently selected object and changes the meta data view
 /// that is loaded.
 /// </summary>
 private void ChangeInformation(object obj, EventArgs args)
 {
     currentSelectedLayer.BorderStyle = BorderStyle.FixedSingle;
     currentSelectedLayer = (LayerView)obj;
     currentSelectedLayer.BorderStyle = BorderStyle.Fixed3D;
     Control info = currentSelectedLayer.GetInformation();
     info.Size = topologyContainer.Panel2.Size;
     if (topologyContainer.Panel2.Controls.Count > 0)
         topologyContainer.Panel2.Controls.RemoveAt(0);
     topologyContainer.Panel2.Controls.Add(info);
 }
Пример #7
0
        /// <summary>
        /// Adds a new item to the topology display.
        /// </summary>
        /// <param name="layer">The layer to add to the display.</param>
        /// <param name="row">The location in the display to add it. If
        /// the value is -1 then the layer is added to the end.</param>
        private void AddTableItem(LayerView layer, int row = -1)
        {
            layer.Width = topologyDisplay.Width - 25;
            layer.Click += new EventHandler(ChangeInformation);

            if (row == -1) row = topologyDisplay.Controls.Count;

            topologyDisplay.Controls.Add(layer);
            if (row < topologyDisplay.Controls.Count)
            {
                topologyDisplay.Controls.SetChildIndex(layer, row);
            }

            UpdateSaveStatus();
        }
Пример #8
0
 /// <summary>
 /// Gets the nodes that are currently in the layer.
 /// </summary>
 public LayerView[] GetNodes()
 {
     LayerView[] nodes = new LayerView[nodeLayout.Controls.Count];
     for (int i = 0; i < nodes.Length; i++)
     {
         nodes[i] = (LayerView)nodeLayout.Controls[i];
     }
     return nodes;
 }