public IEnumerable <Projection <TValue> > Visit(ViewVertex vertex, Arguments args) { if (CheckDepth(args, vertex)) { yield break; } if (args.Raycasting && (!vertex.View.Displayed(drawClient: args.RaycastClient)))// || !_areaContains(vertex.View, args.Value))) { yield break; } if (!args.ViewDepths.ContainsKey(vertex)) { args.ViewDepths[vertex] = 0; } args.ViewDepths[vertex]++; IVertexBase vertexBase = vertex; foreach (Projection <TValue> projection in Visit(vertexBase, args)) { yield return(projection); if (args.Raycasting) { break; } } args.ViewDepths[vertex]--; }
private bool CheckDepth(Arguments args, ViewVertex view) { return(args.DepthMax > -1 && args.Depth + 1 >= args.DepthMax || args.ViewDepthMax > -1 && args.ViewDepths.TryGetValue(view, out int viewCount) && viewCount + 1 >= args.ViewDepthMax); }