private void buttonAddLine_Click(object sender, EventArgs e)
        {
            AqLineSegment lineSegment = new AqLineSegment();

            lineSegment.StartX = 20;
            lineSegment.StartY = 20;
            lineSegment.EndX   = 200;
            lineSegment.EndY   = 200;
            aqDisplay1.InteractiveGraphics.Add(lineSegment, "AAA 11111", true);
            aqDisplay1.Update();
        }
示例#2
0
        void DrawLine(float sx, float sy, float ex, float ey, AqVision.Controls.AqDisplay aqDisplay, AqVision.AqColorConstants color, int lineWidth)
        {
            AqLineSegment lineSegment = new AqLineSegment();

            lineSegment.StartX = sx;
            lineSegment.StartY = sy;
            lineSegment.EndX   = ex;
            lineSegment.EndY   = ey;

            lineSegment.Color = color;
            lineSegment.LineWidthInScreenPixels = lineWidth;
            aqDisplay.InteractiveGraphics.Add(lineSegment, "", true);
        }
示例#3
0
        private void button1_Click(object sender, EventArgs e)
        {
            AqLineSegment line = new AqLineSegment();

            line.StartX = 2092 - 20;
            line.StartY = 1151;
            line.EndX   = 2092 + 20;
            line.EndY   = 1151;

            AqLineSegment line2 = new AqLineSegment();

            line2.StartX = 2092;
            line2.StartY = 1151 - 20;
            line2.EndX   = 2092;
            line2.EndY   = 1151 + 20;

            aqDisplayCreateModel.InteractiveGraphics.Add(line, "a", false);
            aqDisplayCreateModel.InteractiveGraphics.Add(line2, "b", false);
            aqDisplayCreateModel.Update();
        }
示例#4
0
        private void ShowGetResultsData(double[] xPointList, double[] yPointList, long[] countPointList, AqColorConstants color, AqDisplay aqDisplayShow)
        {
            Stopwatch st = new Stopwatch();

            st.Start();
            int iPointList = 0;

//             double[] centerX = new double[countPointList.Length];
//             double[] centerY = new double[countPointList.Length];
//             double PlusX = 0;
//             double PlusY = 0;

            for (int countList = 0, countSegement = 0; iPointList < xPointList.Length; iPointList++, countSegement++)
            {
//                 PlusX += xPointList[iPointList];
//                 PlusY += yPointList[iPointList];
                AqLineSegment lineSegment = new AqLineSegment();
                if ((countSegement + 1) == countPointList[countList])
                {
                    lineSegment.StartX = xPointList[iPointList];
                    lineSegment.StartY = yPointList[iPointList];

//                     //保存中心点
//                     centerX[countList] = PlusX / countPointList[countList];
//                     centerY[countList] = PlusY / countPointList[countList];
//                     PlusX = 0;
//                     PlusY = 0;

                    if (countList == 0)
                    {
                        lineSegment.EndX = xPointList[0];
                        lineSegment.EndY = yPointList[0];

                        if ((Math.Abs(xPointList[0] - xPointList[iPointList]) < 0.0001) &&
                            (Math.Abs(yPointList[0] - yPointList[iPointList]) < 0.0001))
                        {
                            lineSegment.EndX = xPointList[0];
                            lineSegment.EndY = yPointList[0];
                            countList++;
                            countSegement = -1;
                        }
                        else
                        {
                            countList++;
                            countSegement = -1;
                            continue;   //不连接
                        }
                    }
                    else
                    {
                        if ((Math.Abs(xPointList[countPointList[countList - 1]] - xPointList[iPointList]) < 0.0001) &&
                            (Math.Abs(yPointList[countPointList[countList - 1]] - yPointList[iPointList]) < 0.0001))
                        {
                            lineSegment.EndX = xPointList[countPointList[countList - 1]];
                            lineSegment.EndY = yPointList[countPointList[countList - 1]];
                            countList++;
                            countSegement = -1;
                        }
                        else
                        {
                            countList++;
                            countSegement = -1;
                            continue;
                        }
                    }
                }
                else
                {
                    lineSegment.StartX = xPointList[iPointList];
                    lineSegment.StartY = yPointList[iPointList];
                    lineSegment.EndX   = xPointList[iPointList + 1];
                    lineSegment.EndY   = yPointList[iPointList + 1];
                }
                lineSegment.Color = color;
                lineSegment.LineWidthInScreenPixels = 3;
                aqDisplayShow.InteractiveGraphics.Add(lineSegment, "AAA 11111", true);
            }
            st.Stop();
            aqDisplayShow.Update();
//             for(int i = 0; i<countPointList.Length; i++)
//             {
//                 listBox1.Items.Add(string.Format("{0}, {1}", centerX[i], centerY[i]));
//             }
            //MessageBox.Show(string.Format("{0},{1},{2} ",st.Elapsed, st.ElapsedMilliseconds, iPointList));//fortest
        }