Exemplo n.º 1
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;
		}
Exemplo n.º 2
0
		public AnchorPattern(AnchorPointCollection points)
		{
			this.points = points;
			regIndex = -1;
		}
Exemplo n.º 3
0
		private AnchorPattern(int idx, AnchorPointCollection points)
		{
			this.points = points;
			regIndex = idx;
		}
Exemplo n.º 4
0
		public AnchorPattern()
		{
			points = new AnchorPointCollection();
			regIndex = -1;
		}
Exemplo n.º 5
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);
    }
Exemplo n.º 6
0
 private AnchorPattern(int idx, AnchorPointCollection points)
 {
     this.points = points;
     regIndex    = idx;
 }
Exemplo n.º 7
0
 public AnchorPattern(AnchorPointCollection points)
 {
     this.points = points;
     regIndex    = -1;
 }
Exemplo n.º 8
0
 public AnchorPattern()
 {
     points   = new AnchorPointCollection();
     regIndex = -1;
 }