Exemplo n.º 1
0
        public void Randomize(Random rd, GAProjectProperties prop)
        {
            PolyPoints.Clear();

            Point p;

            for (int i = 0; i < 4; i++)
            {
                p = new Point(rd.Next(Owner.MaxX), rd.Next(Owner.MaxY));
                PolyPoints.Add(p);
            }

            PolyColor = Color.FromArgb(rd.Next(255), rd.Next(255), rd.Next(255), rd.Next(255));

            int type = rd.Next(3);

            if ((type == 0) && (prop.UseFilledPolygons))
            {
                Type = GAShapeType.Polygon;
            }
            else if ((type == 1) && (prop.UseFilledPolycurves))
            {
                Type = GAShapeType.PolyCurve;
            }
            else if ((type == 2) && (prop.UseLines))
            {
                Type = GAShapeType.Line;
            }
        }
Exemplo n.º 2
0
        public static GAShape ReadBinary(GARepresentation owner, BinaryReader br)
        {
            GAShapeType type = (GAShapeType)br.ReadByte();

            switch (type)
            {
            case GAShapeType.Circle:
                return(new GAShapeCircle(owner, br));

            case GAShapeType.Line:
                return(new GAShapeLine(owner, br));

            case GAShapeType.Curve:
                return(new GAShapeCurve(owner, br));

            case GAShapeType.FilledPolygon:
                return(new GAShapeFilledPolygon(owner, br));

            case GAShapeType.FilledPolycurve:
                return(new GAShapeFilledPolycurve(owner, br));

            case GAShapeType.Path:
                return(new GAShapePath(owner, br));

            default:
                return(null);
            }
        }
Exemplo n.º 3
0
        public void ReadBinary(BinaryReader br)
        {
            Type = (GAShapeType)br.ReadByte();
            switch (Type)
            {
            case GAShapeType.Polygon:
                ReadBinaryColour(br);
                ReadBinaryPoints(br);
                break;

            case GAShapeType.PolyCurve:
                ReadBinaryColour(br);
                ReadBinaryPoints(br);
                break;

            default:
                throw new Exception("GAShape.ReadBinary - Type " + Type.ToString() + " unsupported");
            }
        }