Search in sources :

Example 21 with Point

use of com.ramussoft.pb.idef.elements.Point 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

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