private void AddFeatures(Node parent, IEnumerable<IFsFeatDefn> features, IDictionary<IFsFeatDefn, object> values) { foreach (IFsFeatDefn feature in features) { var complexFeat = feature as IFsComplexFeature; if (complexFeat != null) { var node = new ComplexFeatureNode(complexFeat) {Image = m_complexImage}; object value; if (values == null || !values.TryGetValue(complexFeat, out value)) value = null; AddFeatures(node, complexFeat.TypeRA.FeaturesRS, (IDictionary<IFsFeatDefn, object>) value); parent.Nodes.Add(node); } else { var closedFeat = feature as IFsClosedFeature; if (closedFeat != null) { var node = new ClosedFeatureNode(closedFeat) {Image = m_closedImage}; object value; if (values != null && values.TryGetValue(closedFeat, out value)) { var closedVal = (ClosedFeatureValue) value; node.IsChecked = closedVal.Negate; node.Value = new SymbolicValue(closedVal.Symbol); } parent.Nodes.Add(node); } } } }
private void AddFeatures(Node parent, IEnumerable <IFsFeatDefn> features, IDictionary <IFsFeatDefn, object> values) { foreach (IFsFeatDefn feature in features) { var complexFeat = feature as IFsComplexFeature; if (complexFeat != null) { // skip complex features without a type specified if (complexFeat.TypeRA == null) { continue; } var node = new ComplexFeatureNode(complexFeat) { Image = m_complexImage }; object value; if (values == null || !values.TryGetValue(complexFeat, out value)) { value = null; } AddFeatures(node, complexFeat.TypeRA.FeaturesRS, (IDictionary <IFsFeatDefn, object>)value); parent.Nodes.Add(node); } else { var closedFeat = feature as IFsClosedFeature; if (closedFeat != null) { var node = new ClosedFeatureNode(closedFeat) { Image = m_closedImage }; object value; if (values != null && values.TryGetValue(closedFeat, out value)) { var closedVal = (ClosedFeatureValue)value; node.IsChecked = closedVal.Negate; node.Value = new SymbolicValue(closedVal.Symbol); } parent.Nodes.Add(node); } } } }