示例#1
0
        public string[] ExportTemplateCode(int srcCode)
        {
            Outline outLine = null;
            bool    isExistElementTemplate = false;
            int     i;
            int     contourCnt = 1;

            ArrayList arr = new ArrayList();

            setShapeTemplate(arr, srcCode);

            outLine = (Outline)outLines[0];
            getContour(outLine, arr, srcCode);

            for (i = 0; i < outLines.Count; ++i)
            {
                outLine = (Outline)outLines[i];

                //if (outLine is Contour)
                //	continue;
                if (!isExistElementTemplate)
                {
                    setElementTemplate(arr, srcCode);
                    isExistElementTemplate = true;
                }

                if (outLine is Ellipse)
                {
                    getEllipse(i + contourCnt, outLine, arr, srcCode);
                }
                else
                if (outLine is PolyLine)
                {
                    getPolyLine(i + contourCnt, outLine, arr, srcCode);
                }
            }

            if (isExistElementTemplate)
            {
                setEndElementTemplate(arr, srcCode);
            }

            for (i = 1; i < outLines.Count; ++i)
            {
                outLine = (Outline)outLines[i];
                if (outLine is Contour)
                {
                    getContour(outLine, arr, srcCode);
                    contourCnt += 1;
                }
            }


            setEndShapeTemplate(flagDefineTextArea, arr, srcCode);

            string[] str = new string[arr.Count];
            for (i = 0; i < arr.Count; ++i)
            {
                str[i] = arr[i].ToString();
            }

            return(str);
        }
示例#2
0
    protected override void OnMouseMove(System.Windows.Forms.MouseEventArgs e)
    {
      PointF p = new PointF();
      p.X = e.X + (int)scrollX;
      p.Y = e.Y + (int)scrollY;
      SaveCurrX = p.X;
      SaveCurrY = p.Y;

      base.Cursor = Cursors.Default;

      if (flagShowPoints)
      {
        for (int i = 0; i < outLines.Count; ++i)
        {
          Outline outline = (Outline)outLines[i];
          if (outline.checkOverPoint(p))
          {
            base.Cursor = Cursors.SizeAll;
            pointedOutline = outline;
            break;
          }
        }

        if (dragging)
        {
          currOutline.updatePoint(p);
          Invalidate();
        }

        if (pointedOutline != null)
        {
          if (pointedOutline is SegmentedOutline)
            if ((pointedOutline as SegmentedOutline).PointedBezierSegment(p))
              Invalidate();

          if (pointedOutline is Ellipse)
            if ((pointedOutline as Ellipse).isPointedEllipse(p))
              Invalidate();
        }
      }
    }
示例#3
0
    protected override void OnMouseDown(System.Windows.Forms.MouseEventArgs e)
    {
      dragging = false;
      PointF p = new PointF();

      p.X = e.X + scrollX;
      p.Y = e.Y + scrollY;

      if (e.Button == MouseButtons.Right)
      {
        saveNewPosX = p.X;
        saveNewPosY = p.Y;

        this.ContextMenu = CntMenuDecoration;
        for (int i = 0; i < outLines.Count; ++i)
        {
          Outline outLine = (Outline)outLines[i];

          if (outLine is Ellipse && (outLine as Ellipse).getSegmentIndex(p) < distanceToLine)
          {
            currOutline = outLine;
            return;
          }

          if (!(outLine is Ellipse) && outLine.getSegmentIndex(p) > -1)
          {
            saveIndex = i;
            saveOutline = (SegmentedOutline)outLine;
            outLine.addMenuItems(CntMenuSegment, p);
            this.ContextMenu = CntMenuSegment;
            break;
          }
        }

        if (saveOutline != null)
          if (saveOutline.checkOverPoint(p))
          {
            if (saveOutline.isAllowCombineCntMenu(p))
              this.ContextMenu = CntMenuCombine;
          }
      }
      if (e.Button == MouseButtons.Left)
      {
        for (int i = 0; i < outLines.Count; ++i)
        {
          Outline s = (Outline)outLines[i];
          if (s.hitTest(p))
          {
            dragging = true;
            currOutline = s;
            break;
          }
        }
      }
    }
示例#4
0
    private void getPolyLine(int outLineCnt, Outline outLine, ArrayList arr, int srcCode)
    {
      string[] getNames = (outLine as PolyLine).getNamesAsText();

      for (int i = 0; i < getNames.Length; ++i)
      {
        if (srcCode == 0)
          if (outLineCnt != outLines.Count)
            arr.Add(getNames[i] + ",");
          else
            if (i != getNames.Length - 1)
              arr.Add(getNames[i] + ",");
            else
              arr.Add(getNames[i]);

        if (srcCode == 1)
          if (outLineCnt != outLines.Count)
            arr.Add(getNames[i] + ", _ ");
          else
            if (i != getNames.Length - 1)
              arr.Add(getNames[i] + ", _ ");
            else
              arr.Add(getNames[i] + " _ ");
      }
    }
示例#5
0
    private void getContour(Outline outLine, ArrayList arr, int srcCode)
    {
      setElementTemplate(arr, srcCode);

      string[] getNames = (outLine as Contour).getNamesAsText();

      for (int i = 0; i < getNames.Length; ++i)
      {
        if (srcCode == 0)
          if (i != getNames.Length - 1)
            arr.Add(getNames[i] + ",");
          else
            arr.Add(getNames[i]);

        if (srcCode == 1)
          if (i != getNames.Length - 1)
            arr.Add(getNames[i] + ", _ ");
          else
            arr.Add(getNames[i] + " _ ");
      }
      setEndElementTemplate(arr, srcCode);
    }
示例#6
0
    private void getEllipse(int outLineCnt, Outline outLine, ArrayList arr, int srcCode)
    {
      if (srcCode == 0)
        if (outLineCnt != outLines.Count)
          arr.Add((outLine as Ellipse).saveNameAsText() + ",");
        else
          arr.Add((outLine as Ellipse).saveNameAsText());

      if (srcCode == 1)
        if (outLineCnt != outLines.Count)
          arr.Add((outLine as Ellipse).saveNameAsText() + ", _");
        else
          arr.Add((outLine as Ellipse).saveNameAsText() + " _");
    }