/// <summary> /// Build hierarchy from ParameterDict entries. /// </summary> protected void Init() { foreach (KeyValuePair <string, string> entry in ParameterDict.Current.SortedEntries) { string parameterName = entry.Key; if (!ParameterDict.IsAdditionalInfo(parameterName) && HasEntryControl(parameterName)) { string cat = GetCategory(parameterName); string parentCat = GetCategory(cat); if (!_nodes.ContainsKey(cat)) { TreeNode tNode = new TreeNode(GetName(cat)); tNode.Tag = cat; if (parentCat == ".") { treeView1.Nodes.Add(tNode); } else if (parentCat != "") { if (!_nodes.ContainsKey(parentCat)) { _nodes[parentCat] = new TreeNode(parentCat); _nodes[parentCat].Tag = parentCat; string testParentParent = GetCategory(parentCat); if (testParentParent != "." && _nodes.ContainsKey(parentCat)) { _nodes[testParentParent].Nodes.Add(_nodes[parentCat]); } else { treeView1.Nodes.Add(_nodes[parentCat]); } } // Test, if Parent Node page contains all elements of this node // in this case, the node as subtree is not nececcary. if (NeedSubNodes(parentCat)) { _nodes[parentCat].Nodes.Add(tNode); } } _nodes[cat] = tNode; } } } treeView1.ExpandAll(); }
/// <summary> /// Return true, if node corresponding to given category need subnodes to edit subentries. /// </summary> protected bool NeedSubNodes(string category) { foreach (KeyValuePair <string, string> entry in ParameterDict.Current.SortedEntries) { string parameterName = entry.Key; if (parameterName.StartsWith(category) && ParameterDict.HasControl(parameterName) && parameterName != category) { string tempName = parameterName.Substring(category.Length + 1); if (!tempName.Contains(".")) { return(true); } System.Diagnostics.Debug.WriteLine(parameterName); } } return(false); }
/// <summary> /// Save all dictionary entries into a file. /// </summary> public void Save(string fileName) { XmlTextWriter tw = new XmlTextWriter(fileName, System.Text.Encoding.UTF8); tw.Formatting = System.Xml.Formatting.Indented; tw.WriteStartDocument(); tw.WriteStartElement("ParameterDict"); foreach (KeyValuePair <string, string> entry in SortedEntries) { if (!ParameterDict.IsAdditionalInfo(entry.Key) && !ParameterDict.IsUserSetting(entry.Key)) { tw.WriteStartElement("Entry"); tw.WriteAttributeString("Key", entry.Key); tw.WriteAttributeString("Value", entry.Value); tw.WriteEndElement(); } } tw.WriteEndElement(); tw.WriteEndDocument(); tw.Close(); }
/// <summary> /// Start Computing. Is called while rendering an animation. /// </summary> public void Run(int updateSteps) { _currentProgress = 0; _master.Progress(_currentProgress); System.Diagnostics.Debug.WriteLine("PaintJob.Run " + updateSteps.ToString()); _parameters = ParameterDict.Current.Clone(); _updateSteps = updateSteps; _currentProgressd = 100.0 / (double)(_updateSteps); for (int i = 0; i < _updateSteps; i++) { if (_abort) return; _iterate = new Iterate(_parameters, this, false); if (_lastIterate != null) { _iterate.SetOldData(_lastIterate.GraphicInfo,_lastIterate.PictureData,i); } if (_abort) return; _iterate.StartAsync(); _iterate.Wait(); if (_abort) return; _lastIterate = _iterate; _currentProgress += _currentProgressd; _master.Progress(_currentProgress); } Renderer renderer = PictureArtFactory.Create(_iterate.PictureData, _iterate.LastUsedFormulas); renderer.Paint(_graphics); if (_abort) return; _master.Progress(0); }
public Iterate(ParameterDict parameterDict, IAsyncComputationStarter starter, bool isRightView=false) { _parameterDict = parameterDict; _starter = starter; _width = parameterDict.GetWidth(); _height=parameterDict.GetHeight(); _gData = new GraphicData(_width, _height); _pData = new PictureData(_width, _height); this._isRightView = isRightView; }
public ParameterDictFilter() { _dict = ParameterDict.Current.Clone(); }
/// <summary> /// Control ist filled with all entries which corresponds to the given category. /// </summary> public void Create(string category) { this.Dock = DockStyle.Fill; _category = category; _nodeHash = ParameterDict.Current.GetHashOfName(category); _nodeValueHash = ParameterDict.Current.GetHash(category); // Contain the edit entries before adding to the control List <DataViewElement> oldElements = new List <DataViewElement>(); this.SuspendLayout(); _computedHeight = 0; bool elementAdded = false; { DataViewElement helement = DataViewElementFactory.Create(category.Replace(".", " "), "", "Headline", "", false); oldElements.Add(helement); _computedHeight += DataViewElementFactory.DefaultHeight; } foreach (KeyValuePair <string, string> entry in ParameterDict.Current.SortedEntries) { string parameterName = entry.Key; if (parameterName.StartsWith(category + ".") && ParameterDict.HasControl(parameterName)) { if (parameterName.Length > category.Length) { string tempName = parameterName.Substring(category.Length + 1); if (!tempName.Contains(".")) { DataViewElement dElement = DataViewElementFactory.Create(parameterName, entry.Value, ParameterDict.Current.GetDatatype(parameterName), ParameterDict.Current.GetDescription(parameterName), true); dElement.ElementChanged += new ElementChangedDelegate(_parent.dElement_ElementChanged); oldElements.Add(dElement); dElement.TabIndex = oldElements.Count; _computedHeight += DataViewElementFactory.DefaultHeight; elementAdded = true; } } } } // Wenn kein direktes Unterelement existiert, werden alle Unterelemente eingefügt. string currentCategory = ""; string oldCategory = ""; if (!elementAdded) { // Header: foreach (KeyValuePair <string, string> entry in ParameterDict.Current.SortedEntries) { string parameterName = entry.Key; if (parameterName.StartsWith(category) && ParameterDict.HasControl(parameterName) && !ParameterDict.IsAdditionalInfo(parameterName)) { string[] paraSplit = parameterName.Split('.'); if (paraSplit.Length > 1) { currentCategory = paraSplit[paraSplit.Length - 2]; if (currentCategory != oldCategory) { /* * //DataViewElement helement = DataViewElementFactory.Create(currentCategory, "", "Headline", "", false); * DataViewElement helement = DataViewElementFactory.Create("", "", "Headline", "", false); * oldElements.Add(helement); */ oldCategory = currentCategory; _computedHeight += DataViewElementFactory.DefaultHeight; } } DataViewElement dElement = DataViewElementFactory.Create(parameterName, entry.Value, ParameterDict.Current.GetDatatype(parameterName), ParameterDict.Current.GetDescription(parameterName), true); dElement.ElementChanged += new ElementChangedDelegate(_parent.dElement_ElementChanged); oldElements.Add(dElement); dElement.TabIndex = oldElements.Count; _computedHeight += DataViewElementFactory.DefaultHeight; } } } for (int i = oldElements.Count - 1; i >= 0; i--) { DataViewElement dElement = oldElements[i]; Controls.Add(dElement); } this.ResumeLayout(true); }