Class Scene.Shape
Represents an object's shape, which is in essence a list of points with some additional data provided for each point.
Implements
Inherited Members
Namespace: KD.SDK2
Assembly: KD.SDK2.dll
Syntax
public class Scene.Shape : List<Scene.Shape.Point>, IList<Scene.Shape.Point>, ICollection<Scene.Shape.Point>, IList, ICollection, IReadOnlyList<Scene.Shape.Point>, IReadOnlyCollection<Scene.Shape.Point>, IEnumerable<Scene.Shape.Point>, IEnumerable
Remarks
This class operates on shape string, which can be obtained, for example, from Shape property. Use ToString() method to convert a shape back to its string representation.
This class inherits List<Shape.Point>
, so you
can access individual points as you would do it with generic
list.
Examples
The following example shows how to move a shape.
// This function takes string describing a shape and returns the same
// shape but moved by (dx;dy).
public void MoveActiveShapesByDxDy(Scene scene, double dx, double dy)
{
for(int i = 0; i < scene.Shapes.Count; i++)
{
Scene.Shape shape = new Scene.Shape(scene.Unit, scene.Shapes[i]);
foreach (Scene.Shape.Point point in shape)
{
point.X += dx;
point.Y += dy;
}
scene.Shapes[i] = shape.ToString();
}
}
Constructors
Name | Description |
---|---|
Shape(UnitType, string) | Instantiates Shape object from the given shape string. |
Methods
Name | Description |
---|---|
ToString() | Returns string representation of the shape. |