// Done! private Artifact DetectShapes(Point location, ConcreteVisualMap cvm) { var was = this.WorkAreaState; // Lets iterate each Shape in reverse order! for (int i = cvm.Count - 1; i >= 0; --i) { var vmn = cvm[i]; if (vmn.IsLocked == true || vmn.IsVisible == false) { continue; } if (IsArtifactDetectable(location, vmn) == false) { continue; } var isVisible = vmn.Visuals.GeometryPath.IsOutlineVisible(location, vmn.Visuals.Geometry); if (isVisible == true) { was.LastSelectedShape = was.SelectedShape = vmn; return(Artifact.Geometry); } } return(Artifact.None); }
// Done! #region Open/Save Helpers // Done! private void OpenRawFile(string path) { this.VisualMap.Clear(); this.VisualMap = ConcreteVisualMap.LoadFrom(MapFile.XmlRawOpen(path)); var was = this.WorkAreaState; was.IsDirty = true; was.IsSaved = true; this.ForceUpdate(); SafeInvoker(StateChanged, this.WorkAreaState); SafeInvoker(NodeAdded, this.WorkAreaState); }
// Done! private void GenerateNodes() { List <string> temp = new List <string>(); ConcreteVisualMap vm = RealParent.VisualMap; for (int i = 0; i < vm.Count; ++i) { temp.Add(vm[i].ConcreteNode.Name); } temp.Sort(); this.startNode.Items.Clear(); this.closeNode.Items.Clear(); this.startNode.Items.Add(string.Empty); this.closeNode.Items.Add(string.Empty); for (int i = 0; i < temp.Count; ++i) { this.startNode.Items.Add(temp[i]); this.closeNode.Items.Add(temp[i]); } }
// Done! private Artifact DetectExits(Point location, ConcreteVisualMap cvm) { var was = this.WorkAreaState; if (was.ShowExits == false || was.ShowOnlyConnectors == true) { return(Artifact.None); } // Lets iterate each Shape in reverse order! for (int i = cvm.Count - 1; i >= 0; --i) { var vmn = cvm[i]; if (vmn.IsLocked == true || vmn.IsVisible == false) { continue; } if (IsArtifactDetectable(location, vmn) == false) { continue; } var node = vmn.ConcreteNode; int size = vmn.Visuals.ExitSize; // Lets iterate each Exit! for (int k = 0; k < node.Exits.Count; ++k) { var point = Vector.Transform(node.Exits[k].Location, was.Scale, was.DeltaX, was.DeltaY); var isInside = Helpers.IsInsideRectangle(location, new RectangleF(point.X, point.Y, size, size)); if (isInside == true) { was.LastSelectedExit = was.SelectedExit = node.Exits[k]; was.LastSelectedShape = was.SelectedShape = vmn; return(Artifact.Exit); } } } return(Artifact.None); }
// Done! private Artifact DetectArtifact(Point location, ConcreteVisualMap cvm) { var was = this.WorkAreaState; this.ClearArtifactEvents(); if (cvm.Count == 0 || location.X < 0 || location.Y < 0) { return(SetState(was, Artifact.None)); } Artifact a; if (was.IsAnchorOnTop == true) { a = SetState(was, DetectAnchors(location, cvm)); if (a == Artifact.None) { a = SetState(was, DetectShapes(location, cvm)); } if (a != Artifact.None) { return(a); } } else { a = SetState(was, DetectShapes(location, cvm)); if (a == Artifact.None) { a = SetState(was, DetectAnchors(location, cvm)); } if (a != Artifact.None) { return(a); } } return(SetState(was, DetectExits(location, cvm))); }