/// <summary> /// Initialise a point cloud using the specified point locations /// </summary> /// <param name="points"></param> public Cloud(IEnumerable <Vector> points, GeometryAttributes attributes = null) : this(attributes) { foreach (Vector point in points) { _Vertices.Add(new Vertex(point)); } }
/// <summary> /// Initialise an arc from three points /// </summary> /// <param name="startPt">The start point</param> /// <param name="ptOnArc">A point that lies somewhere on the arc</param> /// <param name="endPt">The end point</param> public Arc(Vector startPt, Vector ptOnArc, Vector endPt, GeometryAttributes attributes = null) : this() { Vertices.Add(new Vertex(startPt)); Vertices.Add(new Vertex(ptOnArc)); Vertices.Add(new Vertex(endPt)); Attributes = attributes; }
/// <summary> /// Initialises a new polycurve /// </summary> /// <param name="curves"></param> public PolyCurve(IEnumerable <Curve> curves, GeometryAttributes attributes = null) : this(attributes) { foreach (Curve crv in curves) { SubCurves.Add(crv); } }
/// <summary> /// Initialise an arc defined between start and end angles on a circle /// </summary> /// <param name="circle"></param> /// <param name="startAngle"></param> /// <param name="endAngle"></param> public Arc(Circle circle, Angle startAngle, Angle endAngle, GeometryAttributes attributes = null) : this() { Vertices.Add(new Vertex(circle.PointAt(startAngle))); Vertices.Add(new Vertex(circle.PointAt(startAngle + (endAngle - startAngle).NormalizeTo2PI() / 2))); Vertices.Add(new Vertex(circle.PointAt(endAngle))); _Circle = circle; Attributes = attributes; }
/// <summary> /// Initialise an arc that forms a complete circle /// </summary> /// <param name="circle"></param> public Arc(Circle circle, GeometryAttributes attributes = null) : this() { Vertices.Add(new Vertex(circle.PointAt(0.0))); Vertices.Add(new Vertex(circle.PointAt(Math.PI))); Vertices.Add(new Vertex(circle.PointAt(2 * Math.PI))); Closed = true; _Circle = circle; Attributes = attributes; }
/// <summary> /// Points constructor. /// Creates a polyline between the specified set of points /// </summary> /// <param name="points"></param> /// <param name="close"></param> public PolyLine(IEnumerable <Vector> points, bool close, GeometryAttributes attributes = null) : this() { foreach (Vector pt in points) { Vertices.Add(new Vertex(pt)); } Closed = close; Attributes = attributes; }
/// <summary> /// Initialises a new label with a bound text value /// </summary> /// <param name="position"></param> /// <param name="textBinding"></param> /// <param name="textSize"></param> /// <param name="verticalSetOut"></param> /// <param name="horizontalSetOut"></param> /// <param name="attributes"></param> public Label(Vector position, PathBinding textBinding, double textSize = 1.0, VerticalSetOut verticalSetOut = VerticalSetOut.Top, HorizontalSetOut horizontalSetOut = HorizontalSetOut.Left, GeometryAttributes attributes = null) : base(position) { TextBinding = textBinding; TextSize = textSize; VerticalSetOut = verticalSetOut; HorizontalSetOut = horizontalSetOut; Attributes = attributes; }
/// <summary> /// Initialise an attributes object copying properties from another /// </summary> /// <param name="other">Another set of geometry attributes. This may be null, /// in which case default values will be retained.</param> public GeometryAttributes(GeometryAttributes other) { if (other != null) { _SourceID = other.SourceID; _LayerName = other.LayerName; Brush = other.Brush; Weight = other.Weight; _Interactive = other.Interactive; } }
/// <summary> /// Do all pieces of geometry in this collection have the specified attributes object? /// </summary> /// <typeparam name="T"></typeparam> /// <param name="geometry"></param> /// <param name="attributes"></param> /// <returns></returns> public static bool AllHaveAttributes <T>(this IList <T> geometry, GeometryAttributes attributes) where T : VertexGeometry { foreach (var vG in geometry) { if (vG.Attributes != attributes) { return(false); } } return(true); }
/// <summary> /// Points constructor. /// Creates a polyline between the specified set of points. /// Automatically closes the polyline (and removes the final point) if /// the last point at the first point are coincident. /// </summary> /// <param name="points"></param> /// <param name="close"></param> public PolyLine(IEnumerable <Vector> points, GeometryAttributes attributes = null) : this() { foreach (Vector pt in points) { Vertices.Add(new Vertex(pt)); } if (Vertices.Count > 1 && Vertices.First().DistanceToSquared(Vertices.Last()) <= Tolerance.Distance * Tolerance.Distance) { Vertices.RemoveAt(Vertices.Count - 1); Closed = true; } Attributes = attributes; }
/// <summary> /// Initialise a new set of attributes copying from another /// </summary> /// <param name="other">Another set of geometry attributes. This may be null, /// in which case default values will be retained.</param> public OriginalDomainGeometryAttributes(GeometryAttributes other) : base(other) { }
/// <summary> /// Coordinates constructor. /// Creates a Point object at the specified coordinates. /// </summary> /// <param name="position"></param> public Point(double x, double y, double z = 0, GeometryAttributes attributes = null) : this(new Vector(x, y, z), attributes) { }
/// <summary> /// Position vector constructor. /// Creates a Point object at the specified position. /// </summary> /// <param name="position"></param> public Point(Vector position, GeometryAttributes attributes = null) : this(attributes) { _Vertex = new Vertex(position); }
/// <summary> /// Vertex constructor. Initialises this Point object with the specified vertex. /// </summary> /// <param name="vertex"></param> public Point(Vertex vertex, GeometryAttributes attributes = null) : this(attributes) { _Vertex = vertex; }
/// <summary> /// Protected parameterless constructor /// </summary> protected Point(GeometryAttributes attributes) : base() { Attributes = attributes; }
/// <summary> /// Initialises a new PlanarSurface with the specified perimeter and void curves. /// </summary> /// <param name="perimeter"></param> /// <param name="voids"></param> public PlanarRegion(Curve perimeter, CurveCollection voids, GeometryAttributes attributes = null) : this(perimeter, attributes) { _Voids = voids; }
/// <summary> /// Initialises a new PlanarSurface with the specified perimeter curve. /// </summary> /// <param name="perimeter"></param> public PlanarRegion(Curve perimeter, GeometryAttributes attributes = null) { _Perimeter = perimeter; Attributes = attributes; }
/// <summary> /// Initialises a new quadrangular PlanarRegion with the specified corner points. /// The four points specified should all lie on the same plane for the resulting surface to be valid. /// </summary> /// <param name="pt0"></param> /// <param name="pt1"></param> /// <param name="pt2"></param> /// <param name="pt3"></param> /// <param name="attributes"></param> public PlanarRegion(Vector pt0, Vector pt1, Vector pt2, Vector pt3, GeometryAttributes attributes = null) : this(new PolyLine(new Vector[] { pt0, pt1, pt2, pt3 }, true, attributes)) { }
/// <summary> /// Curve constructor. Initialises a polycurve starting with the specifed curve /// </summary> /// <param name="curve"></param> public PolyCurve(Curve curve, GeometryAttributes attributes = null) : this(attributes) { SubCurves.Add(curve); }
/// <summary> /// Constructor to create a new line between two sets of coordinates /// </summary> /// <param name="x0">The x coordinate of the line start</param> /// <param name="y0">The y coordinate of the line start</param> /// <param name="z0">The z coordinate of the line start</param> /// <param name="x1">The x coordinate of the line end</param> /// <param name="y1">The y coordinate of the line end</param> /// <param name="z1">The z coordinate of the line end</param> public Line(double x0, double y0, double z0, double x1, double y1, double z1, GeometryAttributes attributes = null) : this(new Vector(x0, y0, z0), new Vector(x1, y1, z1), attributes) { }
/// <summary> /// Default constructor /// </summary> public Cloud(GeometryAttributes attributes = null) { _Vertices = new VertexCollection(this); Attributes = attributes; }
/// <summary> /// Initialise a point cloud containing a single point /// </summary> /// <param name="point"></param> public Cloud(Vector point, GeometryAttributes attributes = null) : this(attributes) { _Vertices.Add(new Vertex(point)); }
/// <summary> /// Constructor to create a new line between two points /// </summary> /// <param name="startPoint">The start point of the line</param> /// <param name="endPoint">The end point of the line</param> public Line(Vector startPoint, Vector endPoint, GeometryAttributes attributes = null) : this() { Vertices.Add(new Vertex(startPoint)); Vertices.Add(new Vertex(endPoint)); Attributes = attributes; }
/// <summary> /// Initialise a new set of attributes copying from another /// </summary> /// <param name="other">Another set of geometry attributes. This may be null, /// in which case default values will be retained.</param> /// <param name="subDomain">The subdomain interval to store</param> public OriginalDomainGeometryAttributes(GeometryAttributes other, Interval subDomain) : this(other) { _SubDomain = subDomain; }
/// <summary> /// Constructor to create a new line between two sets of coordinates /// on the XY plane. /// </summary> /// <param name="x0">The x coordinate of the line start</param> /// <param name="y0">The y coordinate of the line start</param> /// <param name="x1">The x coordinate of the line end</param> /// <param name="y1">The y coordinate of the line end</param> public Line(double x0, double y0, double x1, double y1, GeometryAttributes attributes = null) : this(x0, y0, 0, x1, y1, 0, attributes) { }
/// <summary> /// Default constructor /// </summary> public PolyCurve(GeometryAttributes attributes = null) { Attributes = attributes; }