• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IShape类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Subject_ShapeDrawed

 void Subject_ShapeDrawed(IShape subject, Graphics gr, Size size)
 {
     if (hit == 0 || dragged != subject) return;
     if ((hit & 1) != 0)
         gr.DrawLine(Pens.DeepSkyBlue, guidlines.X, -size.Height, guidlines.X, size.Height);
     if ((hit & 2) != 0)
         gr.DrawLine(Pens.DeepSkyBlue, -size.Width, guidlines.Y, size.Width, guidlines.Y);
 }
开发者ID:Basilid,项目名称:Spheres,代码行数:8,代码来源:GuideLine.cs


示例17: BuildShapeContext

 protected BuildShapeContext(IShape shape, string groupId, IShapeFactory shapeFactory, IShape layout)
 {
     Shape = shape;
     ShapeFactory = shapeFactory;
     GroupId = groupId;
     Layout = layout;
     FindPlacement = FindDefaultPlacement;
 }
开发者ID:catwarrior,项目名称:Orchard2,代码行数:8,代码来源:BuildShapeContext.cs


示例18: AddMultiPointShapeCommand

    public AddMultiPointShapeCommand(IController controller, IShape shape)
      : base(controller) {
      if (shape == null)
        throw new ArgumentNullException("The shape is 'null' and cannot be inserted.");
      this.Text = "Add " + shape.EntityName;


      this.shape = shape;
    }
开发者ID:thunder176,项目名称:HeuristicLab,代码行数:9,代码来源:AddMultiPointShapeCommand.cs


示例19: ModelShapeContext

 protected ModelShapeContext(object model, IShape shape, String displayType, IShapeFactory shapeFactory, ModelShapeContext parentContext)
 {
     Model = model;
     Shape = shape;
     New = shapeFactory;
     FindPlacement = (partType, differentiator, defaultLocation) => new PlacementInfo {Location = defaultLocation, Source = String.Empty};
     ParentContext = parentContext;
     DisplayType = displayType;
 }
开发者ID:rupertwhitlock,项目名称:IncreasinglyAbsorbing,代码行数:9,代码来源:ModelShapeContext.cs


示例20: ShapeDto

 protected ShapeDto(IShape shape,Func<double,double> conversionFunction)
 {
     Area        = ConvertToDto(ConvertToDto(shape.Area, conversionFunction),conversionFunction);
     Perimeter   = ConvertToDto(shape.Perimeter, conversionFunction);
     Center      = shape.Center;
     Min         = shape.Bounds.Min;
     Max         = shape.Bounds.Max;
     Width       = ConvertToDto(shape.Bounds.Width,conversionFunction);
     Height      = ConvertToDto(shape.Bounds.Height, conversionFunction);
 }
开发者ID:BernhardGlueck,项目名称:Phare,代码行数:10,代码来源:ShapeDto.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IShapeFactory类代码示例发布时间:2022-05-24
下一篇:
C# ISettingsService类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap