editor › Globals › AssemblyPositioner
Class: AssemblyPositioner
Hierarchy
- AssemblyPositioner
Index
Methods
Methods
Static Private _determineCellSize
▸ _determineCellSize(assemblies: Assembly[], offset: number): Vector2
Defined in src/util/AssemblyPositioner.ts:153
Parameters:
| Name | Type |
|---|---|
assemblies |
Assembly[] |
offset |
number |
Returns: Vector2
Static Private _generateWalls
▸ _generateWalls(renderContext: RenderContext, blockedRects: Rectangle2D[]): void
Defined in src/util/AssemblyPositioner.ts:126
Parameters:
| Name | Type |
|---|---|
renderContext |
RenderContext |
blockedRects |
Rectangle2D[] |
Returns: void
Static Private _getGridSize
▸ _getGridSize(numberOfAssemblies: number): object
Defined in src/util/AssemblyPositioner.ts:169
Make a grid where one side is approx. 1.5 times the size of the other side. This doesn't take the size of the assemblies into account. (TODO implement)
Parameters:
| Name | Type |
|---|---|
numberOfAssemblies |
number |
Returns: object
-
columns: number
-
rows: number
Static arrange
▸ arrange(editor: Editor): Promise‹void›
Defined in src/util/AssemblyPositioner.ts:61
Arrange all assemblies in the editor's primary model in a nice way. ToDo: Don't cover assemblies (eg sort by height before arraning) ToDo: Rotate depending on position to see three sides for all assemblies ToDo: Align wrt mesh surfaces instead of assembly basis
Parameters:
| Name | Type |
|---|---|
editor |
Editor |
Returns: Promise‹void›
Static arrangeAssembliesInGrid
▸ arrangeAssembliesInGrid(assemblies: Assembly[], compositeModel: CompositeModel, renderContext: RenderContext, interactionPoint?: Vector3): void
Defined in src/util/AssemblyPositioner.ts:107
This will arrange the given assemblies in a 2D grid in the scene. The position of the assemblies will be altered.
Parameters:
| Name | Type | Description |
|---|---|---|
assemblies |
Assembly[] | the assemblies to arrange |
compositeModel |
CompositeModel | Used to avoid collision with existing assemblies by looking them up in the compositeModel. |
renderContext |
RenderContext | This is used to find good positions in the current viewport. TODO Implement. e.g. use renderContext.getSceneCenter() |
interactionPoint? |
Vector3 | If provided, the grid will be laid out close to this point. In world coordinates. TODO Implement |
Returns: void
Static putCloseToTarget
▸ putCloseToTarget(assembly: Assembly, editor: EditorInterface, targetPosition?: IPoint2): Promise‹void›
Defined in src/util/AssemblyPositioner.ts:22
Find a free place close to the given target position and put the given assembly on the ground there. If no target position is given, the center of the scene will be chosen as target.
Parameters:
| Name | Type | Description |
|---|---|---|
assembly |
Assembly | - |
editor |
EditorInterface | - |
targetPosition? |
IPoint2 | (optional) world space x and y coordinates to put the assembly close to. Be careful to use some meaningful position (ie another assembly's aabb center instead of it's position). |
Returns: Promise‹void›