예제 #1
0
        private void _calculateFilterDepthFromSource(FilterShape filterShape)
        {
            // trace this filter all the way back to the source element (if possible), and remember how 'deep' we are
            // TODO: just reviewing this code I wrote.... why the F**K do we need to trace it back in 'shape' space? Why can't we just keep
            // TODO: following the DFC source back to an element, then look that up in the map?....
            int depth = 1;
            IDataFlowComponent source = _getDataFlowComponentSourceFromShape(filterShape);
            IDataFlowComponent elementComponent = null;
            while (true) {
                if (source == null) {
                    depth = 0;
                    break;
                }

                List<FilterSetupShapeBase> shapes;
                _dataFlowComponentToShapes.TryGetValue(source, out shapes);
                if (shapes != null) {
                    FilterSetupShapeBase shape = shapes.FirstOrDefault();
                    if (shape is ElementNodeShape) {
                        elementComponent = (shape as ElementNodeShape).DataFlowComponent;
                        break;
                    }
                }

                if (source.Source != null) {
                    source = source.Source.Component;
                    depth++;
                } else {
                    depth = 0;
                    break;
                }
            }
            filterShape.LevelsFromElementSource = depth;
            if (elementComponent != null) {
                if (!_elementDataFlowComponentsToMaxFilterDepth.ContainsKey(elementComponent))
                    _elementDataFlowComponentsToMaxFilterDepth[elementComponent] = depth;
                else if (_elementDataFlowComponentsToMaxFilterDepth[elementComponent] < depth)
                    _elementDataFlowComponentsToMaxFilterDepth[elementComponent] = depth;

                if (filterShape.DataFlowComponent != null)
                    _filterDataFlowComponentsToSourceElementDataFlowComponents[filterShape.DataFlowComponent] = elementComponent;
            }
        }
예제 #2
0
 private void _addFilterShapeToList(FilterShape filterShape, List<FilterShape> list)
 {
     if (filterShape != null)
         list.Add(filterShape);
 }
예제 #3
0
 private void _addFilterShapeToParentDataFlowComponentMap(FilterShape filterShape, Dictionary<IDataFlowComponent, List<FilterSetupShapeBase>> map)
 {
     IDataFlowComponent source = _getDataFlowComponentSourceFromShape(filterShape);
     if (source != null) {
         if (!map.ContainsKey(source))
             map[source] = new List<FilterSetupShapeBase>();
         map[source].Add(filterShape);
     }
 }
예제 #4
0
        private void _addFilterShapeToFilterMap(FilterShape filterShape, Dictionary<IOutputFilterModuleInstance, FilterShape> map)
        {
            if (map.ContainsKey(filterShape.FilterInstance))
                Logging.Warn("Adding filter to map, but it already exists");

            map[filterShape.FilterInstance] = filterShape;
        }