Search in sources :

Example 11 with FloatPoint

use of com.dsoft.pb.types.FloatPoint in project ramus by Vitaliy-Yakovchuk.

the class SectorRefactor method createOutPaintPart.

private PaintSector createOutPaintPart(final Sector sector, double pos) {
    final Point a = new Point();
    final Point b = new Point();
    final FloatPoint p = new FloatPoint();
    boolean start = sector.getStart().getType() == SectorBorder.TYPE_BORDER;
    int endBorderType = sector.getEnd().getBorderType();
    int startBorderType = sector.getStart().getBorderType();
    if (start) {
        switch(startBorderType) {
            case MovingPanel.TOP:
                {
                    p.setX(pos);
                    final FloatPoint st = getOutCoordinate(sector.getEnd().getFunction(), p, MovingPanel.TOP);
                    final Ordinate o = new Ordinate(Ordinate.TYPE_X);
                    o.setPosition(st.getX());
                    a.setXOrdinate(o);
                    b.setXOrdinate(o);
                    a.setYOrdinate(new Ordinate(Ordinate.TYPE_Y));
                    b.setYOrdinate(new Ordinate(Ordinate.TYPE_Y));
                    a.setY(MovingArea.PART_SPACE);
                    b.setY(st.getY());
                }
                break;
            case MovingPanel.BOTTOM:
                {
                    p.setX(pos);
                    final FloatPoint st = getOutCoordinate(sector.getEnd().getFunction(), p, MovingPanel.BOTTOM);
                    final Ordinate o = new Ordinate(Ordinate.TYPE_X);
                    o.setPosition(st.getX());
                    a.setXOrdinate(o);
                    b.setXOrdinate(o);
                    a.setYOrdinate(new Ordinate(Ordinate.TYPE_Y));
                    b.setYOrdinate(new Ordinate(Ordinate.TYPE_Y));
                    a.setY(movingArea.getDoubleHeight() - MovingArea.PART_SPACE);
                    b.setY(st.getY());
                }
                break;
            case MovingPanel.LEFT:
                {
                    p.setY(pos);
                    final FloatPoint st = getOutCoordinate(sector.getEnd().getFunction(), p, MovingPanel.LEFT);
                    final Ordinate o = new Ordinate(Ordinate.TYPE_Y);
                    o.setPosition(st.getY());
                    a.setYOrdinate(o);
                    b.setYOrdinate(o);
                    a.setXOrdinate(new Ordinate(Ordinate.TYPE_X));
                    b.setXOrdinate(new Ordinate(Ordinate.TYPE_X));
                    a.setX(MovingArea.PART_SPACE);
                    b.setX(st.getX());
                }
                break;
            default:
                {
                    p.setY(pos);
                    final FloatPoint st = getOutCoordinate(sector.getEnd().getFunction(), p, MovingPanel.RIGHT);
                    final Ordinate o = new Ordinate(Ordinate.TYPE_Y);
                    o.setPosition(st.getY());
                    a.setYOrdinate(o);
                    b.setYOrdinate(o);
                    a.setXOrdinate(new Ordinate(Ordinate.TYPE_X));
                    b.setXOrdinate(new Ordinate(Ordinate.TYPE_X));
                    b.setX(st.getX());
                    a.setX(movingArea.getDoubleWidth() - MovingArea.PART_SPACE);
                }
                break;
        }
    /*if (function.getDecompositionType() == MovingArea.DIAGRAM_TYPE_DFDS) {
				switch (startBorderType) {
				case MovingPanel.TOP: {
					a.setY(role.getBottom());
					a.setX(role.getCenter().getX());
				}
					break;
				case MovingPanel.BOTTOM: {
					a.setY(role.getTop());
					a.setX(role.getCenter().getX());
				}
					break;
				case MovingPanel.LEFT: {
					a.setY(role.getCenter().getY());
					a.setX(role.getRight());
				}
					break;
				default: {
					a.setY(role.getCenter().getY());
					a.setX(role.getLeft());
				}
					break;
				}
			}*/
    } else {
        switch(endBorderType) {
            case MovingPanel.RIGHT:
                {
                    p.setY(pos);
                    final FloatPoint st = getOutCoordinate(sector.getStart().getFunction(), p, MovingPanel.RIGHT);
                    final Ordinate o = new Ordinate(Ordinate.TYPE_Y);
                    o.setPosition(st.getY());
                    a.setYOrdinate(o);
                    b.setYOrdinate(o);
                    a.setXOrdinate(new Ordinate(Ordinate.TYPE_X));
                    b.setXOrdinate(new Ordinate(Ordinate.TYPE_X));
                    a.setX(st.getX());
                    b.setX(movingArea.getDoubleWidth() - MovingArea.PART_SPACE);
                }
                break;
            case MovingPanel.LEFT:
                {
                    p.setY(pos);
                    final FloatPoint st = getOutCoordinate(sector.getStart().getFunction(), p, MovingPanel.LEFT);
                    final Ordinate o = new Ordinate(Ordinate.TYPE_Y);
                    o.setPosition(st.getY());
                    a.setYOrdinate(o);
                    b.setYOrdinate(o);
                    a.setXOrdinate(new Ordinate(Ordinate.TYPE_X));
                    b.setXOrdinate(new Ordinate(Ordinate.TYPE_X));
                    a.setX(st.getX());
                    b.setX(MovingArea.PART_SPACE);
                }
                break;
            case MovingPanel.TOP:
                {
                    p.setX(pos);
                    final FloatPoint st = getOutCoordinate(sector.getStart().getFunction(), p, MovingPanel.TOP);
                    final Ordinate o = new Ordinate(Ordinate.TYPE_X);
                    o.setPosition(st.getX());
                    a.setXOrdinate(o);
                    b.setXOrdinate(o);
                    a.setYOrdinate(new Ordinate(Ordinate.TYPE_Y));
                    b.setYOrdinate(new Ordinate(Ordinate.TYPE_Y));
                    a.setY(st.getY());
                    b.setY(MovingArea.PART_SPACE);
                }
                break;
            case MovingPanel.BOTTOM:
                {
                    p.setX(pos);
                    final FloatPoint st = getOutCoordinate(sector.getStart().getFunction(), p, MovingPanel.BOTTOM);
                    final Ordinate o = new Ordinate(Ordinate.TYPE_X);
                    o.setPosition(st.getX());
                    a.setXOrdinate(o);
                    b.setXOrdinate(o);
                    a.setYOrdinate(new Ordinate(Ordinate.TYPE_Y));
                    b.setYOrdinate(new Ordinate(Ordinate.TYPE_Y));
                    a.setY(st.getY());
                    b.setY(movingArea.getDoubleHeight() - MovingArea.PART_SPACE);
                }
                break;
        }
    /*if (function.getDecompositionType() == MovingArea.DIAGRAM_TYPE_DFDS) {
				switch (endBorderType) {
				case MovingPanel.TOP: {
					b.setY(role.getBottom());
					b.setX(role.getCenter().getX());
				}
					break;
				case MovingPanel.BOTTOM: {
					b.setY(role.getTop());
					b.setX(role.getCenter().getX());
				}
					break;
				case MovingPanel.LEFT: {
					b.setY(role.getCenter().getY());
					b.setX(role.getRight());
				}
					break;
				default: {
					b.setY(role.getCenter().getY());
					b.setX(role.getLeft());
				}
					break;
				}
			}*/
    }
    return new PaintSector(sector, a, b, movingArea);
}
Also used : FloatPoint(com.dsoft.pb.types.FloatPoint) FloatPoint(com.dsoft.pb.types.FloatPoint) Crosspoint(com.ramussoft.pb.Crosspoint) FloatPoint(com.dsoft.pb.types.FloatPoint)

Example 12 with FloatPoint

use of com.dsoft.pb.types.FloatPoint in project ramus by Vitaliy-Yakovchuk.

the class SectorRefactor method getOutCoordinate.

private FloatPoint getOutCoordinate(final Function function, final FloatPoint in, final int borderType) {
    final FloatPoint res = new FloatPoint();
    final FRectangle b = function.getBounds();
    switch(borderType) {
        case MovingPanel.LEFT:
            {
                res.setX(b.getLeft());
                res.setY(getOutPos(in.getY(), b.getHeight(), b.getTop(), movingArea.getDoubleHeight()));
            }
            break;
        case MovingPanel.RIGHT:
            {
                res.setX(b.getRight());
                res.setY(getOutPos(in.getY(), b.getHeight(), b.getTop(), movingArea.getDoubleHeight()));
            }
            break;
        case MovingPanel.TOP:
            {
                res.setX(getOutPos(in.getX(), b.getWidth(), b.getLeft(), movingArea.getDoubleWidth()));
                res.setY(b.getTop());
            }
            break;
        case MovingPanel.BOTTOM:
            {
                res.setX(getOutPos(in.getX(), b.getWidth(), b.getLeft(), movingArea.getDoubleWidth()));
                res.setY(b.getBottom());
            }
            break;
    }
    return res;
}
Also used : FloatPoint(com.dsoft.pb.types.FloatPoint) FRectangle(com.dsoft.pb.types.FRectangle)

Example 13 with FloatPoint

use of com.dsoft.pb.types.FloatPoint in project ramus by Vitaliy-Yakovchuk.

the class SectorRefactor method createOutPaintPart.

/**
 * Метод, який створює відображення для сектора на верху.
 *
 * @param sector Сектор, для якого буде створено відображення.
 */
private void createOutPaintPart(final Sector sector) {
    final double pos = sector.getCreatePos();
    final Point a = new Point();
    final Point b = new Point();
    final FloatPoint p = new FloatPoint();
    boolean start = sector.getStart().getType() == SectorBorder.TYPE_BORDER;
    int endBorderType = sector.getEnd().getBorderType();
    int startBorderType = sector.getStart().getBorderType();
    if (start) {
        switch(startBorderType) {
            case MovingPanel.TOP:
                {
                    p.setX(pos);
                    final FloatPoint st = getOutCoordinate(sector.getEnd().getFunction(), p, MovingPanel.TOP);
                    final Ordinate o = new Ordinate(Ordinate.TYPE_X);
                    o.setPosition(st.getX());
                    a.setXOrdinate(o);
                    b.setXOrdinate(o);
                    a.setYOrdinate(new Ordinate(Ordinate.TYPE_Y));
                    b.setYOrdinate(new Ordinate(Ordinate.TYPE_Y));
                    a.setY(MovingArea.PART_SPACE);
                    b.setY(st.getY());
                }
                break;
            case MovingPanel.BOTTOM:
                {
                    p.setX(pos);
                    final FloatPoint st = getOutCoordinate(sector.getEnd().getFunction(), p, MovingPanel.BOTTOM);
                    final Ordinate o = new Ordinate(Ordinate.TYPE_X);
                    o.setPosition(st.getX());
                    a.setXOrdinate(o);
                    b.setXOrdinate(o);
                    a.setYOrdinate(new Ordinate(Ordinate.TYPE_Y));
                    b.setYOrdinate(new Ordinate(Ordinate.TYPE_Y));
                    a.setY(movingArea.getDoubleHeight() - MovingArea.PART_SPACE);
                    b.setY(st.getY());
                }
                break;
            case MovingPanel.LEFT:
                {
                    p.setY(pos);
                    final FloatPoint st = getOutCoordinate(sector.getEnd().getFunction(), p, MovingPanel.LEFT);
                    final Ordinate o = new Ordinate(Ordinate.TYPE_Y);
                    o.setPosition(st.getY());
                    a.setYOrdinate(o);
                    b.setYOrdinate(o);
                    a.setXOrdinate(new Ordinate(Ordinate.TYPE_X));
                    b.setXOrdinate(new Ordinate(Ordinate.TYPE_X));
                    a.setX(MovingArea.PART_SPACE);
                    b.setX(st.getX());
                }
                break;
            default:
                {
                    p.setY(pos);
                    final FloatPoint st = getOutCoordinate(sector.getEnd().getFunction(), p, MovingPanel.RIGHT);
                    final Ordinate o = new Ordinate(Ordinate.TYPE_Y);
                    o.setPosition(st.getY());
                    a.setYOrdinate(o);
                    b.setYOrdinate(o);
                    a.setXOrdinate(new Ordinate(Ordinate.TYPE_X));
                    b.setXOrdinate(new Ordinate(Ordinate.TYPE_X));
                    b.setX(st.getX());
                    a.setX(movingArea.getDoubleWidth() - MovingArea.PART_SPACE);
                }
                break;
        }
    /*if (function.getDecompositionType() == MovingArea.DIAGRAM_TYPE_DFDS) {
				switch (startBorderType) {
				case MovingPanel.TOP: {
					a.setY(role.getBottom());
					a.setX(role.getCenter().getX());
				}
					break;
				case MovingPanel.BOTTOM: {
					a.setY(role.getTop());
					a.setX(role.getCenter().getX());
				}
					break;
				case MovingPanel.LEFT: {
					a.setY(role.getCenter().getY());
					a.setX(role.getRight());
				}
					break;
				default: {
					a.setY(role.getCenter().getY());
					a.setX(role.getLeft());
				}
					break;
				}
			}*/
    } else {
        switch(endBorderType) {
            case MovingPanel.RIGHT:
                {
                    p.setY(pos);
                    final FloatPoint st = getOutCoordinate(sector.getStart().getFunction(), p, MovingPanel.RIGHT);
                    final Ordinate o = new Ordinate(Ordinate.TYPE_Y);
                    o.setPosition(st.getY());
                    a.setYOrdinate(o);
                    b.setYOrdinate(o);
                    a.setXOrdinate(new Ordinate(Ordinate.TYPE_X));
                    b.setXOrdinate(new Ordinate(Ordinate.TYPE_X));
                    a.setX(st.getX());
                    b.setX(movingArea.getDoubleWidth() - MovingArea.PART_SPACE);
                }
                break;
            case MovingPanel.LEFT:
                {
                    p.setY(pos);
                    final FloatPoint st = getOutCoordinate(sector.getStart().getFunction(), p, MovingPanel.LEFT);
                    final Ordinate o = new Ordinate(Ordinate.TYPE_Y);
                    o.setPosition(st.getY());
                    a.setYOrdinate(o);
                    b.setYOrdinate(o);
                    a.setXOrdinate(new Ordinate(Ordinate.TYPE_X));
                    b.setXOrdinate(new Ordinate(Ordinate.TYPE_X));
                    a.setX(st.getX());
                    b.setX(MovingArea.PART_SPACE);
                }
                break;
            case MovingPanel.TOP:
                {
                    p.setX(pos);
                    final FloatPoint st = getOutCoordinate(sector.getStart().getFunction(), p, MovingPanel.TOP);
                    final Ordinate o = new Ordinate(Ordinate.TYPE_X);
                    o.setPosition(st.getX());
                    a.setXOrdinate(o);
                    b.setXOrdinate(o);
                    a.setYOrdinate(new Ordinate(Ordinate.TYPE_Y));
                    b.setYOrdinate(new Ordinate(Ordinate.TYPE_Y));
                    a.setY(st.getY());
                    b.setY(MovingArea.PART_SPACE);
                }
                break;
            case MovingPanel.BOTTOM:
                {
                    p.setX(pos);
                    final FloatPoint st = getOutCoordinate(sector.getStart().getFunction(), p, MovingPanel.BOTTOM);
                    final Ordinate o = new Ordinate(Ordinate.TYPE_X);
                    o.setPosition(st.getX());
                    a.setXOrdinate(o);
                    b.setXOrdinate(o);
                    a.setYOrdinate(new Ordinate(Ordinate.TYPE_Y));
                    b.setYOrdinate(new Ordinate(Ordinate.TYPE_Y));
                    a.setY(st.getY());
                    b.setY(movingArea.getDoubleHeight() - MovingArea.PART_SPACE);
                }
                break;
        }
    /*if (function.getDecompositionType() == MovingArea.DIAGRAM_TYPE_DFDS) {
				switch (endBorderType) {
				case MovingPanel.TOP: {
					b.setY(role.getBottom());
					b.setX(role.getCenter().getX());
				}
					break;
				case MovingPanel.BOTTOM: {
					b.setY(role.getTop());
					b.setX(role.getCenter().getX());
				}
					break;
				case MovingPanel.LEFT: {
					b.setY(role.getCenter().getY());
					b.setX(role.getRight());
				}
					break;
				default: {
					b.setY(role.getCenter().getY());
					b.setX(role.getLeft());
				}
					break;
				}
			}*/
    }
    addSector(new PaintSector(sector, a, b, movingArea));
}
Also used : FloatPoint(com.dsoft.pb.types.FloatPoint) FloatPoint(com.dsoft.pb.types.FloatPoint) Crosspoint(com.ramussoft.pb.Crosspoint) FloatPoint(com.dsoft.pb.types.FloatPoint)

Example 14 with FloatPoint

use of com.dsoft.pb.types.FloatPoint in project ramus by Vitaliy-Yakovchuk.

the class DFDFunctionEllipse method getTriangle.

protected int getTriangle(final FloatPoint point) {
    int res = -1;
    FloatPoint l = getLocation();
    for (int type = MovingPanel.RIGHT; type <= MovingPanel.TOP; type++) {
        GeneralPath gp = getTrianglePath(type);
        double y = point.getY() + l.getY();
        double x = point.getX() + l.getX();
        if (gp.contains(new Point2D.Double(x, y))) {
            res = type;
            break;
        }
    }
    return res;
}
Also used : FloatPoint(com.dsoft.pb.types.FloatPoint) GeneralPath(java.awt.geom.GeneralPath) Point2D(java.awt.geom.Point2D) FloatPoint(com.dsoft.pb.types.FloatPoint) Point(com.ramussoft.pb.idef.elements.Point)

Example 15 with FloatPoint

use of com.dsoft.pb.types.FloatPoint in project ramus by Vitaliy-Yakovchuk.

the class DFDFunctionEllipse method mouseClicked.

public void mouseClicked(final FloatPoint point) {
    if (movingArea.getChangingState() == MovingArea.ARROW_CHANGING_STATE) {
        final int type = getTriangle(point);
        final Ordinate x = new Ordinate(Ordinate.TYPE_X);
        final Ordinate y = new Ordinate(Ordinate.TYPE_Y);
        final Point p = new Point(x, y);
        final SectorRefactor.PerspectivePoint pp = new SectorRefactor.PerspectivePoint();
        pp.point = p;
        switch(type) {
            case LEFT:
                {
                    pp.setFunction(getFunction(), LEFT);
                    y.setPosition(getBounds().getY() + point.getY());
                    x.setPosition(getX(y.getPosition(), true, getBounds()));
                }
                break;
            case TOP:
                {
                    pp.setFunction(getFunction(), TOP);
                    x.setPosition(getBounds().getX() + point.getX());
                    y.setPosition(getY(x.getPosition(), true, getBounds()));
                }
                break;
            case BOTTOM:
                {
                    pp.setFunction(getFunction(), BOTTOM);
                    x.setPosition(getBounds().getX() + point.getX());
                    y.setPosition(getY(x.getPosition(), false, getBounds()));
                }
                break;
            case RIGHT:
                {
                    pp.setFunction(getFunction(), RIGHT);
                    y.setPosition(getBounds().getY() + point.getY());
                    x.setPosition(getX(y.getPosition(), false, getBounds()));
                }
                break;
            default:
                return;
        }
        if (movingArea.getPointChangingType() == SectorRefactor.TYPE_START) {
            pp.type = SectorRefactor.TYPE_START;
            movingArea.getRefactor().setPoint(pp);
            movingArea.doSector();
        } else if (movingArea.getPointChangingType() == SectorRefactor.TYPE_END) {
            pp.type = SectorRefactor.TYPE_END;
            movingArea.getRefactor().setPoint(pp);
            movingArea.doSector();
        }
    }
}
Also used : SectorRefactor(com.ramussoft.pb.idef.elements.SectorRefactor) FloatPoint(com.dsoft.pb.types.FloatPoint) Point(com.ramussoft.pb.idef.elements.Point) FloatPoint(com.dsoft.pb.types.FloatPoint) Point(com.ramussoft.pb.idef.elements.Point) Ordinate(com.ramussoft.pb.idef.elements.Ordinate)

Aggregations

FloatPoint (com.dsoft.pb.types.FloatPoint)25 Point (com.ramussoft.pb.idef.elements.Point)14 Crosspoint (com.ramussoft.pb.Crosspoint)8 Ordinate (com.ramussoft.pb.idef.elements.Ordinate)7 SectorRefactor (com.ramussoft.pb.idef.elements.SectorRefactor)6 Function (com.ramussoft.pb.Function)5 PaintSector (com.ramussoft.pb.idef.elements.PaintSector)4 GeneralPath (java.awt.geom.GeneralPath)4 Point2D (java.awt.geom.Point2D)4 FRectangle (com.dsoft.pb.types.FRectangle)3 IOException (java.io.IOException)3 ArrayList (java.util.ArrayList)3 NFunction (com.ramussoft.pb.data.negine.NFunction)2 DFDFunction (com.ramussoft.pb.dfd.visual.DFDFunction)2 MovingFunction (com.ramussoft.pb.idef.visual.MovingFunction)2 MovingText (com.ramussoft.pb.idef.visual.MovingText)2 StringTokenizer (java.util.StringTokenizer)2 Status (com.dsoft.pb.idef.elements.Status)1 MemoryData (com.dsoft.utils.DataLoader.MemoryData)1 Rows (com.ramussoft.gui.qualifier.table.Rows)1