Пример #1
0
        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);
        }
Пример #2
0
		public bool Contains(AnchorPoint obj)
		{
			return List.Contains(obj);
		}
Пример #3
0
		public void Remove(AnchorPoint a)
		{
			List.Remove(a);
		}
Пример #4
0
		public void Insert(int i, AnchorPoint a)
		{
			List.Insert(i, a);
		}
Пример #5
0
		public void Add(AnchorPoint a)
		{
			List.Add(a);
		}
Пример #6
0
		public AnchorPointCollection(AnchorPoint[] array)
		{
			foreach (AnchorPoint anchor in array)
				List.Add(anchor);
		}
Пример #7
0
		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;
		}
Пример #8
0
		public AnchorPattern(AnchorPoint[] points)
		{
			this.points = new AnchorPointCollection(points);
			regIndex = -1;
		}
Пример #9
0
    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);
    }
Пример #10
0
 public bool Contains(AnchorPoint obj)
 {
     return(List.Contains(obj));
 }
Пример #11
0
 public void Remove(AnchorPoint a)
 {
     List.Remove(a);
 }
Пример #12
0
 public void Insert(int i, AnchorPoint a)
 {
     List.Insert(i, a);
 }
Пример #13
0
 public void Add(AnchorPoint a)
 {
     List.Add(a);
 }
Пример #14
0
        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);
        }