internal override bool getAnchorPos(int anchorIdx, ref PointF point) { if (row == -1) { return(base.getAnchorPos(anchorIdx, ref point)); } AnchorPattern rowap = table.getRowAnchorPattern(row); if (rowap != null && anchorIdx >= 0 && anchorIdx < rowap.Points.Count) { AnchorPoint ap = rowap.Points[anchorIdx]; RectangleF targetRect = (ap.Column == -1) ? table.getRowRect(row) : table.getSpannedCellRect(row, ap.Column); point = ap.getPos(targetRect); return(true); } return(false); }
public bool Contains(AnchorPoint obj) { return List.Contains(obj); }
public void Remove(AnchorPoint a) { List.Remove(a); }
public void Insert(int i, AnchorPoint a) { List.Insert(i, a); }
public void Add(AnchorPoint a) { List.Add(a); }
public AnchorPointCollection(AnchorPoint[] array) { foreach (AnchorPoint anchor in array) List.Add(anchor); }
private AnchorPattern ReadAnchorPatternElement( System.Xml.XmlReader reader) { int regIndex = XmlConvert.ToInt32(reader.GetAttribute("RegIndex")); AnchorPattern pattern = null; if (regIndex == Constants.NoAnchorPattern) pattern = null; if (regIndex != -1) pattern = AnchorPattern.getRegisteredPattern(regIndex); // Load the pattern if (regIndex == -1) { AnchorPointCollection points = new AnchorPointCollection(); reader.Read(); int count = XmlConvert.ToInt32(reader.GetAttribute("Count")); for (int i = 0; i < count; i++) { AnchorPoint point = new AnchorPoint(0, 0); reader.Read(); ReadProperties(reader, point, reader.Depth + 1); points.Add(point); } // Points closing tag if (count > 0) reader.Read(); // Anchor pattern closing tag reader.Read(); pattern = new AnchorPattern(points); } return pattern; }
public AnchorPattern(AnchorPoint[] points) { this.points = new AnchorPointCollection(points); regIndex = -1; }
static public AnchorPattern GetAnchorPattern(ModelStencil modelStencil, EditorNode item) { AnchorPointCollection anchorPointCollection = new AnchorPointCollection(); if ((modelStencil != null) && (modelStencil.Anchors != null)) { item.anchorIntToTag.Clear(); item.anchorTagToInt.Clear(); int anchorInt = 0; foreach (Anchor anchor in modelStencil.Anchors) { int anchorPtInt = 0; foreach (SysCAD.Protocol.Point point in anchor.Positions) { Double x = point.X; if (item.MirrorX) x = 100.0 - x; Double y = point.Y; if (item.MirrorY) y = 100.0 - y; MarkStyle markStyle = MarkStyle.Circle; // Use circle in any other case. switch (anchor.Look) { case 0: markStyle = MarkStyle.Circle; break; case 1: markStyle = MarkStyle.Cross; break; case 2: markStyle = MarkStyle.Rectangle; break; case 3: markStyle = MarkStyle.X; break; } AnchorPoint anchorPoint = new AnchorPoint((short)x, (short)y, true, true, markStyle, System.Drawing.Color.Green); anchorPoint.Tag = anchor; anchorPointCollection.Add(anchorPoint); item.anchorIntToTag.Add(anchorInt, anchor.Tag + anchorPtInt.ToString()); item.anchorTagToInt.Add(anchor.Tag + anchorPtInt.ToString(), anchorInt); anchorInt++; anchorPtInt++; } } } return new AnchorPattern(anchorPointCollection); }
public bool Contains(AnchorPoint obj) { return(List.Contains(obj)); }
internal override PointF getEndPoint() { RectangleF rc = table.getRowRect(row); PointF ptp = relativePosition; if (row != -1) { rc = table.getRowRect(row); } else { rc = table.getBoundingRect(); } // use anchor point position if available if (row != -1) { AnchorPattern rowap = table.getRowAnchorPattern(row); if (rowap != null) { // check DestAnchor for incoming arrow if (incoming && arrow.DestAnchor != -1) { AnchorPoint ap = rowap.Points[arrow.DestAnchor]; ptp = new PointF(ap.X, ap.Y); if (ap.Column != -1) { rc = table.getSpannedCellRect(row, ap.Column); } } // check OrgnAnchor for outgoing arrow if (!incoming && arrow.OrgnAnchor != -1) { AnchorPoint ap = rowap.Points[arrow.OrgnAnchor]; ptp = new PointF(ap.X, ap.Y); if (ap.Column != -1) { rc = table.getSpannedCellRect(row, ap.Column); } } } } // calculate point coordinates PointF pt = Utilities.rectPtFromPercent(ptp, rc); // stay within table boundaries RectangleF rcTable = table.getBoundingRect(); if (pt.Y > rcTable.Bottom) { pt.Y = rcTable.Bottom; } if (pt.X > rcTable.Right) { pt.X = rcTable.Right; } return(pt); }