當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。