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.
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
infoSerializationInfocontextStreamingContext
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
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
Location
The world coordinates location of this object
public GeoPoint Location { get; set; }
Property Value
Methods
Clone()
Overrides Clone(). Must be implemented by each GeoObject. No default implementation.
public override IGeoObject Clone()
Returns
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
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
toCopyFromIGeoObject
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
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
GetExtent(double)
Gets the 3-dimensional extent of an object
public override BoundingCube GetExtent(double precision)
Parameters
precisiondoublePrecision 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
projectionProjectionthe projection
extentPrecisionExtentPrecisionprecision 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
frameIFrame
Returns
HitTest(ref BoundingCube, double)
Tests whether an object is touched by the provided cube
public override bool HitTest(ref BoundingCube cube, double precision)
Parameters
cubeBoundingCubeTo test with
precisiondoubleRequired 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
projectionProjectionThe projection for the test
rectBoundingRectThe rectangle to test the position
onlyInsidebooltrue: 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
areaProjection.PickAreaThe area to check for
onlyInsidebooltrue: 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
mModOpthe 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
paintTo3DIPaintTo3Dwhere 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
paintTo3DIPaintTo3Dthe paint interface of the view
listsICategorizedDislayListsthe 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
fromHereGeoPointStartpoint of the line
directionGeoVectorDirection of the line
precisiondoublePrecision 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
paintTo3DIPaintTo3Dthe 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
precisiondoubleRequired 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
areaProjection.PickAreaPick area to check
onlyInsidebooltrue, 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