Search in sources :

Example 96 with Function

use of com.ramussoft.pb.Function in project ramus by Vitaliy-Yakovchuk.

the class MouseSelection method onProcessEndBoundsChange.

public void onProcessEndBoundsChange(MovingArea movingArea, MovingText[] panels, FloatPoint diff) {
    for (MovingText text : panels) if (text instanceof DFDSRole) {
        IDEF0Object idef = (IDEF0Object) text;
        if (contains(text))
            idef.onProcessEndBoundsChange(sectors);
    }
    for (MovingText text : panels) {
        if (!(text instanceof DFDSRole))
            if (contains(text)) {
                if (text instanceof IDEF0Object) {
                    IDEF0Object idef = (IDEF0Object) text;
                    idef.onProcessEndBoundsChange(sectors);
                }
            }
    }
    List<Ordinate> xOrdinates = new ArrayList<Ordinate>();
    List<Ordinate> yOrdinates = new ArrayList<Ordinate>();
    for (PaintSector ps : sectors) {
        for (Point point : ps.getPoints()) {
            boolean has;
            has = false;
            for (Ordinate o : xOrdinates) if (o.getOrdinateId() == point.getXOrdinate().getOrdinateId()) {
                has = true;
                break;
            }
            if (!has)
                xOrdinates.add(point.getXOrdinate());
            has = false;
            for (Ordinate o : yOrdinates) if (o.getOrdinateId() == point.getYOrdinate().getOrdinateId()) {
                has = true;
                break;
            }
            if (!has)
                yOrdinates.add(point.getYOrdinate());
        }
    }
    List<PaintSector> psrs = new ArrayList<PaintSector>();
    psrs.addAll(sectors);
    for (Ordinate xOrdinate : xOrdinates) {
        xOrdinate.setPosition(xOrdinate.getPosition() + diff.getX());
        for (Point point : xOrdinate.getPoints()) if (!psrs.contains(point.getSector()))
            psrs.add(point.getSector());
    }
    for (Ordinate yOrdinate : yOrdinates) {
        yOrdinate.setPosition(yOrdinate.getPosition() + diff.getY());
        for (Point point : yOrdinate.getPoints()) if (!psrs.contains(point.getSector()))
            psrs.add(point.getSector());
    }
    MemoryData data = new MemoryData();
    for (PaintSector paintSector : sectors) {
        Function sFunction = paintSector.getSector().getStart().getFunction();
        if (sFunction != null) {
            switch(paintSector.getSector().getStart().getFunctionType()) {
                case MovingFunction.LEFT:
                    paintSector.getStartPoint().setX(sFunction.getBounds().getLeft());
                    break;
                case MovingFunction.RIGHT:
                    paintSector.getStartPoint().setX(sFunction.getBounds().getRight());
                    break;
                case MovingFunction.TOP:
                    paintSector.getStartPoint().setY(sFunction.getBounds().getTop());
                    break;
                case MovingFunction.BOTTOM:
                    paintSector.getStartPoint().setY(sFunction.getBounds().getBottom());
                    break;
            }
        }
        sFunction = paintSector.getSector().getEnd().getFunction();
        if (sFunction != null) {
            switch(paintSector.getSector().getEnd().getFunctionType()) {
                case MovingFunction.LEFT:
                    paintSector.getEndPoint().setX(sFunction.getBounds().getLeft());
                    break;
                case MovingFunction.RIGHT:
                    paintSector.getEndPoint().setX(sFunction.getBounds().getRight());
                    break;
                case MovingFunction.TOP:
                    paintSector.getEndPoint().setY(sFunction.getBounds().getTop());
                    break;
                case MovingFunction.BOTTOM:
                    paintSector.getEndPoint().setY(sFunction.getBounds().getBottom());
                    break;
            }
        }
    }
    for (MovingText text : panels) {
        if (!(text instanceof DFDSRole))
            if (contains(text)) {
                if (!(text instanceof IDEF0Object)) {
                    text.onProcessEndBoundsChange();
                    if (text instanceof MovingLabel)
                        ((MovingLabel) text).boundsCopy = text.getBounds();
                }
            }
    }
    for (PaintSector ps : psrs) PaintSector.save(ps, data, movingArea.getDataPlugin().getEngine());
}
Also used : DFDSRole(com.ramussoft.pb.dfds.visual.DFDSRole) ArrayList(java.util.ArrayList) FloatPoint(com.dsoft.pb.types.FloatPoint) Point(com.ramussoft.pb.idef.elements.Point) Ordinate(com.ramussoft.pb.idef.elements.Ordinate) Function(com.ramussoft.pb.Function) PaintSector(com.ramussoft.pb.idef.elements.PaintSector) MemoryData(com.dsoft.utils.DataLoader.MemoryData)

Aggregations

Function (com.ramussoft.pb.Function)96 NFunction (com.ramussoft.pb.data.negine.NFunction)50 Row (com.ramussoft.pb.Row)36 MovingFunction (com.ramussoft.pb.idef.visual.MovingFunction)27 Crosspoint (com.ramussoft.pb.Crosspoint)25 Sector (com.ramussoft.pb.Sector)25 Stream (com.ramussoft.pb.Stream)21 FloatPoint (com.dsoft.pb.types.FloatPoint)19 NSector (com.ramussoft.pb.data.negine.NSector)18 DFDFunction (com.ramussoft.pb.dfd.visual.DFDFunction)17 PaintSector (com.ramussoft.pb.idef.elements.PaintSector)17 Vector (java.util.Vector)17 DFDSFunction (com.ramussoft.pb.dfds.visual.DFDSFunction)15 IOException (java.io.IOException)13 FRectangle (com.dsoft.pb.types.FRectangle)11 Point (com.ramussoft.pb.idef.elements.Point)11 SectorRefactor (com.ramussoft.pb.idef.elements.SectorRefactor)10 ByteArrayOutputStream (java.io.ByteArrayOutputStream)10 ArrayList (java.util.ArrayList)10 MovingArea (com.ramussoft.pb.idef.visual.MovingArea)8