Class ConstructionLine
- Namespace
- CADability.GeoObject
- Assembly
- CADability.dll
A construction line of conceptually infinite extent: either an infinite line in both directions (like the DXF XLINE entity) or a half-infinite ray starting at a base point (like the DXF RAY entity). CADability curves are always finite, so this object is displayed — and pickable, snappable and trimmable — as a very long finite segment. What distinguishes it from a plain Line is its extent behavior: GetBoundingCube() and the projected extent only report the BasePoint, so zoom-to-extents and the model extent ignore the (huge) displayed length, exactly as AutoCAD ignores XLINE/RAY entities when zooming to the drawing extents. GetExtent(double) keeps reporting the real segment so spatial searches (picking, snapping) work along the whole displayed line.
public class ConstructionLine : Line, IFeedBack, ICloneable, IColorDef, ILineWidth, ILinePattern, ICurve, IGeoObject, ILayer, IStyle, IOctTreeInsertable, IComparable, IExtentedableCurve, IExplicitPCurve3D, IJsonSerialize, IExportStep, ISerializable
- Inheritance
-
ConstructionLine
- Implements
- Inherited Members
Constructors
ConstructionLine()
Empty protected constructor.
protected ConstructionLine()
ConstructionLine(SerializationInfo, StreamingContext)
Constructor required by deserialization
protected ConstructionLine(SerializationInfo info, StreamingContext context)
Parameters
infoSerializationInfocontextStreamingContext
Fields
Constructor
Provide a delegate here if you want your ConstructionLine derived class to be created each time CADability creates a ConstructionLine.
public static ConstructionLine.ConstructionDelegate Constructor
Field Value
Properties
BasePoint
The defining base point: the start point of the ray, or the point the infinite line was defined with (the middle of the displayed segment).
public GeoPoint BasePoint { get; }
Property Value
Direction
The normalized direction of the construction line.
public GeoVector Direction { get; }
Property Value
IsRay
True if this is a half-infinite ray starting at BasePoint (DXF RAY), false if it is an infinite line (DXF XLINE).
public bool IsRay { get; }
Property Value
Methods
Clone()
Overrides Clone(), returns a clone of this construction line.
public override IGeoObject Clone()
Returns
- IGeoObject
the clone
Construct()
The only way to create a ConstructionLine. There are no public constructors to assure that this is the only way to construct a ConstructionLine.
public static ConstructionLine Construct()
Returns
CopyGeometry(IGeoObject)
Overrides CopyGeometry(IGeoObject), additionally copies the ray flag.
public override void CopyGeometry(IGeoObject ToCopyFrom)
Parameters
ToCopyFromIGeoObjectmust be a Line (or ConstructionLine) to copy the data from
GetBoundingCube()
Overrides GetBoundingCube(): only the BasePoint is reported so the displayed (huge) segment does not contribute to the model extent and zoom-to-extents ignores the construction line.
public override BoundingCube GetBoundingCube()
Returns
- BoundingCube
the bounding cube of the base point
GetExtent(Projection, ExtentPrecision)
Overrides GetExtent(Projection, ExtentPrecision): only the projected BasePoint is reported so 2D zoom-to-extents ignores the displayed length as well.
public override BoundingRect GetExtent(Projection projection, ExtentPrecision extentPrecision)
Parameters
projectionProjectionextentPrecisionExtentPrecision
Returns
- BoundingRect
the projected base point
GetExtent(double)
Overrides GetExtent(double): in contrast to GetBoundingCube() this returns the real extent of the displayed segment, so spatial data structures (octree) used for picking and snapping cover the whole displayed line.
public override BoundingCube GetExtent(double precision)
Parameters
precisiondouble
Returns
- BoundingCube
the extent of the displayed segment
GetObjectData(IJsonWriteData)
Writes the data of this base class (user data, layer, style, user attributes and actuator) for the JSON serialization (IJsonSerialize). Derived classes override it, call the base implementation and add their own properties.
public override void GetObjectData(IJsonWriteData data)
Parameters
dataIJsonWriteDatareceives the data
GetObjectData(SerializationInfo, StreamingContext)
Writes the data of this object for the legacy binary serialization (ISerializable). Files are written in the JSON format (IJsonSerialize) now; the binary format is still read.
public override void GetObjectData(SerializationInfo info, StreamingContext context)
Parameters
infoSerializationInforeceives the data
contextStreamingContextthe destination of the serialization
MakeRay(GeoPoint, GeoVector)
Creates a half-infinite construction ray starting at basePoint
extending in direction (corresponds to the DXF RAY entity).
public static ConstructionLine MakeRay(GeoPoint basePoint, GeoVector direction)
Parameters
basePointGeoPointstart point of the ray
directionGeoVectordirection of the ray, must not be the null vector
Returns
- ConstructionLine
the ray
MakeXLine(GeoPoint, GeoVector)
Creates an infinite construction line through basePoint
extending in both directions of direction (corresponds to the DXF XLINE entity).
public static ConstructionLine MakeXLine(GeoPoint basePoint, GeoVector direction)
Parameters
basePointGeoPointa point on the line
directionGeoVectordirection of the line, must not be the null vector
Returns
- ConstructionLine
the construction line
SetObjectData(IJsonReadData)
Reads the data written by GetObjectData(IJsonWriteData) back from the JSON serialization. Derived classes override it, call the base implementation and read their own properties. Objects referenced by the data may still be incomplete at this time, see IJsonSerializeDone.
public override void SetObjectData(IJsonReadData data)
Parameters
dataIJsonReadDataprovides the data