Пример #1
0
        public ColoredPolygonDrawable(ColoredPolygon polygon, ShapeType shapeType = ShapeType.Mesh)
        {
            if (polygon == null) { throw new ArgumentNullException("polygon"); }

            Polygon = polygon;
            BaseShape = shapeType;
        }
Пример #2
0
        public static CircleShape CreateColoredCircle(Scalar radius, ushort vertexCount)
        {
            CircleShape shape = new CircleShape(radius, vertexCount);
            var reduced = VertexHelper.Reduce(shape.Vertexes);
            var polygon = new ColoredPolygon(reduced, CreateColor3Array(reduced.Length));

            shape.Tag = DrawableFactory.GetOrCreateColoredPolygonDrawable(polygon, Drawables.ShapeType.Mesh);
            return shape;
        }
Пример #3
0
        public static IShape GetOrCreateColoredPolygonShape(Vector2D[] vertices, Scalar gridSpacing)
        {
            var reduced = VertexHelper.Reduce(vertices);

            var polygon = new ColoredPolygon(reduced, CreateColor3Array(reduced.Length));

            var shape = _colShapes.GetOrAdd(polygon, p => CreatePolygonShape(p, gridSpacing));

            shape.Tag = polygon;

            return shape;
        }
Пример #4
0
 public static ColoredPolygonDrawable GetOrCreateColoredPolygonDrawable(ColoredPolygon polygon, ShapeType shapeType = ShapeType.Mesh)
 {
     return _colPolygons.GetOrAdd(polygon, p => new ColoredPolygonDrawable(p, shapeType));
 }