Search in sources :

Example 1 with MemoryData

use of com.dsoft.utils.DataLoader.MemoryData in project ramus by Vitaliy-Yakovchuk.

the class PaintSector method savePointOrdinates.

private void savePointOrdinates(List<Ordinate> ordinates) {
    List<PaintSector> paintSectors = new ArrayList<PaintSector>();
    for (Ordinate ordinate : ordinates) {
        for (Point point : ordinate.getPoints()) if (!paintSectors.contains(point.getSector()))
            paintSectors.add(point.getSector());
    }
    MemoryData memoryData = new MemoryData();
    Engine engine = getMovingArea().getDataPlugin().getEngine();
    for (PaintSector paintSector : paintSectors) save(paintSector, memoryData, engine);
}
Also used : MemoryData(com.dsoft.utils.DataLoader.MemoryData) ArrayList(java.util.ArrayList) FloatPoint(com.dsoft.pb.types.FloatPoint) Engine(com.ramussoft.common.Engine)

Example 2 with MemoryData

use of com.dsoft.utils.DataLoader.MemoryData in project ramus by Vitaliy-Yakovchuk.

the class DFDSFunction method onProcessEndBoundsChange.

@Override
public void onProcessEndBoundsChange() {
    FRectangle oldRec = function.getBounds();
    myBounds.setTransformNetBounds(MovingArea.NET_LENGTH);
    FRectangle newRect = new FRectangle(myBounds);
    function.setBounds(newRect);
    final SectorRefactor refactor = movingArea.getRefactor();
    MemoryData memoryData = new MemoryData();
    List<PaintSector> list = new ArrayList<PaintSector>();
    for (int i = 0; i < refactor.getSectorsCount(); i++) {
        PaintSector sector = refactor.getSector(i);
        try {
            setAddedSectorPos(oldRec, sector, list);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    for (PaintSector ps : list) PaintSector.save(ps, memoryData, ((NFunction) function).getEngine());
    setAddedRolesPos(oldRec, newRect);
}
Also used : SectorRefactor(com.ramussoft.pb.idef.elements.SectorRefactor) FRectangle(com.dsoft.pb.types.FRectangle) PaintSector(com.ramussoft.pb.idef.elements.PaintSector) NFunction(com.ramussoft.pb.data.negine.NFunction) MemoryData(com.dsoft.utils.DataLoader.MemoryData) ArrayList(java.util.ArrayList) FloatPoint(com.dsoft.pb.types.FloatPoint) Crosspoint(com.ramussoft.pb.Crosspoint)

Example 3 with MemoryData

use of com.dsoft.utils.DataLoader.MemoryData in project ramus by Vitaliy-Yakovchuk.

the class DFDSRole method onProcessEndBoundsChange.

@Override
public void onProcessEndBoundsChange() {
    final FRectangle oldRec = function.getBounds();
    myBounds.setTransformNetBounds(MovingArea.NET_LENGTH);
    List<PaintSector> list = new ArrayList<PaintSector>();
    final SectorRefactor refactor = movingArea.getRefactor();
    boolean sectorReplaced = false;
    DFDSFunction function = movingArea.findDFDSFunction(this.getBounds());
    if (function != null) {
        getFunction().setOwner(function.getFunction());
        for (int i = 0; i < refactor.getSectorsCount(); i++) {
            PaintSector ps = refactor.getSector(i);
            Function function2 = ps.getSector().getStart().getFunction();
            if (function2 != null && function2.equals(this.function)) {
                replaceFunction(ps.getSector().getStart(), ps, list, ps.getStartPoint(), ps.getSector().getStart().getFunctionType(), function, refactor, true);
            }
            Function function3 = ps.getSector().getEnd().getFunction();
            if (function3 != null && function3.equals(this.function)) {
                replaceFunction(ps.getSector().getEnd(), ps, list, ps.getEndPoint(), ps.getSector().getEnd().getFunctionType(), function, refactor, false);
            }
        }
        function.justifyRoles();
        sectorReplaced = true;
    } else {
        if (this.getFunction().getOwner() != null) {
            DFDSFunction function2 = movingArea.findDFDSFunction(this.getFunction().getOwner());
            if (function2 != null && function2.getBounds().intersects(this.getBounds())) {
                function2.justifyRoles();
            } else
                this.function.setBounds(new FRectangle(myBounds));
        } else
            this.function.setBounds(new FRectangle(myBounds));
    }
    MemoryData memoryData = new MemoryData();
    if (!sectorReplaced) {
        for (int i = 0; i < refactor.getSectorsCount(); i++) {
            PaintSector sector = refactor.getSector(i);
            setAddedSectorPos(oldRec, sector, list);
        }
    }
    for (PaintSector ps : list) PaintSector.save(ps, memoryData, ((NFunction) this.function).getEngine());
    long l = this.function.getLink();
    if (l >= 0l) {
        Stream stream = (Stream) movingArea.getDataPlugin().findRowByGlobalId(l);
        if (stream != null) {
            Row[] rows = stream.getAdded();
            RectangleVisualOptions ops = new RectangleVisualOptions();
            ops.bounds = this.function.getBounds();
            ops.background = this.function.getBackground();
            ops.font = this.function.getFont();
            ops.foreground = this.function.getForeground();
            for (Row row : rows) if (row != null) {
                IDEF0Plugin.setDefaultRectangleVisualOptions(movingArea.getDataPlugin().getEngine(), row.getElement(), ops);
            }
        }
    }
}
Also used : SectorRefactor(com.ramussoft.pb.idef.elements.SectorRefactor) NFunction(com.ramussoft.pb.data.negine.NFunction) ArrayList(java.util.ArrayList) Point(com.ramussoft.pb.idef.elements.Point) FloatPoint(com.dsoft.pb.types.FloatPoint) Function(com.ramussoft.pb.Function) NFunction(com.ramussoft.pb.data.negine.NFunction) FRectangle(com.dsoft.pb.types.FRectangle) PaintSector(com.ramussoft.pb.idef.elements.PaintSector) MemoryData(com.dsoft.utils.DataLoader.MemoryData) RectangleVisualOptions(com.ramussoft.idef0.attribute.RectangleVisualOptions) Stream(com.ramussoft.pb.Stream) Row(com.ramussoft.pb.Row)

Example 4 with MemoryData

use of com.dsoft.utils.DataLoader.MemoryData in project ramus by Vitaliy-Yakovchuk.

the class IDEF0Object method onProcessEndBoundsChange.

public void onProcessEndBoundsChange(List<PaintSector> notToMove) {
    final FRectangle oldRec = function.getBounds();
    super.onProcessEndBoundsChange();
    function.setBounds(new FRectangle(myBounds));
    final SectorRefactor refactor = movingArea.getRefactor();
    MemoryData memoryData = new MemoryData();
    List<PaintSector> list = new ArrayList<PaintSector>();
    for (int i = 0; i < refactor.getSectorsCount(); i++) {
        PaintSector sector = refactor.getSector(i);
        boolean con = false;
        if (notToMove != null)
            for (PaintSector ps : notToMove) {
                if (ps.getSector().equals(sector.getSector())) {
                    con = true;
                    break;
                }
            }
        if (con)
            continue;
        setAddedSectorPos(oldRec, sector, list);
    }
    for (PaintSector ps : list) PaintSector.save(ps, memoryData, ((NFunction) function).getEngine());
}
Also used : SectorRefactor(com.ramussoft.pb.idef.elements.SectorRefactor) FRectangle(com.dsoft.pb.types.FRectangle) PaintSector(com.ramussoft.pb.idef.elements.PaintSector) NFunction(com.ramussoft.pb.data.negine.NFunction) MemoryData(com.dsoft.utils.DataLoader.MemoryData) ArrayList(java.util.ArrayList) Point(com.ramussoft.pb.idef.elements.Point) FloatPoint(com.dsoft.pb.types.FloatPoint)

Example 5 with MemoryData

use of com.dsoft.utils.DataLoader.MemoryData in project ramus by Vitaliy-Yakovchuk.

the class MovingArea method setTransparent.

/**
 * Змінює прозорість напису для активного сектора.
 */
public void setTransparent() {
    final PaintSector sector = ((PaintSector.Pin) activeObject).getSector();
    sector.setTransparent(!sector.isTransparent());
    startUserTransaction();
    PaintSector.save(sector, new MemoryData(), dataPlugin.getEngine());
    refactor.setUndoPoint();
}
Also used : Pin(com.ramussoft.pb.idef.elements.PaintSector.Pin) PaintSector(com.ramussoft.pb.idef.elements.PaintSector) MemoryData(com.dsoft.utils.DataLoader.MemoryData)

Aggregations

MemoryData (com.dsoft.utils.DataLoader.MemoryData)11 PaintSector (com.ramussoft.pb.idef.elements.PaintSector)8 ArrayList (java.util.ArrayList)7 FloatPoint (com.dsoft.pb.types.FloatPoint)6 SectorRefactor (com.ramussoft.pb.idef.elements.SectorRefactor)5 NFunction (com.ramussoft.pb.data.negine.NFunction)4 Point (com.ramussoft.pb.idef.elements.Point)4 FRectangle (com.dsoft.pb.types.FRectangle)3 Crosspoint (com.ramussoft.pb.Crosspoint)3 Function (com.ramussoft.pb.Function)3 Pin (com.ramussoft.pb.idef.elements.PaintSector.Pin)3 IOException (java.io.IOException)3 DataLoader (com.dsoft.utils.DataLoader)2 Row (com.ramussoft.pb.Row)2 Stream (com.ramussoft.pb.Stream)2 ByteArrayInputStream (java.io.ByteArrayInputStream)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 List (java.util.List)2 Engine (com.ramussoft.common.Engine)1 RectangleVisualOptions (com.ramussoft.idef0.attribute.RectangleVisualOptions)1