public VisionClass(CodeIsland codeIsland, VClass vclass, int x, int y, int r) { CodeIsland = codeIsland; VClass = vclass; X = x; Y = y; R = r; InstructionCount = vclass.VMethods.Sum(vm => vm.InstructionCount); MaintainabilityIndex = vclass.MaintainabilityIndex; CyclomaticComplexity = vclass.CyclomaticComplexity; ClassCoupling = vclass.ClassCoupling; LinesOfCode = vclass.LinesOfCode; }
private static void processOneIsland( List<ArcVertex> lines, CodeIsland island, VProgram vp, Dictionary<string, CodeIsland> modules) { if (island.VAssembly.Is3DParty) return; var arc = new ArcGenerator(4); foreach (var vclass in island.Classes.Values) { var arcStart = lines.Count; var done = new HashSet<VisionClass> {vclass}; foreach (var vmethod in vclass.VClass.VMethods) foreach (var name in vmethod.Calling) { VMethod callTo; if (!vp.VMethods.TryGetValue(name, out callTo)) continue; CodeIsland islandD; if (!modules.TryGetValue(callTo.AssemblyName, out islandD)) continue; var calledClass = islandD.Classes[callTo.VClass.FullName]; vclass.CalledClasses.Add(calledClass); if (done.Contains(calledClass)) continue; done.Add(calledClass); var v1 = island.World.TranslationVector + new Vector3(vclass.X, vclass.Height, vclass.Y); var v2 = islandD.World.TranslationVector + new Vector3(calledClass.X , calledClass.Height, calledClass.Y); var distance = Vector3.Distance(v1, v2)/8; arc.CreateArc( v1, v2, Vector3.Up, distance); var arcStart2 = lines.Count; arc.StoreVertices( lines, (p, f, idx) => { var c = 0.25f + f/2; return new ArcVertex( p, new Color(c, c, 1 - c, 1f), (idx%2) == 1 ? 0 : (MathUtil.TwoPi*(int) (distance/16 + 1))); }); //calledClass.IncomingArcs.Add(new StartAndCount { Start = arcStart2, Count = lines.Count - arcStart2 }); } vclass.OutgoingArcs = new StartAndCount {Start = arcStart, Count = lines.Count - arcStart}; } }
private static CodeIsland createOne(VisionContent vContent, Archipelag archipelag, VAssembly assembly, ref int x, ref int y) { var t = Matrix.Translation(-y*600, -0.5f, -900 - x*600); var codeIsland = new CodeIsland(vContent, archipelag, t, assembly); x++; if (x > 4) { x = 0; y++; } return codeIsland; }