Search in sources :

Example 1 with Point

use of com.ramussoft.pb.idef.elements.Point in project ramus by Vitaliy-Yakovchuk.

the class DFDSRole method mouseClicked.

@Override
public void mouseClicked(FloatPoint point) {
    Row owner = getFunction().getOwner();
    if (owner == null)
        super.mouseClicked(point);
    else {
        DFDSFunction function = movingArea.findDFDSFunction(owner);
        if (function == null)
            super.mouseClicked(point);
        else {
            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;
            pp.setFunction(function.getFunction(), BOTTOM);
            x.setPosition(function.getBounds().getX() + point.getX());
            y.setPosition(getY(x.getPosition(), false, function.getBounds()));
            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) Row(com.ramussoft.pb.Row) Point(com.ramussoft.pb.idef.elements.Point) FloatPoint(com.dsoft.pb.types.FloatPoint) Ordinate(com.ramussoft.pb.idef.elements.Ordinate)

Example 2 with Point

use of com.ramussoft.pb.idef.elements.Point in project ramus by Vitaliy-Yakovchuk.

the class AbstractClassicTemplate method createInPoint.

private void createInPoint(final MovingArea movingArea, final Function f, final int type, final double xp, final double yp) {
    SectorRefactor.PerspectivePoint pp;
    final Ordinate x = new Ordinate(Ordinate.TYPE_X);
    final Ordinate y = new Ordinate(Ordinate.TYPE_Y);
    final Point p = new Point(x, y);
    pp = new SectorRefactor.PerspectivePoint();
    pp.point = p;
    pp.setFunction(f, type);
    pp.type = SectorRefactor.TYPE_END;
    x.setPosition(xp);
    y.setPosition(yp);
    movingArea.getRefactor().setPoint(pp);
    movingArea.doSector();
}
Also used : SectorRefactor(com.ramussoft.pb.idef.elements.SectorRefactor) Point(com.ramussoft.pb.idef.elements.Point) Ordinate(com.ramussoft.pb.idef.elements.Ordinate)

Example 3 with Point

use of com.ramussoft.pb.idef.elements.Point in project ramus by Vitaliy-Yakovchuk.

the class DFDFunction 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)

Example 4 with Point

use of com.ramussoft.pb.idef.elements.Point in project ramus by Vitaliy-Yakovchuk.

the class DFDFunction 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 5 with Point

use of com.ramussoft.pb.idef.elements.Point in project ramus by Vitaliy-Yakovchuk.

the class IDLExporter method printSegments.

protected void printSegments(Function f) throws IOException {
    MovingArea movingArea = new MovingArea(dataPlugin, f);
    movingArea.setActiveFunction(f);
    SectorRefactor sr = movingArea.getRefactor();
    for (int i = 0; i < sr.getSectorsCount(); i++) {
        PaintSector ps = sr.getSector(i);
        writer.p1("ARROWSEG " + (i + 1));
        writer.right();
        writer.p1("SOURCE " + getName(ps.getSector().getStart(), f, ps.getSector(), sr, ps.getPoint(0)));
        StringBuffer path = new StringBuffer();
        path.append("PATH ");
        for (int j = 0; j < ps.getPointCount(); j++) {
            Point point = ps.getPoint(j);
            path.append(toCoortinate(point.getX(), point.getY()));
        }
        writer.p1(path.toString());
        String s = ps.getAlternativeText();
        if ("".equals(s))
            s = ps.getSector().getName();
        if ((s != null) && (s.length() > 0)) {
            MovingLabel text = ps.getText();
            if (text != null) {
                final PStringBounder nb = new PStringBounder(null);
                nb.setFont(text.getFont());
                final PStringBounder.Tokanizer tokanizer = nb.getTokanizer(s, text.getBounds().getWidth(), 0);
                StringBuffer sb = new StringBuffer();
                if (tokanizer.hasMoreData())
                    sb.append(tokanizer.getNext());
                while (tokanizer.hasMoreData()) {
                    sb.append("<CR>");
                    sb.append(tokanizer.getNext());
                }
                writer.p2("LABEL {0}", "{LWI I 0 " + toByteTextIndex(text.getColor()) + " " + toByteTextIndex(text.getColor()) + " }" + sb.toString());
                writer.p1("LABEL COORDINATES " + toCoortinate(ps.getText().getBounds().getX(), ps.getText().getBounds().getCenter().getY()));
                if (ps.isShowTilda()) {
                    writer.p1("SQUIGGLE COORDINATES " + toCoortinate(ps.getTildaOPoint()) + " " + toCoortinate(ps.getTildaPoint()));
                }
            } else
                writer.p2("LABEL {0}", s);
        }
        writer.p1("SINK " + getName(ps.getSector().getEnd(), f, ps.getSector(), sr, ps.getPoint(ps.getPointCount() - 1)));
        writer.left();
        writer.p1("ENDSEG");
    }
}
Also used : MovingArea(com.ramussoft.pb.idef.visual.MovingArea) PStringBounder(com.ramussoft.pb.print.PStringBounder) SectorRefactor(com.ramussoft.pb.idef.elements.SectorRefactor) MovingLabel(com.ramussoft.pb.idef.visual.MovingLabel) PaintSector(com.ramussoft.pb.idef.elements.PaintSector) FloatPoint(com.dsoft.pb.types.FloatPoint) Point(com.ramussoft.pb.idef.elements.Point) FloatPoint(com.dsoft.pb.types.FloatPoint) Crosspoint(com.ramussoft.pb.Crosspoint) Point(com.ramussoft.pb.idef.elements.Point)

Aggregations

Point (com.ramussoft.pb.idef.elements.Point)21 FloatPoint (com.dsoft.pb.types.FloatPoint)19 SectorRefactor (com.ramussoft.pb.idef.elements.SectorRefactor)12 Ordinate (com.ramussoft.pb.idef.elements.Ordinate)11 PaintSector (com.ramussoft.pb.idef.elements.PaintSector)6 Crosspoint (com.ramussoft.pb.Crosspoint)5 GeneralPath (java.awt.geom.GeneralPath)4 Point2D (java.awt.geom.Point2D)4 Function (com.ramussoft.pb.Function)3 FRectangle (com.dsoft.pb.types.FRectangle)2 Row (com.ramussoft.pb.Row)2 Sector (com.ramussoft.pb.Sector)2 PerspectivePoint (com.ramussoft.pb.idef.elements.SectorRefactor.PerspectivePoint)2 MovingLabel (com.ramussoft.pb.idef.visual.MovingLabel)2 ArrayList (java.util.ArrayList)2 Vector (java.util.Vector)2 MemoryData (com.dsoft.utils.DataLoader.MemoryData)1 AbstractSector (com.ramussoft.pb.data.AbstractSector)1 NFunction (com.ramussoft.pb.data.negine.NFunction)1 NSector (com.ramussoft.pb.data.negine.NSector)1