Table of Contents

Class Point

Namespace
CADability.GeoObject
Assembly
CADability.dll

Implements a point as a IGeoObject.

public class Point : IGeoObjectImpl, IGeoObject, ILayer, IStyle, IOctTreeInsertable, IComparable, IFeedBack, ICloneable, IColorDef, ISerializable, IJsonSerialize
Inheritance
Point
Implements
Inherited Members

Constructors

Point()

Protected constructor: sets Size to 3 and raises Constructed. Use Construct() to create a point.

protected Point()

Point(SerializationInfo, StreamingContext)

Constructor required by deserialization

protected Point(SerializationInfo info, StreamingContext context)

Parameters

info SerializationInfo

SerializationInfo

context StreamingContext

StreamingContext

Fields

Constructor

Provide a delegate here if you want your Point derived class to be created each time CADability creates a point.

public static Point.ConstructionDelegate Constructor

Field Value

Point.ConstructionDelegate

OnPaintTo3D

Hook to replace the painting of points: when set, PaintTo3D(IPaintTo3D) calls it after setting the color and does nothing more when it returns true. The hook is static, so it applies to every point of the process.

public static Point.PaintTo3DDelegate OnPaintTo3D

Field Value

Point.PaintTo3DDelegate

Properties

ColorDef

The color of the point, see ColorDef. Setting it raises the change events as a change of an attribute and is undoable; setting null is ignored. A color with fromParent is replaced by the corresponding color of the Block the point belongs to.

public ColorDef ColorDef { get; set; }

Property Value

ColorDef

CustomAttributeKeys

The keys of the user defined attributes attached to this object with SetNamedAttribute(string, INamedAttribute) (the CADability attributes like layer and color are not included); an empty array when there are none. Derived classes add the keys of attributes of their own, e.g. Point adds "PointSymbol".

public override string[] CustomAttributeKeys { get; }

Property Value

string[]

Location

The position of the point in world coordinates. Setting it raises the change events and is undoable.

public GeoPoint Location { get; set; }

Property Value

GeoPoint

Name

An optional name of the point, shown and editable in the property grid; null when not set. Setting it raises the change events as a change of an attribute and is undoable.

public string Name { get; set; }

Property Value

string

PreferredStyle

Returns the preferred style for this objects, see Style.EDefaultFor.

public override Style.EDefaultFor PreferredStyle { get; }

Property Value

Style.EDefaultFor

Size

The size of the displayed symbol, nominally in pixels: the symbol does not scale with the view. Default is 3. The current renderers draw symbols of a fixed size and do not evaluate the value. Setting it raises the change events and is undoable.

public double Size { get; set; }

Property Value

double

Symbol

The symbol with which the point is displayed: a dot, plus, cross or line, optionally combined with a square or circle around it, see PointSymbol. Setting it raises the change events and is undoable. The symbol is also available as the named attribute "PointSymbol" (GetNamedAttribute(string)).

public PointSymbol Symbol { get; set; }

Property Value

PointSymbol

Methods

Clone()

Clones this GeoObject.

public override IGeoObject Clone()

Returns

IGeoObject

the cloned GeoObject

Construct()

The only way to create a point: there are no public constructors. Calls Constructor when one is registered, otherwise creates a Point. The new point has Size 3 and no symbol (Empty); set Location and Symbol afterwards.

public static Point Construct()

Returns

Point

the new point

CopyGeometry(IGeoObject)

Copies the geometrical aspects of the given GeoObject to this GeoObject. Both objects must be of the same type. The attributes are not copied.

public override void CopyGeometry(IGeoObject ToCopyFrom)

Parameters

ToCopyFrom IGeoObject

GeoObject to copy from

FindSnapPoint(SnapPointFinder)

Asks the object to add its snap points (end points, centres, intersections...) of the kinds that spf asks for. The default implementation adds none; objects with geometry override it.

public override void FindSnapPoint(SnapPointFinder spf)

Parameters

spf SnapPointFinder

definition and collection of the snap points

GetAttributeProperties(IFrame)

Implements GetAttributeProperties(IFrame). The default implementation returns ShowProperties for all CADability attributes.

public override IPropertyEntry[] GetAttributeProperties(IFrame Frame)

Parameters

Frame IFrame

the frame of the view

Returns

IPropertyEntry[]

list of IPropertyEntry

GetBoundingCube()

Returns a bounding cube of the object. The object must fir into this cube. There may be a smaller cube that contains the object if it is to expensive to calculate the exact cube.

public override BoundingCube GetBoundingCube()

Returns

BoundingCube

the bounding cube

GetExtent(Projection, ExtentPrecision)

Returns the 2d extent of the object as it appears in the given projection, in the coordinates of the projection's plane (not in pixels).

public override BoundingRect GetExtent(Projection projection, ExtentPrecision extentPrecision)

Parameters

projection Projection

the projection

extentPrecision ExtentPrecision

Exact for the exact extent, Raw for a quick estimate that may be larger

Returns

BoundingRect

the extent in the projection's 2d coordinates

GetExtent(double)

Gets the 3-dimensional extent of an object

public override BoundingCube GetExtent(double precision)

Parameters

precision double

Precision of the test

Returns

BoundingCube

The minmax cube

GetNamedAttribute(string)

Implements GetNamedAttribute(string). The default implementation handles all CADability attributes and leaves the handling of non CADability attributes to your code.

public override INamedAttribute GetNamedAttribute(string name)

Parameters

name string

Returns

INamedAttribute

the named attribute

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

data IJsonWriteData

receives 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

info SerializationInfo

receives the data

context StreamingContext

the destination of the serialization

GetQuadTreeItem(Projection, ExtentPrecision)

Returns an item for a 2d quad tree of the projected objects, used for hit tests in a projection: it knows the 2d extent of the object, whether a 2d rectangle hits it, and the depth (z position) of the object at a 2d point. Composite objects (blocks, solids, paths) return a collection of the items of their parts.

public override IQuadTreeInsertableZ GetQuadTreeItem(Projection projection, ExtentPrecision extentPrecision)

Parameters

projection Projection

the projection

extentPrecision ExtentPrecision

precision of the extent, see GetExtent(Projection, ExtentPrecision)

Returns

IQuadTreeInsertableZ

the item for the quad tree

GetShowProperties(IFrame)

Should be overridden and return a IPropertyEntry derived object that handles the display and modification of the properties of the IGeoObject derived object. Default implementation return null.

public override IPropertyEntry GetShowProperties(IFrame Frame)

Parameters

Frame IFrame

Returns

IPropertyEntry

HitTest(ref BoundingCube, double)

Tests whether an object is touched by the provided cube

public override bool HitTest(ref BoundingCube cube, double precision)

Parameters

cube BoundingCube

To test with

precision double

Required precision

Returns

bool

true if the object strikes the cube

HitTest(Projection, BoundingRect, bool)

Tests whether an object is inside or touched by the rectangle when projected with the provided projection

public override bool HitTest(Projection projection, BoundingRect rect, bool onlyInside)

Parameters

projection Projection

The projection for the test

rect BoundingRect

The rectangle to test the position

onlyInside bool

true: the object must be totaly inside the rectangle, false: the object must be totaly or partially inside the rectangle

Returns

bool

true when the test succeedes, false otherwise

HitTest(PickArea, bool)

Tests whether an object is inside or touched by the provided area

public override bool HitTest(Projection.PickArea area, bool onlyInside)

Parameters

area Projection.PickArea

The area to check for

onlyInside bool

true: the object must be totaly inside the area, false: the object must be totaly or partially inside the area

Returns

bool

true when the test succeedes, false otherwise

Modify(ModOp)

Modifies this GeoObject with the given modification operation (includes moving, rotating, reflecting, scaling etc.).

public override void Modify(ModOp m)

Parameters

m ModOp

Operation to be applied

PaintTo3D(IPaintTo3D)

Paints the object with the methods of paintTo3D: lines, triangles, text... The views implement IPaintTo3D (with OpenGL or GDI) and collect what the object paints in a display list, so this is called rarely, after PrepareDisplayList(double) has done the expensive work (triangulation, approximation).

public override void PaintTo3D(IPaintTo3D paintTo3D)

Parameters

paintTo3D IPaintTo3D

where to paint

Position(GeoPoint, GeoVector, double)

Returns the smallest parameter value (l) where the provided line hits the object so that the point fromHere + l * direction is on or close to the object. The result may be negative. Return double.MaxValue if there is no such point.

public override double Position(GeoPoint fromHere, GeoVector direction, double precision)

Parameters

fromHere GeoPoint

Startpoint of the line

direction GeoVector

Direction of the line

precision double

Precision for the test

Returns

double

Position on the line

PrePaintTo3D(IPaintTo3D)

Called before PaintTo3D(IPaintTo3D), outside of the display list that collects what PaintTo3D paints. Override it for work that must not go into that list, e.g. painting that needs a display list of its own. The default implementation does nothing.

public override void PrePaintTo3D(IPaintTo3D paintTo3D)

Parameters

paintTo3D IPaintTo3D

the paint interface of the view

PrepareDisplayList(double)

Called before PaintTo3D(IPaintTo3D) is called, should implement the time consuming work for the display (like calculationg the triangulation of Faces or Polylines of Curves). Not normally used by user code.

public override void PrepareDisplayList(double precision)

Parameters

precision double

Required precision

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

data IJsonReadData

provides the data

Events

Constructed

Raised from the constructor whenever a point is created, be it by Construct(), by cloning or by deserialization, before its data is set. An application can use it to attach data of its own to every point.

public static event Point.ConstructedDelegate Constructed

Event Type

Point.ConstructedDelegate