Exemple #1
0
        private void drawQuadsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            CColor_Cli colorSelected = new CColor_Cli(123, 0, 255);
            string     strTag        = "";

            CPointf_Cli[] pt = new CPointf_Cli[8];
            for (int i = 0; i < 8; i++)
            {
                pt[i] = new CPointf_Cli(0, 0, 0);
            }
            CColor_Cli color = new CColor_Cli((byte)(0.8 * 255), 0, 0);

            BoxPts(ref pt, new CPointf_Cli(0, 0, 0), 0.5, 2, 1);
            _openGraph_Cli.AddQuad(1, pt[1], pt[0], pt[4], pt[5], new CColor_Cli(65, 0, 0), colorSelected, 1, 0, strTag, null);
            _openGraph_Cli.AddQuad(2, pt[3], pt[2], pt[6], pt[7], new CColor_Cli(65, 0, 0), colorSelected, 1, 0, strTag, null);
            _openGraph_Cli.AddQuad(3, pt[2], pt[1], pt[5], pt[6], new CColor_Cli(123, 0, 0), colorSelected, 1, 0, strTag, null);
            _openGraph_Cli.AddQuad(4, pt[0], pt[3], pt[7], pt[4], new CColor_Cli(123, 0, 0), colorSelected, 1, 0, strTag, null);
            _openGraph_Cli.AddQuad(5, pt[0], pt[1], pt[2], pt[3], new CColor_Cli(225, 0, 0), colorSelected, 1, 0, strTag, null);
            _openGraph_Cli.AddQuad(6, pt[7], pt[6], pt[5], pt[4], new CColor_Cli(225, 0, 0), colorSelected, 1, 0, strTag, null);

            List <CPointf_Cli> pt1 = new List <CPointf_Cli>();

            pt1.Add(new CPointf_Cli(-1.5, -1.5, 10));
            pt1.Add(new CPointf_Cli(0, -1.5, 10));

            List <CPointf_Cli> pt2 = new List <CPointf_Cli>();

            pt2.Add(new CPointf_Cli(0, -1.5, 10));
            pt2.Add(new CPointf_Cli(1.5, -1.5, 10));

            List <CPointf_Cli> pt3 = new List <CPointf_Cli>();

            pt3.Add(new CPointf_Cli(0, 1.5, 10));
            pt3.Add(new CPointf_Cli(1.5, 1.5, 10));

            List <CPointf_Cli> pt4 = new List <CPointf_Cli>();

            pt4.Add(new CPointf_Cli(-1.5, 1.5, 10));
            pt4.Add(new CPointf_Cli(0, 1.5, 10));

            List <int> ids = new List <int>();

            ids.Add(7);
            ids.Add(8);
            List <CIdentity_Cli> identity = new List <CIdentity_Cli>();

            _openGraph_Cli.AddQuads(ref identity, ids, pt1, pt2, pt3, pt4, new CColor_Cli(0, 0, 255), colorSelected, 0.5f, 0, strTag, null);
            _openGraph_Cli.AddText(5, 0, new CPointf_Cli(-0.75, 0, 10), "7", new CColor_Cli(125, 123, 0), colorSelected,
                                   CTextAlignment_Cli.ALIGN_LEFT | CTextAlignment_Cli.ALIGN_BOTTOM, CStatus_Cli.STATUS_UNSELECTED);
            _openGraph_Cli.AddText(5, 0, new CPointf_Cli(0.75, 0, 10), "8", new CColor_Cli(125, 123, 0), colorSelected,
                                   CTextAlignment_Cli.ALIGN_LEFT | CTextAlignment_Cli.ALIGN_BOTTOM, CStatus_Cli.STATUS_UNSELECTED);

            _openGraph_Cli.Render();
        }
Exemple #2
0
        private void drawLinesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Random random = new Random();

            const int nNodes         = 300;
            const int nBatches       = 30;
            const int nLinesPerBatch = nNodes / nBatches;

            for (int j = 0; j < nBatches; j++)
            {
                CColor_Cli         color         = new CColor_Cli(((byte)random.Next(0, 256)), ((byte)random.Next(0, 256)), ((byte)random.Next(0, 256)));
                CColor_Cli         colorSelected = new CColor_Cli(255, 0, 0);
                List <CPointf_Cli> pPt1          = new List <CPointf_Cli>();
                List <CPointf_Cli> pPt2          = new List <CPointf_Cli>();
                List <int>         pId           = new List <int>();
                int    nSize = (random.Next(0, 256) % 8);
                string strTag;
                strTag = string.Format("Tag_{0}", j);
                for (int i = 0; i < nLinesPerBatch; i++)
                {
                    double x1 = ((double)random.Next(0, 256) / 256 - 0.5) * 4;
                    double y1 = ((double)random.Next(0, 256) / 256 - 0.5) * 4;
                    double z1 = ((double)random.Next(0, 256) / 256 - 0.5) * 4;
                    double x2 = ((double)random.Next(0, 256) / 256 - 0.3) * 4;
                    double y2 = ((double)random.Next(0, 256) / 256 - 0.2) * 4;
                    double z2 = ((double)random.Next(0, 256) / 256 - 0.4) * 4;
                    int    id = j * nLinesPerBatch + i + 1;
                    pId.Add(id);
                    pPt1.Add(new CPointf_Cli(x1, y1, z1));
                    pPt2.Add(new CPointf_Cli(x2, y2, z2));

                    string strText;
                    strText = string.Format("{0}", id);
                    CPointf_Cli pos = new CPointf_Cli((pPt1[i].X + pPt2[i].X) / 2, (pPt1[i].Y + pPt2[i].Y) / 2, (pPt1[i].Z + pPt2[i].Z) / 2);
                    _openGraph_Cli.AddText(id, 0, pos, strText, new CColor_Cli(255, 0, 0), colorSelected,
                                           CTextAlignment_Cli.ALIGN_LEFT | CTextAlignment_Cli.ALIGN_BOTTOM, CStatus_Cli.STATUS_UNSELECTED);
                }
                List <CIdentity_Cli> pIdentity = new List <CIdentity_Cli>();
                // for performance reason, you should send in your data in batches
                _openGraph_Cli.AddLines(ref pIdentity, pId, pPt1, pPt2, nSize, color, colorSelected, 0, strTag, null);
            }

            _openGraph_Cli.AddLine(99999, new CPointf_Cli(-2, 0, 0), new CPointf_Cli(2, 0, 0), 15, new CColor_Cli(255, 255, 0), new CColor_Cli(0, 255, 255), 0, null, null);
            _openGraph_Cli.AddText(99999, 0, new CPointf_Cli(0, 0, 0), "99999", new CColor_Cli(125, 123, 0), new CColor_Cli(0, 123, 0),
                                   CTextAlignment_Cli.ALIGN_LEFT | CTextAlignment_Cli.ALIGN_BOTTOM, CStatus_Cli.STATUS_UNSELECTED);

            _openGraph_Cli.Render();
        }
Exemple #3
0
        private void BoxPts(ref CPointf_Cli[] pt, CPointf_Cli ptCenter, double fDeltaX, double fDeltaY, double fDeltaZ)
        {
            pt[0].X = ptCenter.X + fDeltaX / 2.0;
            pt[0].Y = ptCenter.Y + fDeltaY / 2.0;
            pt[0].Z = ptCenter.Z + fDeltaZ / 2.0;
            CPointf_Cli.Copy(pt[1], pt[0]);    // jxu: import, CPointf_Cli is reference type
            pt[1].X = ptCenter.X - fDeltaX / 2.0;
            CPointf_Cli.Copy(pt[2], pt[1]);
            pt[2].Y = ptCenter.Y - fDeltaY / 2.0;
            CPointf_Cli.Copy(pt[3], pt[2]);
            pt[3].X = pt[0].X;

            for (int i = 0; i < 4; i++)
            {
                CPointf_Cli.Copy(pt[i + 4], pt[i]);
                pt[i + 4].Z = ptCenter.Z - fDeltaZ / 2.0;
            }
        }
Exemple #4
0
        private void BoxPts(ref CPointf_Cli[] pt, CPointf_Cli ptCenter, double fDeltaX, double fDeltaY, double fDeltaZ)
        {
            pt[0].X = ptCenter.X + fDeltaX / 2.0;
            pt[0].Y = ptCenter.Y + fDeltaY / 2.0;
            pt[0].Z = ptCenter.Z + fDeltaZ / 2.0;
            CPointf_Cli.Copy(pt[1], pt[0]);    // jxu: import, CPointf_Cli is reference type
            pt[1].X = ptCenter.X - fDeltaX / 2.0;
            CPointf_Cli.Copy(pt[2], pt[1]);
            pt[2].Y = ptCenter.Y - fDeltaY / 2.0;
            CPointf_Cli.Copy(pt[3], pt[2]);
            pt[3].X = pt[0].X;

            for (int i = 0; i < 4; i++)
            {
                CPointf_Cli.Copy(pt[i + 4], pt[i]);
                pt[i + 4].Z = ptCenter.Z - fDeltaZ / 2.0;
            }
        }
Exemple #5
0
        private void drawQuadsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            CColor_Cli colorSelected = new CColor_Cli(123, 0, 255);
            string strTag = "";
            CPointf_Cli[] pt = new CPointf_Cli[8];
            for (int i = 0; i < 8; i++ )
            {
                pt[i] = new CPointf_Cli(0, 0, 0);
            }
            CColor_Cli color = new CColor_Cli((byte)(0.8 * 255), 0, 0);
            BoxPts(ref pt, new CPointf_Cli(0, 0, 0), 0.5, 2, 1);
            _openGraph_Cli.AddQuad(1, pt[1], pt[0], pt[4], pt[5], new CColor_Cli(65, 0, 0), colorSelected, 1, 0, strTag, null);
            _openGraph_Cli.AddQuad(2, pt[3], pt[2], pt[6], pt[7], new CColor_Cli(65, 0, 0), colorSelected, 1, 0, strTag, null);
            _openGraph_Cli.AddQuad(3, pt[2], pt[1], pt[5], pt[6], new CColor_Cli(123, 0, 0), colorSelected, 1, 0, strTag, null);
            _openGraph_Cli.AddQuad(4, pt[0], pt[3], pt[7], pt[4], new CColor_Cli(123, 0, 0), colorSelected, 1, 0, strTag, null);
            _openGraph_Cli.AddQuad(5, pt[0], pt[1], pt[2], pt[3], new CColor_Cli(225, 0, 0), colorSelected, 1, 0, strTag, null);
            _openGraph_Cli.AddQuad(6, pt[7], pt[6], pt[5], pt[4], new CColor_Cli(225, 0, 0), colorSelected, 1, 0, strTag, null);

            List<CPointf_Cli> pt1 = new List<CPointf_Cli>();
            pt1.Add(new CPointf_Cli(-1.5, -1.5, 10));
            pt1.Add(new CPointf_Cli(0, -1.5, 10));

            List<CPointf_Cli> pt2 = new List<CPointf_Cli>();
            pt2.Add(new CPointf_Cli(0, -1.5, 10));
            pt2.Add(new CPointf_Cli(1.5, -1.5, 10));

            List<CPointf_Cli> pt3 = new List<CPointf_Cli>();
            pt3.Add(new CPointf_Cli(0, 1.5, 10));
            pt3.Add(new CPointf_Cli(1.5, 1.5, 10));

            List<CPointf_Cli> pt4 = new List<CPointf_Cli>();
            pt4.Add(new CPointf_Cli(-1.5, 1.5, 10));
            pt4.Add(new CPointf_Cli(0, 1.5, 10));

            List<int> ids = new List<int>();
            ids.Add(7);
            ids.Add(8);
            List<CIdentity_Cli> identity = new List<CIdentity_Cli>();
            _openGraph_Cli.AddQuads(ref identity, ids, pt1, pt2, pt3, pt4, new CColor_Cli(0, 0, 255), colorSelected, 0.5f, 0, strTag, null);
            _openGraph_Cli.AddText(5, 0, new CPointf_Cli(-0.75, 0, 10), "7", new CColor_Cli(125, 123, 0), colorSelected,
                CTextAlignment_Cli.ALIGN_LEFT | CTextAlignment_Cli.ALIGN_BOTTOM, CStatus_Cli.STATUS_UNSELECTED);
            _openGraph_Cli.AddText(5, 0, new CPointf_Cli(0.75, 0, 10), "8", new CColor_Cli(125, 123, 0), colorSelected,
                CTextAlignment_Cli.ALIGN_LEFT | CTextAlignment_Cli.ALIGN_BOTTOM, CStatus_Cli.STATUS_UNSELECTED);

            _openGraph_Cli.Render();
        }
Exemple #6
0
        private void drawLinesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Random random = new Random();

            const int nNodes = 300;
            const int nBatches = 30;
            const int nLinesPerBatch = nNodes / nBatches;
            for (int j = 0; j < nBatches; j++)
            {
                CColor_Cli color = new CColor_Cli(((byte)random.Next(0, 256)), ((byte)random.Next(0, 256)), ((byte)random.Next(0, 256)));
                CColor_Cli colorSelected = new CColor_Cli(255, 0, 0);
                List<CPointf_Cli> pPt1 = new List<CPointf_Cli>();
                List<CPointf_Cli> pPt2 = new List<CPointf_Cli>();
                List<int> pId = new List<int>();
                int nSize = (random.Next(0, 256) % 8);
                string strTag;
                strTag = string.Format("Tag_{0}", j);
                for (int i = 0; i < nLinesPerBatch; i++)
                {
                    double x1 = ((double)random.Next(0, 256) / 256 - 0.5) * 4;
                    double y1 = ((double)random.Next(0, 256) / 256 - 0.5) * 4;
                    double z1 = ((double)random.Next(0, 256) / 256 - 0.5) * 4;
                    double x2 = ((double)random.Next(0, 256) / 256 - 0.3) * 4;
                    double y2 = ((double)random.Next(0, 256) / 256 - 0.2) * 4;
                    double z2 = ((double)random.Next(0, 256) / 256 - 0.4) * 4;
                    int id = j * nLinesPerBatch + i + 1;
                    pId.Add(id);
                    pPt1.Add(new CPointf_Cli(x1, y1, z1));
                    pPt2.Add(new CPointf_Cli(x2, y2, z2));

                    string strText;
                    strText = string.Format("{0}", id);
                    CPointf_Cli pos = new CPointf_Cli((pPt1[i].X + pPt2[i].X) / 2, (pPt1[i].Y + pPt2[i].Y) / 2, (pPt1[i].Z + pPt2[i].Z) / 2);
                    _openGraph_Cli.AddText(id, 0, pos, strText, new CColor_Cli(255, 0, 0), colorSelected,
                                        CTextAlignment_Cli.ALIGN_LEFT | CTextAlignment_Cli.ALIGN_BOTTOM, CStatus_Cli.STATUS_UNSELECTED);
                }
                List<CIdentity_Cli> pIdentity = new List<CIdentity_Cli>();
                // for performance reason, you should send in your data in batches
                _openGraph_Cli.AddLines(ref pIdentity, pId, pPt1, pPt2, nSize, color, colorSelected, 0, strTag, null);
            }

            _openGraph_Cli.AddLine(99999, new CPointf_Cli(-2, 0, 0), new CPointf_Cli(2, 0, 0), 15, new CColor_Cli(255, 255, 0), new CColor_Cli(0, 255, 255), 0, null, null);
            _openGraph_Cli.AddText(99999, 0, new CPointf_Cli(0, 0, 0), "99999", new CColor_Cli(125, 123, 0), new CColor_Cli(0, 123, 0),
                CTextAlignment_Cli.ALIGN_LEFT | CTextAlignment_Cli.ALIGN_BOTTOM, CStatus_Cli.STATUS_UNSELECTED);

            _openGraph_Cli.Render();
        }