Package com.j3d.gen.grid
Class GridManager
java.lang.Object
com.j3d.gen.grid.GridManager
- All Implemented Interfaces:
EventListener
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate final ArrayList<SamePair<ScreenPoint>> Grid lines.private final ArrayList<GridObject<?>> private final intprivate final Grid2DPanelprivate final HashMap<UUID, Consumer<Graphics2D>> Temporary consumers whichGrid2DPanelmight want. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoiddelete(CartesianPoint cartesianPoint) Delete a point at the given coordinates.voidDelete any point or line which intersects with the given linestatic voiddrawDirArr(Graphics2D g, CartesianPoint pos, AxisPlane plane, boolean xDir) static voiddrawMouse(Graphics2D g, CartesianPoint mousePos, AxisPlane plane) Draws the mouse in the world on the actual 3D planevoidIf the given point's coordinates dont already exist withinobjects, add it.static OffsetfromMut()ArrayList<GridObject<?>> private voidgrid()Draws the grid with all scaling applied.private voidinit()initialises all the drawing shenanigans we need to do being: The origin point The grid lines Temporary consumersvoidboolean<K> voidonEvent(EventType event, EventPayload<K> properties) onEvent is called byEventEmitterviaEventEmitter.broadcast(EventType, EventPayload).private voidRegister a grid line to draw on the gridvoidremoveReactivePoint(ReactivePoint point) voidrepaint()voidsetDeleteMode(boolean deleteMode)
-
Field Details
-
objects
-
ovalRadius
private final int ovalRadius- See Also:
-
temporaryDrawConsumers
Temporary consumers whichGrid2DPanelmight want. One being the deletion line drawn atop of everything. -
panel
-
deleteMode
private boolean deleteMode -
gridlinesPoints
Grid lines. Except here the lines are represented as 2 screen points to join in a SamePair.
-
-
Constructor Details
-
GridManager
-
-
Method Details
-
getObjects
-
isDeleteMode
public boolean isDeleteMode() -
setDeleteMode
public void setDeleteMode(boolean deleteMode) -
getTemporaryDrawConsumers
-
repaint
public void repaint() -
addExistingPoints
public void addExistingPoints() -
invalidateAndRemoveAllReactive
public void invalidateAndRemoveAllReactive() -
removeReactivePoint
-
onEvent
Description copied from interface:EventListeneronEvent is called byEventEmitterviaEventEmitter.broadcast(EventType, EventPayload). Allowing the emitter to call any other object that implements this.- Specified by:
onEventin interfaceEventListener- Type Parameters:
K- The type of the emitter of this event- Parameters:
event- The type of eventproperties- The given event payload
-
getAxisPlane
-
init
private void init()initialises all the drawing shenanigans we need to do being:- The origin point
- The grid lines
- Temporary consumers
-
regInGrid
Register a grid line to draw on the grid- Parameters:
p- Point As- Point B
-
grid
private void grid()Draws the grid with all scaling applied. -
existing
If the given point's coordinates dont already exist withinobjects, add it.- Parameters:
p- The point supplier (why the fuck is this a supplier)
-
delete
Delete a point at the given coordinates.- Parameters:
cartesianPoint- The position of the point to delete at.
-
delete
Delete any point or line which intersects with the given line- Parameters:
l- The query line. usually drawn by the user.
-
drawMouse
Draws the mouse in the world on the actual 3D plane- Parameters:
g- Graphics bro.mousePos- The position of the mouse in cartesian terms according to the planeplane- The plane in question
-
drawDirArr
-
fromMut
-