Table of Contents

Class UnscaledGeoObject

Namespace
CADability.GeoObject
Assembly
CADability.dll

A GeoObject which always appears in the same size in a view. It is not scaled when the view is zoomed. These objects can not be kept in displaylists and hence have a poor performance when used in high numbers. The objects rotate with the view when viewed from different directions. The Location specifies the position of the origin (GeoPoint(0,0,0)) of the referenced GeoObject. Usually you would center the referenced object at the origin so this object will be centered at the Location. In contrast to the Icon object, which always shows its face to the viewer and is much faster, because it can be kept in the display list. Since this object does not have a well-defined size in world coordinates, it is only pickable or selectable at its insertion point. The size of the object is assumed in device units (pixels) The Layer of this object will be taken into account for the objects visibility, not the layer of the referenced object. The use of this object is not recommended because it has a poor performance in both display and selection. Consider using Icon instead.

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

Constructors

UnscaledGeoObject(SerializationInfo, StreamingContext)

protected UnscaledGeoObject(SerializationInfo info, StreamingContext context)

Parameters

info SerializationInfo
context StreamingContext

Fields

Constructor

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

public static UnscaledGeoObject.ConstructionDelegate Constructor

Field Value

UnscaledGeoObject.ConstructionDelegate

Properties

GeoObject

The GeoObject to be displayed. This can be any kind of GeoObject, Text and Bitmap are often used. The object must be in a coordinate space where the Origin will be transferred to the Location.

public IGeoObject GeoObject { get; set; }

Property Value

IGeoObject

Location

The world coordinates location of this object

public GeoPoint Location { get; set; }

Property Value

GeoPoint

Methods

Clone()

Overrides Clone(). Must be implemented by each GeoObject. No default implementation.

public override IGeoObject Clone()

Returns

IGeoObject

Construct()

The only way to create a UnscaledGeoObject. There are no public constructors for the UnscaledGeoObject to assure that this is the only way to construct a UnscaledGeoObject.

public static UnscaledGeoObject Construct()

Returns

UnscaledGeoObject

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

GetBoundingCube()

Implements GetBoundingCube() abstract. Must be overridden.

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

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)

Overrides Modify(ModOp). Must be implemented by each GeoObject. No default implementation.

public override void Modify(ModOp m)

Parameters

m ModOp

the modification

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

PaintTo3DList(IPaintTo3D, ICategorizedDislayLists)

Adds this object as a whole to the display lists, in the category of its layer. Suitable for simple objects like curves and text; composite objects (solids, shells, blocks) override it and add their parts by category.

public override void PaintTo3DList(IPaintTo3D paintTo3D, ICategorizedDislayLists lists)

Parameters

paintTo3D IPaintTo3D

the paint interface of the view

lists ICategorizedDislayLists

the display lists to add to

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

RealHitTest(PickArea, bool)

While the normal HitTest only checks the Location of the object this method checks the hit test of the object expanded according to the projection in this area

public bool RealHitTest(Projection.PickArea area, bool onlyInside)

Parameters

area Projection.PickArea

Pick area to check

onlyInside bool

true, if the whole object must reside inside the pick area, false if overlapping will suffice

Returns

bool

true when a hit is recognized

Events

Constructed

public static event UnscaledGeoObject.ConstructedDelegate Constructed

Event Type

UnscaledGeoObject.ConstructedDelegate