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


C# IShape类代码示例

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


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

示例1: Subject_ChangedForm

 void Subject_ChangedForm(IShape subject, ChangeFormState state)
 {
     if (isAttracted || dragged != subject || !state.HasFlag(ChangeFormState.Coords)) return;
     using (StartFinishAction.Create(() => isAttracted = true, () => isAttracted = false))
     {
         RectangleF rect = subject.Rectangle;
         PointF center = subject.GetCenter(), minDist = new PointF(10, 10), dist = new PointF();
         guidlines = subject.GetCenter();
         hit = 0;
         bool lHit = false;
         foreach (var guide in guides.Where(s => s != subject).Select(s => s.GetCenter()))
         {
             if ((dist.X = Math.Abs(center.X - guide.X)) < minDist.X)
             {
                 minDist.X = dist.X;
                 guidlines.X = guide.X;
                 hit |= 1;
             }
             if ((dist.Y = Math.Abs(center.Y - guide.Y)) < minDist.Y)
             {
                 minDist.Y = dist.Y;
                 guidlines.Y = guide.Y;
                 hit |= 2;
             }
             if (hit == 3) break;
             //if (hit = Math.Abs(rect.Left - guide.X) <= 10)
             //    subject.Left = guide.X;
             //if (hit |= Math.Abs(rect.Top - guide.Y) <= 10)
             //    subject.Top = guide.Y;
             //if (hit) break;
         }
         subject.ToCenterPoint(guidlines);
     }
 }
开发者ID:Basilid,项目名称:Spheres,代码行数:34,代码来源:GuideLine.cs

示例2: Connect

 public static IConnection Connect(this RadDiagram diagram, IShape a, IShape b, string name = null)
 {
     var c = diagram.AddConnection(a, b);
     if (!string.IsNullOrEmpty(name))
         c.Name = name;
     return c;
 }
开发者ID:nukolai,项目名称:xaml-sdk,代码行数:7,代码来源:GraphExtensions.cs

示例3: StaticPhysicalEntity

 public StaticPhysicalEntity(IShape shape, float weight = 1, bool inelasticCollision = false, bool elasticCollision = false)
 {
     Shape = shape;
     InelasticCollision = inelasticCollision;
     ElasticCollision = elasticCollision;
     Weight = weight;
 }
开发者ID:GoodAI,项目名称:BrainSimulator,代码行数:7,代码来源:StaticPhysicalEntity.cs

示例4: Main

        private static void Main()
        {
            var shapes = new IShape[]
            {
                new Rectangle(1.5, 2),
                new Rhombus(4, 5),
                new Circle(30),
                new Circle(1),
                new Circle(2),
                new Rhombus(2, 3),
                new Rectangle(1.1, 1),
            };

            shapes = shapes.ToList().OrderByDescending(a => a.GetType().Name).ToArray(); // this is optional

            var longestTypePad = shapes.Max(a => a.GetType().Name).Length + 2;
            var longestShapePad = shapes.Max(a => a.ToString()).Length + 2;

            foreach (var shape in shapes)
            {
                Console.WriteLine("{0} -> {1} Area: {2,-8:F2} Perimeter: {3:F2}",
                    shape.GetType().Name.PadRight(longestTypePad),
                    shape.ToString().PadRight(longestShapePad),
                    shape.CalculateArea(),
                    shape.CalculatePerimeter());
            }
        }
开发者ID:HouseBreaker,项目名称:OOP,代码行数:27,代码来源:ShapesMain.cs

示例5: AbstractPrefixTreeFilter

 public AbstractPrefixTreeFilter(IShape queryShape, string fieldName, SpatialPrefixTree grid, int detailLevel)
 {
     this.queryShape = queryShape;
     this.fieldName = fieldName;
     this.grid = grid;
     this.detailLevel = detailLevel;
 }
开发者ID:apache,项目名称:lucenenet,代码行数:7,代码来源:AbstractPrefixTreeFilter.cs

示例6: IntersectsPrefixTreeFilter

 public IntersectsPrefixTreeFilter(IShape queryShape, string fieldName, 
                                   SpatialPrefixTree grid, int detailLevel,
                                   int prefixGridScanLevel, bool hasIndexedLeaves)
     : base(queryShape, fieldName, grid, detailLevel, prefixGridScanLevel)
 {
     this.hasIndexedLeaves = hasIndexedLeaves;
 }
开发者ID:apache,项目名称:lucenenet,代码行数:7,代码来源:IntersectsPrefixTreeFilter.cs

示例7: collide

        public static Vector2 collide(IShape a, IShape b)
        {
            if (a is RectangleShape && b is RectangleShape)
            {
                return intersectRectangles((RectangleShape)a, (RectangleShape)b);
            }

            if (a is Circle && b is RectangleShape)
            {
                if (b is Line) return -circleLineDetect((Line)b, (Circle)a);
                return intersectCircleRectangle((Circle) a, (RectangleShape) b);
            }

            if (a is RectangleShape && b is Circle)
            {
                if (a is Line) return circleLineDetect((Line)a, (Circle)b);
                return -intersectCircleRectangle((Circle) b, (RectangleShape) a);
            }

            if (a is Circle && b is Circle)
            {
                return intersectCircles((Circle)a, (Circle)b);
            }

            return Vector2.Zero;
        }
开发者ID:AliMohsen,项目名称:untitled-game,代码行数:26,代码来源:CollisionHelper.cs

示例8: BuildShapeContext

 protected BuildShapeContext(IShape shape, IContent content, string groupId, IShapeFactory shapeFactory) {
     Shape = shape;
     ContentItem = content.ContentItem;
     New = shapeFactory;
     GroupId = groupId;
     FindPlacement = (partType, differentiator, defaultLocation) => new PlacementInfo {Location = defaultLocation, Source = String.Empty};
 }
开发者ID:juaqaai,项目名称:CompanyGroup,代码行数:7,代码来源:BuildShapeContext.cs

示例9: Draw

 public void Draw(IShape shape)
 {
     if (shape is Rectangle) { DrawRectangle(); }
     else if (shape is Circle) { DrawCircle(); }
     // If we want to introduce new shape(s),
     // we have to MODIFY this entity right HERE...
 }
开发者ID:dariusz-wozniak,项目名称:SolidVeryFirstSteps,代码行数:7,代码来源:ShapeDrawingUtility.cs

示例10: UpdateEditorContext

 public UpdateEditorContext(IShape model, IContent content, IUpdateModel updater, string groupInfoId, IShapeFactory shapeFactory, ShapeTable shapeTable, string path)
     : base(model, content, groupInfoId, shapeFactory) {
     
     ShapeTable = shapeTable;
     Updater = updater;
     Path = path;
 }
开发者ID:anycall,项目名称:Orchard,代码行数:7,代码来源:UpdateEditorContext.cs

示例11: Add

 public void Add(IShape item)
 {
     if (!base.List.Contains(item))
     {
         base.List.Add(item);
     }
 }
开发者ID:EdgarEDT,项目名称:myitoppsp,代码行数:7,代码来源:OutlookBarItemCollection.cs

示例12: Remove

 public void Remove(IShape shape)
 {
     if (_shapeList.Contains(shape))
     {
         _shapeList.Remove(shape);
     }
 }
开发者ID:liupanpansmile,项目名称:AgileDevelopmentStudy,代码行数:7,代码来源:CompositeShape.cs

示例13: Add

 public void Add(IShape shape)
 {
     if (shape != null)
     {
         _shapeList.Add(shape);
     }
 }
开发者ID:liupanpansmile,项目名称:AgileDevelopmentStudy,代码行数:7,代码来源:CompositeShape.cs

示例14: FindPlacementImpl

        private static PlacementInfo FindPlacementImpl(ShapeTable shapeTable, IShape shape, string differentiator, string displayType)
        {
            ShapeDescriptor descriptor;
            var shapeType = shape.Metadata.Type;

            if (shapeTable.Descriptors.TryGetValue(shapeType, out descriptor))
            {
                var placementContext = new ShapePlacementContext
                {
                    Shape = shape,
                    DisplayType = displayType,
                    Differentiator = differentiator
                };

                var placement = descriptor.Placement(placementContext);
                if (placement != null)
                {
                    placement.Source = placementContext.Source;
                    return placement;
                }
            }

            return null;

        }
开发者ID:jchenga,项目名称:Orchard2,代码行数:25,代码来源:DisplayManager.cs

示例15: SpatialArgs

 public SpatialArgs(SpatialOperation operation, IShape shape)
 {
     if (operation == null || shape == null)
         throw new ArgumentException("operation and shape are required");
     this.Operation = operation;
     this.Shape = shape;
 }
开发者ID:apache,项目名称:lucenenet,代码行数:7,代码来源:SpatialArgs.cs


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