use of net.sf.latexdraw.models.interfaces.shape.IPoint in project latexdraw by arnobl.
the class LModifiablePointsShape method setPoint.
@Override
public boolean setPoint(final double x, final double y, final int position) {
if (!MathUtils.INST.isValidPt(x, y) || position < -1 || position > points.size() || points.isEmpty())
return false;
final IPoint p = position == -1 ? points.get(points.size() - 1) : points.get(position);
p.setPoint(x, y);
return true;
}
use of net.sf.latexdraw.models.interfaces.shape.IPoint in project latexdraw by arnobl.
the class LPlot method getBottomRightPoint.
@Override
public IPoint getBottomRightPoint() {
final double step = getPlottingStep();
final IPoint pos = getPosition();
final double plotMinX = getPlotMinX();
final double yMin = IntStream.range(0, getNbPlottedPoints()).mapToDouble(x -> getY(plotMinX + x * step)).min().orElse(0.0);
return ShapeFactory.INST.createPoint(pos.getX() + getPlotMaxX() * IShape.PPC * getXScale(), pos.getY() - yMin * IShape.PPC * getYScale());
}
use of net.sf.latexdraw.models.interfaces.shape.IPoint in project latexdraw by arnobl.
the class LPlot method getTopRightPoint.
@Override
public IPoint getTopRightPoint() {
final double step = getPlottingStep();
final IPoint pos = getPosition();
final double plotMinX = getPlotMinX();
final double maxY = IntStream.range(0, getNbPlottedPoints()).mapToDouble(x -> getY(plotMinX + x * step)).max().orElse(0.0);
return ShapeFactory.INST.createPoint(pos.getX() + getPlotMaxX() * IShape.PPC * getXScale(), pos.getY() - maxY * IShape.PPC * getYScale());
}
use of net.sf.latexdraw.models.interfaces.shape.IPoint in project latexdraw by arnobl.
the class LPlot method getTopLeftPoint.
@Override
public IPoint getTopLeftPoint() {
final double step = getPlottingStep();
final IPoint pos = getPosition();
final double plotMinX = getPlotMinX();
final double yMax = IntStream.range(0, getNbPlottedPoints()).mapToDouble(x -> getY(plotMinX + x * step)).max().orElse(0.0);
return ShapeFactory.INST.createPoint(pos.getX() + plotMinX * IShape.PPC * getXScale(), pos.getY() - yMax * IShape.PPC * getYScale());
}
use of net.sf.latexdraw.models.interfaces.shape.IPoint in project latexdraw by arnobl.
the class LPositionShape method setPosition.
@Override
public void setPosition(final double x, final double y) {
if (MathUtils.INST.isValidPt(x, y)) {
final IPoint pos = getPosition();
translate(x - pos.getX(), y - pos.getY());
}
}
Aggregations