Пример #1
0
        public EllipseAndRectangleView(TemplateShape shape, EnumShape enumShape)
        {
            WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
            InitializeComponent();
            Title = "Update shape";

            shapeToUpdate = shape;
            shapeToDraw   = enumShape;

            textBox = new List <TextBox>
            {
                textBoxWidth,
                textBoxHeight,
                textBoxThickness
            };
            label = new List <Label>
            {
                labelWidth,
                labelHeight
            };
            textBoxHeight.IsEnabled = false;
            textBoxWidth.IsEnabled  = false;
            labelWidth.IsEnabled    = false;
            labelHeight.IsEnabled   = false;
            fillColor.ItemsSource   = typeof(Colors).GetProperties();
            borderColor.ItemsSource = typeof(Colors).GetProperties();

            OldData();

            buttonDraw.Click += buttonDrawUpdate_Click;
        }
Пример #2
0
        public ImageView(TemplateShape shape, EnumShape enumShape)
        {
            WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
            InitializeComponent();
            Title = "Update image window";

            shapeToUpdate = shape;
            shapeToDraw   = enumShape;
            textBox       = new List <TextBox>
            {
                textBoxWidth,
                textBoxHeight,
            };
            buttons = new List <Button>
            {
                buttonChoose,
                buttonDraw
            };
            label = new List <Label>
            {
                labelWidth,
                labelHeight
            };
            textBoxHeight.IsEnabled = false;
            textBoxWidth.IsEnabled  = false;
            labelWidth.IsEnabled    = false;
            labelHeight.IsEnabled   = false;
            shapeToDraw             = EnumShape.IMAGE;

            OldImageData();

            buttonDraw.Click += buttonDrawUpdate_Click;
        }
Пример #3
0
 internal override void Init(DiagramElement element)
 {
     shape            = ( EnumShape )element;
     txtNewValue.Text = newValueText;
     noNewValue       = true;
     RefreshValues( );
 }
Пример #4
0
        private void Shape_Click(object sender, EventArgs e)
        {
            EnumShape type = (EnumShape)((ToolStripMenuItem)sender).Tag;

            Mesh = TriMeshShape.Instance.CreateShape(type);

            OnChanged(EventArgs.Empty);
        }
        public PolygonView(List <Point> points)
        {
            WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
            InitializeComponent();
            Title = "Drawing polygon";

            fillColor.ItemsSource   = typeof(Colors).GetProperties();
            borderColor.ItemsSource = typeof(Colors).GetProperties();
            pointsForPolygon        = points;
            shapeToDraw             = EnumShape.POLYGON;
            buttonDraw.Click       += buttonDraw_Click;
        }
Пример #6
0
        internal void Relocate(EnumShape shape)
        {
            Diagram diagram = shape.Diagram;

            if (diagram != null)
            {
                Rectangle record = shape.GetMemberRectangle(shape.ActiveMemberIndex);

                Point absolute = new Point(shape.Right, record.Top);
                Size  relative = new Size(( int )(absolute.X * diagram.Zoom) - diagram.Offset.X + MarginSize, ( int )(absolute.Y * diagram.Zoom) - diagram.Offset.Y);
                relative.Height -= (Height - ( int )(record.Height * diagram.Zoom)) / 2;

                Location = ParentLocation + relative;
            }
        }
        public PolygonView(TemplateShape shape, EnumShape enumShape)
        {
            WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
            InitializeComponent();
            Title = "Update polygon window";

            shapeToUpdate           = shape;
            shapeToDraw             = enumShape;
            fillColor.ItemsSource   = typeof(Colors).GetProperties();
            borderColor.ItemsSource = typeof(Colors).GetProperties();
            shapeToDraw             = EnumShape.POLYGON;

            OldPolygonData();

            buttonDraw.Click += buttonDrawUpdate_Click;
        }
Пример #8
0
        public void ChooseTitle()
        {
            foreach (var item in MainWindow.dictionary)
            {
                if (item.Value)
                {
                    switch (item.Key)
                    {
                    case "buttonEllipse":
                        Title       = "Drawing an ellipse";
                        shapeToDraw = EnumShape.ELLIPSE;
                        break;

                    case "buttonRectangle":
                        Title       = "Drawing a rectangle";
                        shapeToDraw = EnumShape.RECTANGLE;
                        break;
                    }
                }
            }
        }
Пример #9
0
        public ImageView(Point point)
        {
            WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
            InitializeComponent();
            Title = "Image window";

            textBox = new List <TextBox>
            {
                textBoxWidth,
                textBoxHeight,
            };
            buttons = new List <Button>
            {
                buttonChoose,
                buttonDraw
            };
            pointToDraw = point;
            shapeToDraw = EnumShape.IMAGE;
            imgPath     = "";

            buttonDraw.Click += buttonDraw_Click;
        }
Пример #10
0
 static JDFAutoHole()
 {
     atrInfoTable[0] = new AtrInfoTable(AttributeName.CENTER, 0x22222222, AttributeInfo.EnumAttributeType.XYPair, null, null);
     atrInfoTable[1] = new AtrInfoTable(AttributeName.EXTENT, 0x22222222, AttributeInfo.EnumAttributeType.XYPair, null, null);
     atrInfoTable[2] = new AtrInfoTable(AttributeName.SHAPE, 0x22222222, AttributeInfo.EnumAttributeType.enumeration, EnumShape.getEnum(0), null);
 }
Пример #11
0
 ///
 ///          <summary> * (9) get attribute Shape </summary>
 ///          * <returns> the value of the attribute </returns>
 ///
 public virtual EnumShape getShape()
 {
     return(EnumShape.getEnum(getAttribute(AttributeName.SHAPE, null, null)));
 }
Пример #12
0
 //         ---------------------------------------------------------------------
 //        Methods for Attribute Shape
 //        ---------------------------------------------------------------------
 ///
 ///          <summary> * (5) set attribute Shape </summary>
 ///          * <param name="enumVar">: the enumVar to set the attribute to </param>
 ///
 public virtual void setShape(EnumShape enumVar)
 {
     setAttribute(AttributeName.SHAPE, enumVar == null ? null : enumVar.getName(), null);
 }
Пример #13
0
        public TriMesh CreateShape(EnumShape shape)
        {
            TriMesh mesh = null;
            switch (shape)
            {
                case EnumShape.Triangle:
                    mesh = CreatePolygon(3);
                    break;
                case EnumShape.Circle:
                    mesh = CreatePolygon(CircleVertex);
                    break;
                case EnumShape.Sqaure:
                    mesh = CreatePolygon(4);
                    break;
                case EnumShape.Pentagon:
                    mesh = CreatePolygon(5);
                    break;
                case EnumShape.Hexagon:
                    mesh = CreatePolygon(6);
                    break;
                case EnumShape.Octagon:
                    mesh = CreatePolygon(8);
                    break;
                case EnumShape.Grid:
                    mesh = CreateGrid(PlaneGridX,PlaneGridY,PlaneGridSizeX,PlaneGridSizeY);
                    break;
                //-----------------
                case EnumShape.Pyramid:
                    mesh = CreateCone(4, Math.Sqrt(2) / 2);
                    break;
                case EnumShape.ConeDemo:
                    mesh = CreateConeDemo(ConeNum, ConfigShape.Instance.ConeHeight);
                    break;
                case EnumShape.Cone:
                    mesh = CreateCone(ConeNum, Math.Sqrt(2) / 2);
                    break;
                case EnumShape.Tet:
                    mesh = CreateCone(3, Math.Sqrt(2) / 2);
                    break;
                //---------------
                case EnumShape.Cube:
                    mesh = CreateCylinder(4, Math.Sqrt(2) / 2);
                    break;
                case EnumShape.Cylinder:
                    mesh = CreateCylinder(50, 1);
                    break;
                case EnumShape.HexagonalPrism:
                    mesh = CreateCylinder(6, 1);
                    break;
                case EnumShape.TriangularPrism:
                    mesh = CreateCylinder(3, 1);
                    break;
                //---------------------
                case EnumShape.Sphere:
                    mesh = CreateSphere(SphereNum);
                    break;

                case EnumShape.CylinderUV:
                    mesh = CreateCylinder(CylinderUVm,CylinderUVn,CylinderUVr,CylinderUVl,CylinderUVMaxU,CylinderUVMaxV,CylinderUVDiff); 
                    break;
                case EnumShape.CylinderUVPlane:
                    mesh = CreateCylinderPlane(CylinderUVm, CylinderUVn, CylinderUVr, CylinderUVl, CylinderUVMaxU, CylinderUVMaxV, CylinderUVDiff);
                    break;
                case EnumShape.CylinderSquare:
                    mesh = CreateCylinderSquare(CylinderUVm, CylinderUVn, CylinderUVr);
                    break;
                case EnumShape.CylinderPlaneSquare:
                    mesh = CreateCylinderPlaneSquare(CylinderUVm, CylinderUVn, CylinderUVr);
                    break;
                case EnumShape.PlaneTest1:
                    mesh = CreatePlaneTest(CylinderUVm, CylinderUVm, CylinderUVr);
                    break;
                case EnumShape.PlaneFolded:
                    mesh = CreatePlaneFolded(CylinderUVm, CylinderUVm, CylinderUVr);
                    break;
             
                default:
                    break;
            }
            mesh.FileName = shape.ToString();
            TriMeshUtil.SetUpNormalVertex(mesh);
          //  TriMeshUtil.MoveToCenter(mesh);
           // TriMeshUtil.ScaleToUnit(mesh, 1.0);

            return mesh;
            
        }
Пример #14
0
 public DeleteEnumMemberCommand(EnumShape enumShape)
 {
     this.enumShape = enumShape;
 }
Пример #15
0
 //────────────────────────────────────────
 public DecorationImpl(EnumNode node, EnumShape shape)
 {
     this.Node = node;
     this.Shape = shape;
     this.Name = "";
 }
Пример #16
0
        //────────────────────────────────────────

        public DecorationImpl(EnumNode node, EnumShape shape)
        {
            this.Node  = node;
            this.Shape = shape;
            this.Name  = "";
        }
Пример #17
0
 public Figure(EnumShape s, EnumColor f = EnumColor.Blanco, EnumColor b = EnumColor.Negro)
 {
     Shape       = s;
     FillColor   = f;
     BorderColor = b;
 }
Пример #18
0
 internal override void Init(DiagramElement element)
 {
     shape = (EnumShape)element;
     base.Init(element);
 }
Пример #19
0
        public TriMesh CreateShape(EnumShape shape)
        {
            TriMesh mesh = null;

            switch (shape)
            {
            case EnumShape.Triangle:
                mesh = CreatePolygon(3);
                break;

            case EnumShape.Circle:
                mesh = CreatePolygon(CircleVertex);
                break;

            case EnumShape.Sqaure:
                mesh = CreatePolygon(4);
                break;

            case EnumShape.Pentagon:
                mesh = CreatePolygon(5);
                break;

            case EnumShape.Hexagon:
                mesh = CreatePolygon(6);
                break;

            case EnumShape.Octagon:
                mesh = CreatePolygon(8);
                break;

            case EnumShape.Grid:
                mesh = CreateGrid(PlaneGridX, PlaneGridY, PlaneGridSizeX, PlaneGridSizeY);
                break;

            //-----------------
            case EnumShape.Pyramid:
                mesh = CreateCone(4, Math.Sqrt(2) / 2);
                break;

            case EnumShape.ConeDemo:
                mesh = CreateConeDemo(ConeNum, ConfigShape.Instance.ConeHeight);
                break;

            case EnumShape.Cone:
                mesh = CreateCone(ConeNum, Math.Sqrt(2) / 2);
                break;

            case EnumShape.Tet:
                mesh = CreateCone(3, Math.Sqrt(2) / 2);
                break;

            //---------------
            case EnumShape.Cube:
                mesh = CreateCylinder(4, Math.Sqrt(2) / 2);
                break;

            case EnumShape.Cylinder:
                mesh = CreateCylinder(50, 1);
                break;

            case EnumShape.HexagonalPrism:
                mesh = CreateCylinder(6, 1);
                break;

            case EnumShape.TriangularPrism:
                mesh = CreateCylinder(3, 1);
                break;

            //---------------------
            case EnumShape.Sphere:
                mesh = CreateSphere(SphereNum);
                break;

            case EnumShape.CylinderUV:
                mesh = CreateCylinder(CylinderUVm, CylinderUVn, CylinderUVr, CylinderUVl, CylinderUVMaxU, CylinderUVMaxV, CylinderUVDiff);
                break;

            case EnumShape.CylinderUVPlane:
                mesh = CreateCylinderPlane(CylinderUVm, CylinderUVn, CylinderUVr, CylinderUVl, CylinderUVMaxU, CylinderUVMaxV, CylinderUVDiff);
                break;

            case EnumShape.CylinderSquare:
                mesh = CreateCylinderSquare(CylinderUVm, CylinderUVn, CylinderUVr);
                break;

            case EnumShape.CylinderPlaneSquare:
                mesh = CreateCylinderPlaneSquare(CylinderUVm, CylinderUVn, CylinderUVr);
                break;

            case EnumShape.PlaneTest1:
                mesh = CreatePlaneTest(CylinderUVm, CylinderUVm, CylinderUVr);
                break;

            case EnumShape.PlaneFolded:
                mesh = CreatePlaneFolded(CylinderUVm, CylinderUVm, CylinderUVr);
                break;

            default:
                break;
            }
            mesh.FileName = shape.ToString();
            TriMeshUtil.SetUpNormalVertex(mesh);
            //  TriMeshUtil.MoveToCenter(mesh);
            // TriMeshUtil.ScaleToUnit(mesh, 1.0);

            return(mesh);
        }
Пример #20
0
 static JDFAutoHoleMakingParams()
 {
     atrInfoTable[0]  = new AtrInfoTable(AttributeName.CENTERREFERENCE, 0x33333331, AttributeInfo.EnumAttributeType.enumeration, EnumCenterReference.getEnum(0), "TrailingEdge");
     atrInfoTable[1]  = new AtrInfoTable(AttributeName.HOLETYPE, 0x22222221, AttributeInfo.EnumAttributeType.enumerations, JDFMedia.EnumHoleType.getEnum(0), null);
     atrInfoTable[2]  = new AtrInfoTable(AttributeName.CENTER, 0x33333333, AttributeInfo.EnumAttributeType.XYPair, null, null);
     atrInfoTable[3]  = new AtrInfoTable(AttributeName.EXTENT, 0x33333333, AttributeInfo.EnumAttributeType.XYPair, null, null);
     atrInfoTable[4]  = new AtrInfoTable(AttributeName.HOLECOUNT, 0x33333311, AttributeInfo.EnumAttributeType.IntegerList, null, null);
     atrInfoTable[5]  = new AtrInfoTable(AttributeName.HOLEREFERENCEEDGE, 0x44444431, AttributeInfo.EnumAttributeType.enumeration, EnumHoleReferenceEdge.getEnum(0), null);
     atrInfoTable[6]  = new AtrInfoTable(AttributeName.SHAPE, 0x33333333, AttributeInfo.EnumAttributeType.enumeration, EnumShape.getEnum(0), null);
     elemInfoTable[0] = new ElemInfoTable(ElementName.HOLE, 0x33333333);
     elemInfoTable[1] = new ElemInfoTable(ElementName.HOLELINE, 0x33333331);
     elemInfoTable[2] = new ElemInfoTable(ElementName.REGISTERMARK, 0x66666661);
 }
Пример #21
0
        public void MaxPlaceableTiles(out int highestCount, bool verbose = false)
        {
            highestCount = 0;
            int        maxFoundColourCount = 0;
            int        maxFoundShapeCount  = 0;
            EnumColour maxFoundColour      = EnumColour.Blue;
            EnumShape  maxFoundShape       = EnumShape.Square;

            //dedup the hand first
            List <Tile> dedupHand = new List <Tile>();

            foreach (Tile candidateTile in tilesInHand)
            {
                if (dedupHand.Count == 0)
                {
                    dedupHand.Add(candidateTile);
                    if (verbose)
                    {
                        Console.WriteLine($"---------First Tile---------\n Adding {candidateTile} as it's unique.");
                    }
                }
                else
                {
                    bool duplicate = false;
                    foreach (Tile dedupTile in dedupHand)
                    {
                        if (Tile.IsDuplicate(candidateTile, dedupTile))
                        {
                            duplicate = true;
                        }
                    }
                    if (duplicate)
                    {
                        Console.WriteLine($"{this.Name}: Not considering {candidateTile} as it's a duplicate.");
                    }
                    else
                    {
                        dedupHand.Add(candidateTile); //if it's not a duplicate, add it to the deduplicated list
                        if (verbose)
                        {
                            Console.WriteLine($"Adding {candidateTile} as it's unique.");
                        }
                    }
                }
                if (verbose)
                {
                    Console.WriteLine("--");
                }
            }
            Console.WriteLine($"The dedup list contains {dedupHand.Count} tiles for {this.Name}");

            //now that the hand is deduplicated, let's check for colour matches
            foreach (EnumColour tempColour in Enum.GetValues(typeof(EnumColour)))        //check for colour matches first
            {
                List <Tile> foundTiles = dedupHand.FindAll(i => i.Colour == tempColour); //find all the tiles in the hand which are of the given colour
                if (foundTiles.Count() > maxFoundColourCount)
                {
                    maxFoundColourCount = foundTiles.Count();
                    maxFoundColour      = tempColour;
                }
            }

            //now shape matches
            foreach (EnumShape tempShape in Enum.GetValues(typeof(EnumShape)))         //check for Shape matches
            {
                List <Tile> foundTiles = dedupHand.FindAll(i => i.Shape == tempShape); //find all the tiles in the hand which are of the given Shape
                if (foundTiles.Count() > maxFoundShapeCount)
                {
                    maxFoundShapeCount = foundTiles.Count();
                    maxFoundShape      = tempShape;
                }
            }

            highestCount = Math.Max(maxFoundColourCount, maxFoundShapeCount);
            dedupHand.Clear();
        }
Пример #22
0
 public static string GetPositionContent(int row, int col, out EnumColour outColour, out EnumShape outShape)
 {
     if (tileGrid[row, col] is null)
     {
         outColour = EnumColour.None;
         outShape  = EnumShape.None;
         return("x");
     }
     else
     {
         outColour = tileGrid[row, col].Colour;
         outShape  = tileGrid[row, col].Shape;
         return(tileGrid[row, col].ToString());
     }
 }
Пример #23
0
 static JDFAutoWireCombBindingParams()
 {
     atrInfoTable[0]  = new AtrInfoTable(AttributeName.FLIPBACKCOVER, 0x33333331, AttributeInfo.EnumAttributeType.boolean_, null, "false");
     atrInfoTable[1]  = new AtrInfoTable(AttributeName.SHAPE, 0x33333333, AttributeInfo.EnumAttributeType.enumeration, EnumShape.getEnum(0), "Single");
     atrInfoTable[2]  = new AtrInfoTable(AttributeName.BRAND, 0x33333333, AttributeInfo.EnumAttributeType.string_, null, null);
     atrInfoTable[3]  = new AtrInfoTable(AttributeName.COLOR, 0x33333333, AttributeInfo.EnumAttributeType.string_, null, null);
     atrInfoTable[4]  = new AtrInfoTable(AttributeName.DIAMETER, 0x33333333, AttributeInfo.EnumAttributeType.double_, null, null);
     atrInfoTable[5]  = new AtrInfoTable(AttributeName.DISTANCE, 0x44444433, AttributeInfo.EnumAttributeType.double_, null, null);
     atrInfoTable[6]  = new AtrInfoTable(AttributeName.MATERIAL, 0x33333333, AttributeInfo.EnumAttributeType.enumeration, EnumMaterial.getEnum(0), null);
     atrInfoTable[7]  = new AtrInfoTable(AttributeName.THICKNESS, 0x33333333, AttributeInfo.EnumAttributeType.double_, null, null);
     elemInfoTable[0] = new ElemInfoTable(ElementName.HOLEMAKINGPARAMS, 0x66666611);
 }