API / geotoolkit3d / util / intersection / IntersectionManager / IntersectionManager
intersection.IntersectionManager.IntersectionManager
IntersectionManager class handles and keeps track of intersection-related features. A default global instance of this class is created and used.
↳
IntersectionManager
Constructors
Methods
Constructors
• new IntersectionManager()
EventDispatcher.constructor
Methods
▸ dispose(): void
Dispose the instance and its properties.
void
▸ elligibleForIntersection(planeObject, meshObject): boolean
Return true if the provided pair of objects can be used to create a new intersection.
| Name | Type | Description |
|---|---|---|
planeObject | Object3D | the plane object that has overlay support (or one of its parents) |
meshObject | Object3D | the object that intersects the plane object |
boolean
if the pair is eligible or not.
▸ generateIntersection(planeObject, meshObject, options?): void
Draw intersections between the plane object and the intersecting object, with provided options.
| Name | Type | Description |
|---|---|---|
planeObject | Object3D | the plane object that has overlay support (or one of its parents) |
meshObject | Object3D | the object that intersects the plane object |
Optional options | PlaneMeshIntersectionOptions | the options for intersection |
void
▸ getAutoUpdateInterval(): number
Get the time interval in millisecond between each intersection update.
number
▸ getClassName(): string
string
▸ getMeshMap(): Map<string, Set<string>>
Return the map of relationship between mesh objects and the plane(s) they intersect. Map <meshuuid: string, planesuuidSet: Set<string>>
Map<string, Set<string>>
▸ getObjectMap(): Map<string, { matrixworld: number[] ; object: Object3D }>
Returns the map of all objects being part of intersections. Key are objects's UUID, value is the object itself.
Map<string, { matrixworld: number[] ; object: Object3D }>
▸ getPlaneMap(): Map<string, Set<string>>
Return the map of relationship between plane objects and the mesh(es) they intersect. Map <planeuuid: string, meshessuuidSet: Set<string>>
Map<string, Set<string>>
▸ hasEventListener(type, callback?): boolean
Check if a list of event listeners for this type contains this listener
| Name | Type | Description |
|---|---|---|
type | string | type of event or property |
Optional callback | Function | to be called, if null, check if any callback is registered |
boolean
EventDispatcher.hasEventListener
▸ isAutoRedrawEnabled(): boolean
Return if automatic redraw is enabled. See setAutoRedraw for more information.
boolean
▸ isDisposed(): boolean
Returns whether this object has been disposed
boolean
▸ isIntersectionExists(planeObject, meshObject): boolean
Returns true, if intersection exists
| Name | Type | Description |
|---|---|---|
planeObject | Object3D | the plane object that has overlay support |
meshObject | Object3D | the object that intersects the plane object |
boolean
true if intersection exists
▸ isMatrixWorldChange(): boolean
Returns true if matrix world has changed. Otherwise, return false.
boolean
▸ isSilent(): boolean
Return true if the event dispatcher doesn't notify any events
boolean
▸ notify(type, source, args?): IntersectionManager
Notify listeners
| Name | Type | Description |
|---|---|---|
type | string | event types |
source | any | of the event |
Optional args | any | arguments of the event |
this
▸ off(type?, callback?): IntersectionManager
Detach listener on event. Calling .off() with no arguments removes all attached listeners. Calling .off(type) with no callback removes all attached listeners for specific type.
| Name | Type | Description |
|---|---|---|
Optional type | string | type of the event |
Optional callback | EventListener | function to be called |
this
▸ off<E>(type, callback): IntersectionManager
| Name | Type |
|---|---|
E | extends string |
| Name | Type |
|---|---|
type | E |
callback | (eventType: E, sender: IntersectionManager, args: EventMap[E]) => void |
▸ on(type, callback, options?): IntersectionManager
Attach listener on event that will be called whenever the specified event is delivered to the target
If the callback function is already in the list of event listeners for this target, the function is not added a second time.
If a particular anonymous function is in the list of event listeners registered for a certain target, and then later in the code, an identical anonymous function is given in an "on" call, the second function will also be added to the list of event listeners for that target.
| Name | Type | Description |
|---|---|---|
type | string | type of event or property |
callback | EventListener | to be called |
Optional options | Options | options of subscription |
this
▸ on<E>(type, callback, options?): IntersectionManager
| Name | Type |
|---|---|
E | extends string |
| Name | Type |
|---|---|
type | E |
callback | (eventType: E, sender: IntersectionManager, args: EventMap[E]) => void |
Optional options | Options |
▸ removeIntersection(planeObject, meshObject): void
Remove the intersection between the given plane and mesh objects.
User should call this if the intersection is no longer needed to avoid memory leaks, as the intersection manager is a singleton, and keeps references to both objects until the intersection is removed.
| Name | Type | Description |
|---|---|---|
planeObject | Object3D | the plane object that has overlay support |
meshObject | Object3D | the mesh object that intersects the plane object |
void
▸ setAutoRedraw(auto): void
Set the intersectionManager automatic behavior. Default is true. When a pair of intersecting object have either of its 2 objects move since the last redraw, they become invalidated. When set to true, the invalidated intersection is cleared and redrawn. When set to false, the invalidated intersection is only cleared. When automatic redraw is disabled, the manual way to update an intersection is to call generateIntersection() again.
| Name | Type |
|---|---|
auto | boolean |
void
▸ setAutoUpdateInterval(interval): void
Set the time interval in millisecond between each intersection update. Default is 100ms (10 times per second). A smaller interval allow more frequent intersection update, but also require more CPU resources and can cause stuttering on low end machines.
Lower-end devices can benefit from lowering this value even further than the default value.
The minimum accepted interval is 16.6ms (60 time per seconds).
| Name | Type |
|---|---|
interval | number |
void
▸ setPropertyByIntersection(planeObject, meshObject, properties): void
Set the options for intersection.
Using this method can change intersection's properties without re-calculating intersecting points. Note if the position of intersection has changed, use generateIntersection instead.
| Name | Type | Description |
|---|---|---|
planeObject | Object3D | the plane object that has overlay support |
meshObject | Object3D | the object that intersects the plane object |
properties | PlaneMeshIntersectionOptions | the intersection properties |
void
▸ setSilent(bool): IntersectionManager
Set silent mode
| Name | Type | Description |
|---|---|---|
bool | boolean | flag to enable silent mode |
this
▸ Static getClassName(): string
string
▸ Static getDefaultInstance(): IntersectionManager
Returns default instance of the IntersectionManager
this