Table of Contents

Interface IGeoObject

Namespace
CADability.GeoObject
Assembly
CADability.dll

IGeoObject is the interface that all geometric entities must support.

public interface IGeoObject : ILayer, IStyle, IOctTreeInsertable, IComparable
Inherited Members

Properties

Actuator

Gets or sets an actuator or drive that defines the mechanical constraint or degree of freedom for this object Used for animation, static objects dont have an actuator (null)

IDrive Actuator { get; set; }

Property Value

IDrive

Attributes

Gets all attributes that this GeoObject posesses.

INamedAttribute[] Attributes { get; }

Property Value

INamedAttribute[]

CustomAttributeKeys

Gets all custom attributes attached to this object

string[] CustomAttributeKeys { get; }

Property Value

string[]

Description

Returns a description of the GeoObject which is used in the control center

string Description { get; }

Property Value

string

a short description

IsVisible

Whether the object is displayed. Invisible objects stay in the model, are saved and take part in the extent, but are not drawn and not picked.

bool IsVisible { get; set; }

Property Value

bool

NumChildren

Returns the number of children the GeoObject has. Simple GeoObjects (like Line) dont have children.

int NumChildren { get; }

Property Value

int

OwnedItems

The objects this object consists of and owns, e.g. the shells of a solid or the faces of a shell. Empty for simple objects.

IGeoObject[] OwnedItems { get; }

Property Value

IGeoObject[]

Owner

Returns the owner of this GeoObject. Each GeoObject has only one owner. This might be a Model or a GeoObject derived from Block.

IGeoObjectOwner Owner { get; set; }

Property Value

IGeoObjectOwner

PreferredStyle

The kind of object for the purpose of the default styles (see Style.EDefaultFor): SetDefaults(IGeoObject) gives the object the default style of this kind.

Style.EDefaultFor PreferredStyle { get; }

Property Value

Style.EDefaultFor

UniqueId

A number that is unique among all objects of this process. Used to identify objects, e.g. as keys in dictionaries.

int UniqueId { get; }

Property Value

int

UserData

Gets the user data collection for this GeoObject. This is the way to connect your own objects with a GeoObject. See UserData.

UserData UserData { get; }

Property Value

UserData

Methods

AttributeChanged(INamedAttribute)

This method is called to notify the object of an attribute that changed some of its properties. The objects returns true, if it needs to be repainted.

bool AttributeChanged(INamedAttribute attribute)

Parameters

attribute INamedAttribute

Returns

bool

Child(int)

Returns the child with the given index. See HasChildren().

IGeoObject Child(int Index)

Parameters

Index int

index of required child

Returns

IGeoObject

this child

Clone()

Clones this GeoObject.

IGeoObject Clone()

Returns

IGeoObject

the cloned GeoObject

CopyAttributes(IGeoObject)

Copies the attributes from the given GeoObject to this GeoObject. The geometry remains unchanged.

void CopyAttributes(IGeoObject ToCopyFrom)

Parameters

ToCopyFrom IGeoObject

GeoObject to copy from

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.

void CopyGeometry(IGeoObject ToCopyFrom)

Parameters

ToCopyFrom IGeoObject

GeoObject to copy from

Decompose()

Decomposes the object into simpler objects, e.g. a block into its children, a path into its curves or a shell into its faces. Returns null when there is nothing simpler.

GeoObjectList Decompose()

Returns

GeoObjectList

the parts, or null

FindSnapPoint(SnapPointFinder)

Asks the object to enumerate all its possible snap points according to the required modes defined by the parameter.

void FindSnapPoint(SnapPointFinder spf)

Parameters

spf SnapPointFinder

definition and collection of snap points

GetAttributeProperties(IFrame)

Gets a list of IShowProperty objects that represent the non geometric properties of this geoobject. This list will be used during construct actions (e.g. when interactively drawing that object) to display properties like color or layer.

IPropertyEntry[] GetAttributeProperties(IFrame Frame)

Parameters

Frame IFrame

IFrame reference used to check settings

Returns

IPropertyEntry[]

list of properties

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.

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).

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

GetNamedAttribute(string)

Gets an attribut from the GeoObject. There are the following types (keys) of attributes predefined in CADability, which can be set with this method:

Other attributes may be provided by the user.

INamedAttribute GetNamedAttribute(string key)

Parameters

key string

key or typename of the required attribute

Returns

INamedAttribute

the attribute or null, if there is no such attribute

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.

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)

Gets a IShowProperty object that represents the properties of this geoobject. The result will be used to display the properties in the control center.

IPropertyEntry GetShowProperties(IFrame Frame)

Parameters

Frame IFrame

IFrame reference used to check settings

Returns

IPropertyEntry

properties

HasChildren()

Determins whether this GeoObject has child objects. E.g. Block objects have children. This is necessary when the child objects have different Layers

bool HasChildren()

Returns

bool

HasValidData()

Determins whether the GeoObject has valid data (e.g. to be added to a model). E.g. a line where the startpoint is identical to the endpoint or a circle with radius <=0.0 is considered invalid.

bool HasValidData()

Returns

bool

true, if valid, false otherwise

IsAttributeUsed(object)

Returns true if this object uses the attribute in the parameter. Attributes may be CADability objects like Layer etc. or any user defined objects.

bool IsAttributeUsed(object Attribute)

Parameters

Attribute object

attribut to check

Returns

bool

true if used by this GeoObject

Modify(ModOp)

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

void Modify(ModOp m)

Parameters

m ModOp

Operation to be applied

ModifyWithMouse(object, string, bool)

Notifies about the begin and end of a modification with the mouse

bool ModifyWithMouse(object sender, string propertyName, bool startModify)

Parameters

sender object

the causer

propertyName string

name of the property beeing changed

startModify bool

true: beginning, false: ending

Returns

bool

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).

void PaintTo3D(IPaintTo3D paintTo3D)

Parameters

paintTo3D IPaintTo3D

where to paint

PaintTo3DList(IPaintTo3D, ICategorizedDislayLists)

Paints the object into the display lists of a view, sorted by category: the object adds itself, or its parts, to lists as faces, edges, curves, text... with their layer, so that the view can draw the categories in the right order and with the right settings (e.g. edges on top of faces). Simple objects add themselves as a whole, solids and shells add their faces and edges separately.

void PaintTo3DList(IPaintTo3D paintTo3D, ICategorizedDislayLists lists)

Parameters

paintTo3D IPaintTo3D

the paint interface of the view

lists ICategorizedDislayLists

the display lists to add to

PrePaintTo3D(IPaintTo3D)

Called before PaintTo3D, not collected in the DisplayList

void PrePaintTo3D(IPaintTo3D paintTo3D)

Parameters

paintTo3D IPaintTo3D

PrepareDisplayList(double)

This method will be called from a background thread when a higher precision displaylist is needed. The object should do all the necessary calculation to produce a display list with the required precision. The display list will later be acquired by a call to PaintTo3DList (or PaintTo3D) from the main thred because the display dirvers are not multithread enabled.

void PrepareDisplayList(double precision)

Parameters

precision double

The required precision

PropagateAttributes(Layer, ColorDef)

Propagates the layer and color from the owner (usually a BlockRef) to this object.

void PropagateAttributes(Layer layer, ColorDef colorDef)

Parameters

layer Layer

The layer

colorDef ColorDef

The color

SetNamedAttribute(string, INamedAttribute)

Sets an attribut to the GeoObject. There are the following types (keys) of attributes predefined in CADability, which can be set with this method:

Other attributes may be provided by the user.

void SetNamedAttribute(string key, INamedAttribute toSet)

Parameters

key string

key or typename of attribute to set

toSet INamedAttribute

attribute

UpdateAttributes(IAttributeListContainer)

When an IGeoObject changes the context that contains the lists of attributes it must replace its attributes by those given in the new context. If there are no appropriate attributes in the new context, these attributes must be included int this new context. This happens when drag and drop operations are executed or when a model is copied from one project to another project. IGeoObjectImpl contains a complete implementation regarding the attributes Style, Layer, ColorDef, LineWidth, LinePattern, HatchStyle and DimensionStyle

void UpdateAttributes(IAttributeListContainer alc)

Parameters

alc IAttributeListContainer

The context, usually a Project which contains the attribute lists

Events

DidChangeEvent

Event that must be provided by each GeoObject. This event will be fired when the GeoObject did change (either geometrical aspects or attributes).

event ChangeDelegate DidChangeEvent

Event Type

ChangeDelegate

WillChangeEvent

Event that must be provided by each GeoObject. This event will be fired when the GeoObject is about to change (either geometrical aspects or attributes).

event ChangeDelegate WillChangeEvent

Event Type

ChangeDelegate