Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
9e679da90This file is pinned to the selected release. Download the original to open it in your design tool.
package com.marginallyclever.makelangelo.donatelloimpl.nodes;
import com.marginallyclever.makelangelo.donatelloimpl.ports.InputTurtle;
import com.marginallyclever.makelangelo.turtle.Turtle;
import com.marginallyclever.nodegraphcore.Node;
import com.marginallyclever.nodegraphcore.port.Output;
import java.awt.*;
import java.awt.geom.Rectangle2D;
/**
* Returns the bounding box of the turtle's path.
* @author Dan Royer
* @since 2022-04-14
*/
public class TurtleToRectangle extends Node {
private final InputTurtle turtle = new InputTurtle("turtle");
private final Output<Rectangle2D> output = new Output<>("output", Rectangle2D.class, new Rectangle(0,0,0,0));
public TurtleToRectangle() {
super("TurtleToRectangle");
addVariable(turtle);
addVariable(output);
}
@Override
public void update() {
Turtle myTurtle = turtle.getValue();
if(myTurtle!=null ) {
output.send(myTurtle.getBounds());
}
}
}