use of com.willwinder.ugs.nbp.designer.entities.cuttable.Ellipse in project Universal-G-Code-Sender by winder.
the class EntityEllipseV1 method toInternal.
@Override
public Entity toInternal() {
Ellipse ellipse = new Ellipse();
applyCommonAttributes(ellipse);
return ellipse;
}
use of com.willwinder.ugs.nbp.designer.entities.cuttable.Ellipse in project Universal-G-Code-Sender by winder.
the class CreateEllipseControl method createEntity.
private void createEntity() {
double startX = Math.min(startPosition.getX(), endPosition.getX());
double endX = Math.max(startPosition.getX(), endPosition.getX());
double startY = Math.min(startPosition.getY(), endPosition.getY());
double endY = Math.max(startPosition.getY(), endPosition.getY());
Ellipse ellipse = new Ellipse(startX, startY);
ellipse.setSize(new Size(endX - startX, endY - startY));
AddAction addAction = new AddAction(controller, ellipse);
addAction.actionPerformed(new ActionEvent(this, 0, ""));
controller.addEntity(ellipse);
}
use of com.willwinder.ugs.nbp.designer.entities.cuttable.Ellipse in project Universal-G-Code-Sender by winder.
the class SvgReader method parseEllipse.
private AbstractEntity parseEllipse(Ellipse2D shape) {
Ellipse circle = new Ellipse(shape.getX(), shape.getY());
circle.setSize(new Size(shape.getWidth(), shape.getHeight()));
return circle;
}
use of com.willwinder.ugs.nbp.designer.entities.cuttable.Ellipse in project Universal-G-Code-Sender by winder.
the class DxfReader method parseCircles.
private Group parseCircles(DXFLayer layer) {
Group circlesGroup = new Group();
List<DXFCircle> circles = layer.getDXFEntities(DXFConstants.ENTITY_TYPE_CIRCLE);
if (circles != null) {
for (DXFCircle circle : circles) {
double radius = circle.getRadius() * MILLIMETERS_PER_INCH;
Ellipse ellipse = new Ellipse((circle.getCenterPoint().getX() * MILLIMETERS_PER_INCH) - radius, (circle.getCenterPoint().getY() * MILLIMETERS_PER_INCH) - radius);
ellipse.setSize(new Size(radius * 2, radius * 2));
circlesGroup.addChild(ellipse);
}
}
return circlesGroup;
}
use of com.willwinder.ugs.nbp.designer.entities.cuttable.Ellipse in project Universal-G-Code-Sender by winder.
the class EntityComparatorTest method generateEntities.
private List<Cuttable> generateEntities(int widthAndHeight) {
List<Cuttable> entities = new ArrayList<>();
double count = 0;
while (count++ < 1000) {
Ellipse ellipse = new Ellipse(RandomUtils.nextDouble(0, widthAndHeight), RandomUtils.nextDouble(0, widthAndHeight));
ellipse.setSize(new Size(0.1, 0.1));
entities.add(ellipse);
}
return entities;
}
Aggregations