Free cookie consent management tool by TermsFeed Policy Generator

Changeset 576


Ignore:
Timestamp:
09/15/08 13:48:36 (16 years ago)
Author:
gkronber
Message:

added functionality to open the algorithm that generated any model

Location:
trunk/sources/HeuristicLab.CEDMA.Charting
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.CEDMA.Charting/ModelView.Designer.cs

    r567 r576  
    2626      this.splitContainer = new System.Windows.Forms.SplitContainer();
    2727      this.lowerSplitContainer = new System.Windows.Forms.SplitContainer();
     28      this.algoButton = new System.Windows.Forms.Button();
    2829      this.splitContainer.Panel2.SuspendLayout();
    2930      this.splitContainer.SuspendLayout();
     
    3334      // splitContainer
    3435      //
    35       this.splitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
     36      this.splitContainer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     37                  | System.Windows.Forms.AnchorStyles.Left)
     38                  | System.Windows.Forms.AnchorStyles.Right)));
    3639      this.splitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
    3740      this.splitContainer.Location = new System.Drawing.Point(0, 0);
     
    4245      //
    4346      this.splitContainer.Panel2.Controls.Add(this.lowerSplitContainer);
    44       this.splitContainer.Size = new System.Drawing.Size(450, 459);
    45       this.splitContainer.SplitterDistance = 217;
     47      this.splitContainer.Size = new System.Drawing.Size(450, 427);
     48      this.splitContainer.SplitterDistance = 185;
    4649      this.splitContainer.TabIndex = 0;
    4750      //
     
    5659      this.lowerSplitContainer.TabIndex = 0;
    5760      //
     61      // algoButton
     62      //
     63      this.algoButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     64      this.algoButton.Location = new System.Drawing.Point(352, 433);
     65      this.algoButton.Name = "algoButton";
     66      this.algoButton.Size = new System.Drawing.Size(95, 23);
     67      this.algoButton.TabIndex = 1;
     68      this.algoButton.Text = "Open algorithm";
     69      this.algoButton.UseVisualStyleBackColor = true;
     70      this.algoButton.Click += new System.EventHandler(this.algoButton_Click);
     71      //
    5872      // ModelView
    5973      //
    6074      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    6175      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     76      this.Controls.Add(this.algoButton);
    6277      this.Controls.Add(this.splitContainer);
    6378      this.Name = "ModelView";
     
    7489    private System.Windows.Forms.SplitContainer splitContainer;
    7590    private System.Windows.Forms.SplitContainer lowerSplitContainer;
     91    private System.Windows.Forms.Button algoButton;
    7692
    7793  }
  • trunk/sources/HeuristicLab.CEDMA.Charting/ModelView.cs

    r567 r576  
    1919    private IFunctionTree model;
    2020    private int targetVariable;
     21    private Record record;
    2122
    22     public ModelView(Dataset dataset, IFunctionTree model, int targetVariable) {
     23    public ModelView(Record record, Dataset dataset, IFunctionTree model, int targetVariable) {
    2324      InitializeComponent();
    2425      this.dataset = dataset;
    2526      this.model = model;
    2627      this.targetVariable = targetVariable;
     28      this.record = record;
    2729
    2830      splitContainer.Panel1.Controls.Add((Control)model.CreateView());
     
    111113      return control;
    112114    }
     115
     116    private void algoButton_Click(object sender, EventArgs e) {
     117      record.OpenGeneratingAlgorithm();
     118    }
    113119  }
    114120}
  • trunk/sources/HeuristicLab.CEDMA.Charting/Record.cs

    r575 r576  
    108108      resultList.OpenModel(this);
    109109    }
     110
     111    internal void OpenGeneratingAlgorithm() {
     112      resultList.OpenAlgorithm(this);
     113    }
    110114  }
    111115}
  • trunk/sources/HeuristicLab.CEDMA.Charting/ResultList.cs

    r575 r576  
    6363    private readonly Entity rawDataPredicate = new Entity(cedmaNS + "RawData");
    6464    private readonly Entity hasModelPredicate = new Entity(cedmaNS + "Model");
     65    private readonly Entity generatedByPredicate = new Entity(cedmaNS + "GeneratedBy");
    6566    private readonly Entity anyEntity = new Entity(null);
    6667    private Dictionary<Record, Dataset> datasets;
     
    169170        Dataset dataset = GetDataset(record);
    170171
    171         ModelView modelView = new ModelView(dataset, tree, targetVariable);
     172        ModelView modelView = new ModelView(record, dataset, tree, targetVariable);
    172173        PluginManager.ControlManager.ShowControl(modelView);
    173174      }
     
    190191      return datasets[record];
    191192    }
     193
     194    internal void OpenAlgorithm(Record record) {
     195      IList<Statement> generatedBy = store.Select(new Statement(new Entity(record.Uri), generatedByPredicate, anyEntity));
     196      if(generatedBy.Count == 1) {
     197        IList<Statement> algoResult = store.Select(new Statement((Entity)generatedBy[0].Property, rawDataPredicate, anyEntity));
     198        if(algoResult.Count == 1) {
     199          string rawData = ((SerializedLiteral)algoResult[0].Property).RawData;
     200          XmlDocument doc = new XmlDocument();
     201          doc.LoadXml(rawData);
     202          IItem algo = (IItem)PersistenceManager.Restore(doc.ChildNodes[1], new Dictionary<Guid, IStorable>());
     203          PluginManager.ControlManager.ShowControl(algo.CreateView());
     204        }
     205      }
     206    }
    192207  }
    193208}
Note: See TracChangeset for help on using the changeset viewer.