Last updated

API / geotoolkit3d / util / intersection / IntersectionManager / IntersectionManager

Class: 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.

Hierarchy

Table of contents

Constructors
Methods

Contents

Constructors

new IntersectionManager()

new IntersectionManager()

Overrides

EventDispatcher.constructor

Methods

dispose

dispose(): void

Dispose the instance and its properties.

Returns

void

Overrides

EventDispatcher.dispose


elligibleForIntersection

elligibleForIntersection(planeObject, meshObject): boolean

Return true if the provided pair of objects can be used to create a new intersection.

Parameters

Name Type Description
planeObjectObject3Dthe plane object that has overlay support (or one of its parents)
meshObjectObject3Dthe object that intersects the plane object

Returns

boolean

if the pair is eligible or not.


generateIntersection

generateIntersection(planeObject, meshObject, options?): void

Draw intersections between the plane object and the intersecting object, with provided options.

Parameters

Name Type Description
planeObjectObject3Dthe plane object that has overlay support (or one of its parents)
meshObjectObject3Dthe object that intersects the plane object
Optional optionsPlaneMeshIntersectionOptionsthe options for intersection

Returns

void


getAutoUpdateInterval

getAutoUpdateInterval(): number

Get the time interval in millisecond between each intersection update.

Returns

number


getClassName

getClassName(): string

Returns

string

Inherited from

EventDispatcher.getClassName


getMeshMap

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

Returns

Map<string, Set<string>>


getObjectMap

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.

Returns

Map<string, { matrixworld: number[] ; object: Object3D }>


getPlaneMap

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

Returns

Map<string, Set<string>>


hasEventListener

hasEventListener(type, callback?): boolean

Check if a list of event listeners for this type contains this listener

Parameters

Name Type Description
typestringtype of event or property
Optional callbackFunctionto be called, if null, check if any callback is registered

Returns

boolean

Inherited from

EventDispatcher.hasEventListener


isAutoRedrawEnabled

isAutoRedrawEnabled(): boolean

Return if automatic redraw is enabled. See setAutoRedraw for more information.

Returns

boolean


isDisposed

isDisposed(): boolean

Returns whether this object has been disposed

Returns

boolean

Inherited from

EventDispatcher.isDisposed


isIntersectionExists

isIntersectionExists(planeObject, meshObject): boolean

Returns true, if intersection exists

Parameters

Name Type Description
planeObjectObject3Dthe plane object that has overlay support
meshObjectObject3Dthe object that intersects the plane object

Returns

boolean

true if intersection exists


isMatrixWorldChange

isMatrixWorldChange(): boolean

Returns true if matrix world has changed. Otherwise, return false.

Returns

boolean


isSilent

isSilent(): boolean

Return true if the event dispatcher doesn't notify any events

Returns

boolean

Inherited from

EventDispatcher.isSilent


notify

notify(type, source, args?): IntersectionManager

Notify listeners

Parameters

Name Type Description
typestringevent types
sourceanyof the event
Optional argsanyarguments of the event

Returns

IntersectionManager

this

Inherited from

EventDispatcher.notify


off

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.

Parameters

Name Type Description
Optional typestringtype of the event
Optional callbackEventListenerfunction to be called

Returns

IntersectionManager

this

Inherited from

EventDispatcher.off

off<E>(type, callback): IntersectionManager

Type parameters

NameType
Eextends string

Parameters

Name Type
typeE
callback(eventType: E, sender: IntersectionManager, args: EventMap[E]) => void

Returns

IntersectionManager

Inherited from

EventDispatcher.off


on

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.

Parameters

Name Type Description
typestringtype of event or property
callbackEventListenerto be called
Optional optionsOptionsoptions of subscription

Returns

IntersectionManager

this

Inherited from

EventDispatcher.on

on<E>(type, callback, options?): IntersectionManager

Type parameters

NameType
Eextends string

Parameters

Name Type
typeE
callback(eventType: E, sender: IntersectionManager, args: EventMap[E]) => void
Optional optionsOptions

Returns

IntersectionManager

Inherited from

EventDispatcher.on


removeIntersection

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.

Parameters

Name Type Description
planeObjectObject3Dthe plane object that has overlay support
meshObjectObject3Dthe mesh object that intersects the plane object

Returns

void


setAutoRedraw

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.

Parameters

Name Type
autoboolean

Returns

void


setAutoUpdateInterval

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

Parameters

Name Type
intervalnumber

Returns

void


setPropertyByIntersection

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.

Parameters

Name Type Description
planeObjectObject3Dthe plane object that has overlay support
meshObjectObject3Dthe object that intersects the plane object
propertiesPlaneMeshIntersectionOptionsthe intersection properties

Returns

void


setSilent

setSilent(bool): IntersectionManager

Set silent mode

Parameters

Name Type Description
boolbooleanflag to enable silent mode

Returns

IntersectionManager

this

Inherited from

EventDispatcher.setSilent


getClassName

Static getClassName(): string

Returns

string

Inherited from

EventDispatcher.getClassName


getDefaultInstance

Static getDefaultInstance(): IntersectionManager

Returns default instance of the IntersectionManager

Returns

IntersectionManager

this