当前位置: 首页>>代码示例>>C#>>正文


C# ShapeType类代码示例

本文整理汇总了C#中ShapeType的典型用法代码示例。如果您正苦于以下问题:C# ShapeType类的具体用法?C# ShapeType怎么用?C# ShapeType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ShapeType类属于命名空间,在下文中一共展示了ShapeType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateShape

        /// <summary>
        /// Creates a shape of the specified Shape Type
        /// </summary>
        public static Shape CreateShape(ShapeType shapeType)
        {
            Console.Clear();
            ViewHeader(shapeType.AsText());

            double[] dimensions = ReadDimensions(shapeType);

            Console.WriteLine();

            switch (shapeType) {
                case ShapeType.Circle:
                    return new Ellipse(dimensions[0]);
                case ShapeType.Sphere:
                    return new Sphere(dimensions[0] / 2);
                case ShapeType.Ellipse:
                    return new Ellipse(dimensions[0], dimensions[1]);
                case ShapeType.Rectangle:
                    return new Rectangle(dimensions[0], dimensions[1]);
                case ShapeType.Cuboid:
                    return new Cuboid(dimensions[0], dimensions[1], dimensions[2]);
                case ShapeType.Cylinder:
                    return new Cylinder(dimensions[0] / 2, dimensions[1] / 2, dimensions[2]);
            }
            return null;
        }
开发者ID:re222dv,项目名称:1DV402-C-sharp,代码行数:28,代码来源:Program.cs

示例2: FoundationCatalogResource

 //Current
 public FoundationCatalogResource(int APIversion,
     uint version,
     FoundationType foundation,
     MaterialList materials,
     Common common,
     uint wallCatalogIndex,
     uint floorCatalogIndex,
     uint vpxyIndex,
     uint index3,
     uint index4,
     uint unknown5,
     uint unknown6,
     ShapeType shape,
     TGIBlockList ltgib)
     : this(APIversion,
     version,
     foundation,
     common,
     wallCatalogIndex,
     floorCatalogIndex,
     index3,
     index4,
     unknown5,
     unknown6,
     shape,
     ltgib)
 {
     if (checking) if (version < 0x00000004)
             throw new InvalidOperationException(String.Format("Version {0} invalid with these arguments", version));
     this.materials = new MaterialList(OnResourceChanged, materials);
     this.vpxyIndex = vpxyIndex;
 }
开发者ID:falerin,项目名称:Sims4Tools,代码行数:33,代码来源:FoundationCatalogResource.cs

示例3: InsertShape

 public void InsertShape(ShapeType shapeType, int xPosition, int yPosition, int width, int height, Color colorName)
 {
     Bitmap temp = this.currentBitmap;
     Bitmap bmap = (Bitmap)temp.Clone();
     Graphics gr = Graphics.FromImage(bmap);
     Pen pen = new Pen(colorName);
     switch (shapeType)
     {
         case ShapeType.FilledEllipse:
             gr.FillEllipse(pen.Brush, xPosition, yPosition, width, height);
             break;
         case ShapeType.FilledRectangle:
             gr.FillRectangle(pen.Brush, xPosition, yPosition, width, height);
             break;
         case ShapeType.Ellipse:
             gr.DrawEllipse(pen, xPosition, yPosition, width, height);
             break;
         case ShapeType.Rectangle:
             gr.DrawRectangle(pen, xPosition, yPosition, width, height);
             break;
         default:
             throw new Exception("unhandled shapetype: " + shapeType);
     }
     this.currentBitmap = (Bitmap)bmap.Clone();
 }
开发者ID:madeso,项目名称:ImBatch,代码行数:25,代码来源:SuperImage.cs

示例4: CreateRagdollBone

        void CreateRagdollBone(string boneName, ShapeType type, Vector3 size, Vector3 position, Quaternion rotation)
        {
            // Find the correct child scene node recursively
            Node boneNode = Node.GetChild(boneName, true);
            if (boneNode == null)
            {
                Log.Warn($"Could not find bone {boneName} for creating ragdoll physics components");
                return;
            }

            RigidBody body = boneNode.CreateComponent<RigidBody>();
            // Set mass to make movable
            body.Mass = 1.0f;
            // Set damping parameters to smooth out the motion
            body.LinearDamping = 0.05f;
            body.AngularDamping = 0.85f;
            // Set rest thresholds to ensure the ragdoll rigid bodies come to rest to not consume CPU endlessly
            body.LinearRestThreshold = 1.5f;
            body.AngularRestThreshold = 2.5f;

            CollisionShape shape = boneNode.CreateComponent<CollisionShape>();
            // We use either a box or a capsule shape for all of the bones
            if (type == ShapeType.SHAPE_BOX)
                shape.SetBox(size, position, rotation);
            else
                shape.SetCapsule(size.X, size.Y, position, rotation);
        }
开发者ID:Type1J,项目名称:AtomicExamples,代码行数:27,代码来源:Ragdoll.cs

示例5: UpdateChildren

 public void UpdateChildren(ShapeType s, GameObject target)
 {
     for (int i = 0; i < ChildCount(); i++)
     {
         this.transform.GetChild(i).GetComponent<ShapeBehavior>().UpdateShape(s, this);
     }
 }
开发者ID:sideshowdave7,项目名称:jellybeanshape,代码行数:7,代码来源:ParentNode.cs

示例6: Create

        public static List<IShapeFlyweight> Create(ShapeType type, int count)
        {
            IShapeFlyweight shape = null;

            switch (type)
            {
                case ShapeType.Square:
                    shape = new Square();
                    break;
                case ShapeType.Circle:
                    shape = new Circle();
                    break;
                case ShapeType.Triangle:
                    shape = new Triangle();
                    break;
                default:
                    throw new InvalidOperationException();
            }

            var shapes = new List<IShapeFlyweight>();
            shapes.Add(shape);

            for (int i = 1; i < count; i++)
            {
                shapes.Add(shape.Clone() as IShapeFlyweight);
            }

            return shapes;
        }
开发者ID:rpattabi,项目名称:designpatterns,代码行数:29,代码来源:ShapeFlyweights.cs

示例7: CreateShape

        private static Shape CreateShape(ShapeType shapeType)
        {
            Console.BackgroundColor = ConsoleColor.DarkGreen;
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("========================================");
            Console.WriteLine("={0,25}             =", shapeType);
            Console.WriteLine("========================================\n");
            Console.ResetColor();

            // Deklarera samt skriver in de olikas värden
            double length = ReadDoubleGreaterThanZero("Ange längden: ");
            double width = ReadDoubleGreaterThanZero("Ange Bredden: ");

            Console.WriteLine();

            // Val av form
            switch (shapeType)
            {
                case ShapeType.Ellipse:
                    return new Ellipse(length, width);
                case ShapeType.Rectangle:
                    return new Rectangle(length, width);
                default:
                    throw new ApplicationException();
            }
        }
开发者ID:rn222cx,项目名称:WP14,代码行数:26,代码来源:Program.cs

示例8: Shape

 /// <summary>
 /// Base Shapefile shape - contains only the shape type and metadata plus helper methods.
 /// An instance of Shape is the Null ShapeType. If the Type field is not ShapeType.Null then
 /// cast to the more specific shape (i.e. ShapePolygon).
 /// </summary>
 /// <param name="shapeType">The ShapeType of the shape</param>
 /// <param name="recordNumber">The record number in the Shapefile</param>
 /// <param name="metadata">Metadata about the shape (optional)</param>
 /// <param name="dataRecord">IDataRecord associated with the shape</param>
 protected internal Shape(ShapeType shapeType, int recordNumber, StringDictionary metadata, IDataRecord dataRecord)
 {
     _type = shapeType;
     _metadata = metadata;
     _recordNumber = recordNumber;
     _dataRecord = dataRecord;
 }
开发者ID:TNOCS,项目名称:csTouch,代码行数:16,代码来源:Shape.cs

示例9: CreateShape

        //Metoden CreateShape skriver ut en header som talar om vilken
        //typ av form vi har valt att skapa och läser in bredd och längd.
        //När värdena är inmatade skapas ett nytt objekt.
        private static Shape CreateShape(ShapeType shapeType)
        {
            double width;
            double length;

            Console.WriteLine();
            Console.BackgroundColor = ConsoleColor.DarkGreen;
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("===========================");
            Console.WriteLine("=                         =");
            Console.WriteLine("= {0,15}         =", shapeType);
            Console.WriteLine("=                         =");
            Console.WriteLine("===========================");
            Console.WriteLine();
            Console.ResetColor();

            width = ReadDoubleGreaterThanZero("Ange bredd: ");
            length = ReadDoubleGreaterThanZero("Ange längd: ");

            switch (shapeType)
            {
                case ShapeType.Ellipse:
                    return new Ellipse(width, length);

                case ShapeType.Rectangle:
                    return new Rectangle(width, length);

                default:
                    throw new ApplicationException();
            }
        }
开发者ID:ed222gg,项目名称:1dv402-cf222ev-2-3-geometriska-figurer,代码行数:34,代码来源:Program.cs

示例10: LineStyle2

        public LineStyle2(SwfReader r, ShapeType shapeType)
        {
            this.Width = r.GetUI16();
            this.StartCapStyle = (CapStyle)r.GetBits(2);
            this.JoinStyle = (JoinStyle)r.GetBits(2);
            this.HasFillFlag = r.GetBit();
            this.NoHScaleFlag = r.GetBit();
            this.NoVScaleFlag = r.GetBit();
            this.PixelHintingFlag = r.GetBit();
            r.GetBits(5); // skip
            this.NoClose = r.GetBit();
            this.EndCapStyle = (CapStyle)r.GetBits(2);

            if (this.JoinStyle == JoinStyle.MiterJoin)
            {
                this.MiterLimitFactor = (float)((r.GetByte() / 0x100) + r.GetByte());
            }

            if (this.HasFillFlag)
            {
                this.FillStyle = FillStyleArray.ParseFillStyle2(r, shapeType);
            }
            else
            {
                this.Color = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), r.GetByte());
            }
        }
开发者ID:Hamsand,项目名称:Swf2XNA,代码行数:27,代码来源:LineStyle2.cs

示例11: ColoredPolygonDrawable

        public ColoredPolygonDrawable(ColoredPolygon polygon, ShapeType shapeType = ShapeType.Mesh)
        {
            if (polygon == null) { throw new ArgumentNullException("polygon"); }

            Polygon = polygon;
            BaseShape = shapeType;
        }
开发者ID:homoluden,项目名称:fukami,代码行数:7,代码来源:PolygonDrawable.cs

示例12: PolygonZShape

        public PolygonZShape(
            int recordNumber,
            StringDictionary metadata,
            CartographicExtent extent,
            int[] parts,
            Rectangular[] positions,
            double minimumZ,
            double maximumZ,
            double[] zValues,
            double minimumMeasure,
            double maximumMeasure,
            double[] measures,
            ShapeType shapeType = ShapeType.PolygonZ
            )
            : base(recordNumber, metadata, extent, parts, positions, minimumMeasure, maximumMeasure, measures, shapeType)
        {
            _minimumZ = minimumZ;
            _maximumZ = maximumZ;

            for (int i = 0; i < parts.Length; ++i)
            {
                int count = ((i == parts.Length - 1) ?
                    positions.Length : parts[i + 1]) - parts[i];

                _parts[i] = new ShapePart(positions, zValues, measures, parts[i], count);
            }
        }
开发者ID:qjw2bqn,项目名称:czml-writer,代码行数:27,代码来源:PolygonZShape.cs

示例13: ShapeInfo

 /// <summary>
 ///     Конструктор
 /// </summary>
 /// <param name="guid">GUID</param>
 /// <param name="type">Тип фигуры</param>
 /// <param name="info">Информация о фигуре</param>
 /// <param name="coordinates">Координаты</param>
 /// <param name="color">Цвет</param>
 public ShapeInfo(Guid guid, ShapeType type, string info, string coordinates, string color)
 {
     Guid = guid;
     Type = type;
     Info = info;
     Coordinates = coordinates;
     Color = color;
 }
开发者ID:5665tm,项目名称:GeometryApp,代码行数:16,代码来源:ShapeInfo.cs

示例14: QuarterCircle

        public QuarterCircle(int cx, int cy, int radius, ShapeType shapeType) : base(shapeType)
        {
            if (radius < 0) throw new ArgumentOutOfRangeException("Radius not allowed to be negative.");

            CX = cx;
            CY = cy;
            Radius = radius;
        }
开发者ID:hl222ih,项目名称:2DV610.1,代码行数:8,代码来源:QuarterCircle.cs

示例15: Reset

 public override void Reset()
 {
     gameObject = null;
     shape = ShapeType.Sphere;
     color = Color.grey;
     radius = 1f;
     size = new Vector3(1f, 1f, 1f);
 }
开发者ID:Streek,项目名称:FSM-Action-Collection-for-UN-PM,代码行数:8,代码来源:DebugDrawShape.cs


注:本文中的ShapeType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。