private void DrawingIDType(object sender, EventArgs e)
 {
     if (sender is ToolStripMenuItem item && item.Tag is DrawIDs)
     {
         this.drawID = (DrawIDs)item.Tag;
         recompute   = false;
         ExpireSolution(true);
     }
 }
        public override bool Read(GH_IReader reader)
        {
            int aIndex = -1;

            if (reader.TryGetInt32("DrawIDs", ref aIndex))
            {
                drawID = (DrawIDs)aIndex;
            }

            return(base.Read(reader));
        }
Exemplo n.º 3
0
        public static void DrawElementsID(IGH_PreviewArgs args, double[][] entitiesID, DrawIDs drawType)
        {
            if (entitiesID != null)
            {
                foreach (double[] data in entitiesID)
                {
                    Color color = Color.Aqua;
                    if (data[3] == 1)
                    {
                        color = Color.Gold;
                    }
                    else if (data[3] == 2)
                    {
                        color = Color.DarkGreen;
                    }
                    else if (data[3] == 3)
                    {
                        color = Color.Navy;
                    }

                    Point3d   world = new Point3d(data[0], data[1], data[2]);
                    Transform xform = args.Viewport.GetTransform(CoordinateSystem.World, CoordinateSystem.Screen);
                    world.Transform(xform);
                    Point2d screen = new Point2d(world);

                    switch (drawType)
                    {
                    case DrawIDs.ShowEntities:
                        args.Display.Draw2dText(data[4].ToString(), color, screen, false);
                        break;

                    case DrawIDs.Entities_0D:
                        if (data[3] == 0)
                        {
                            args.Display.Draw2dText(data[4].ToString(), color, screen, false);
                        }
                        break;

                    case DrawIDs.Entities_1D:
                        if (data[3] == 1)
                        {
                            args.Display.Draw2dText(data[4].ToString(), color, screen, false);
                        }
                        break;

                    case DrawIDs.Entities_2D:
                        if (data[3] == 2)
                        {
                            args.Display.Draw2dText(data[4].ToString(), color, screen, false);
                        }
                        break;

                    case DrawIDs.Entities_3D:
                        if (data[3] == 3)
                        {
                            args.Display.Draw2dText(data[4].ToString(), color, screen, false);
                        }
                        break;
                    }
                }
            }
        }