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
Attributes
Gets all attributes that this GeoObject posesses.
INamedAttribute[] Attributes { get; }
Property Value
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
NumChildren
Returns the number of children the GeoObject has. Simple GeoObjects (like Line) dont have children.
int NumChildren { get; }
Property Value
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
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
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
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
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
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
attributeINamedAttribute
Returns
Child(int)
Returns the child with the given index. See HasChildren().
IGeoObject Child(int Index)
Parameters
Indexintindex 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
ToCopyFromIGeoObjectGeoObject 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
ToCopyFromIGeoObjectGeoObject 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
spfSnapPointFinderdefinition 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
FrameIFrameIFrame 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
projectionProjectionthe projection
extentPrecisionExtentPrecisionExact 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
keystringkey 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
projectionProjectionthe projection
extentPrecisionExtentPrecisionprecision 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
FrameIFrameIFrame 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
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
Attributeobjectattribut 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
mModOpOperation 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
senderobjectthe causer
propertyNamestringname of the property beeing changed
startModifybooltrue: beginning, false: ending
Returns
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
paintTo3DIPaintTo3Dwhere 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
paintTo3DIPaintTo3Dthe paint interface of the view
listsICategorizedDislayListsthe display lists to add to
PrePaintTo3D(IPaintTo3D)
Called before PaintTo3D, not collected in the DisplayList
void PrePaintTo3D(IPaintTo3D paintTo3D)
Parameters
paintTo3DIPaintTo3D
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
precisiondoubleThe 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
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
keystringkey or typename of attribute to set
toSetINamedAttributeattribute
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
alcIAttributeListContainerThe 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
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