public void ShowToolTip(MapperHierarchyNode node) { var point = this.PointToClient(Control.MousePosition); point = new Point(point.X, point.Y + 20); FToolTip.Show(node.Description, this, point); }
public override void Reload() { //clean up FCanvas.Clear(); Foreground.Clear(); Background.Clear(); DepthOffsets.Clear(); if (FRootMapper != null) { FRootMapper.Dispose(); } FRootMapper = new ModelMapper(Input, Registry); FCanvas.Root.Add(Background); FCanvas.Root.Add(Foreground); //start building the tree from the root if (FRootNode != null) { FRootNode.Dispose(); } FRootNode = new MapperHierarchyNode(FRootMapper, FCanvas, Background, this); UpdateView(); ViewAll(); }
public MapperHierarchyNode CreateChildNode(object item) { var mapper = Mapper.CreateChildMapper(item); var node = new MapperHierarchyNode(mapper, FCanvas, FBackground, FViewer); if (FSubTree.Count > 0) { node.FormerSibling = FSubTree[FSubTree.Count - 1]; } return(node); }
public void UpdateBounds() { //special treatment for root if (FBackground.Parent is IDot && !FViewer.ShowRoot) { FBackground.Visible = false; FPoly.Visible = false; FText.Visible = false; FIcon.Visible = false; } else { float offset = 0; if (FViewer.DepthOffsets.ContainsKey(FDepth - 1)) { offset = FViewer.DepthOffsets[FDepth - 1]; } float x = offset + CHorizontalPatchOffset; float y = 0; if (FormerSibling != null) { var stw = FormerSibling.SubTreeWidth; y = FormerSibling.FBackground.Position.Y + stw + CElementOffset; } var height = SubTreeWidth; if (FSubTree.Count > 0) { height -= (CVerticalPatchOffset + CElementOffset); } float width = 0; if (FViewer.DepthOffsets.ContainsKey(FDepth)) { width = FViewer.DepthOffsets[FDepth]; } FBackground.Size = new SizeF(width, height); FPoly.Points.Clear(); FPoly.Points.Add(new PointF(0, height / 2 - 10)); FPoly.Points.Add(new PointF(width - 20, 0)); FPoly.Points.Add(new PointF(width, 0)); FPoly.Points.Add(new PointF(width, height)); FPoly.Points.Add(new PointF(width - 20, height)); FPoly.Points.Add(new PointF(0, height / 2 + 10)); FPoly.IsClosed = true; FText.Position = new PointF(FTextOffset, height / 2 - 10); FIcon.Position = new PointF(3, 3 + height / 2 - 10); FBackground.Position = new PointF(x, y); FBackground.Visible = FSubTree.Count == 0; FPoly.Visible = !FBackground.Visible; } MapperHierarchyNode sibling = null; foreach (var n in FSubTree) { n.FormerSibling = sibling; n.UpdateBounds(); sibling = n; } }