Search in sources :

Example 1 with Stream

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

the class PaintSector method setCorrectRows.

public void setCorrectRows() {
    final Stream s = sector.getStream();
    if (s != null) {
        final Row[] rows = s.getAdded();
        if (rows != null) {
            setRows(rows);
        }
    } else {
        Sector[] sectors = getStart().getOppozite(sector);
        boolean start = true;
        if (sectors.length == 0) {
            sectors = getEnd().getOppozite(sector);
            start = false;
        }
        if (sectors.length > 0 && sectors[0].getStream() != null) {
            sector.setStream(SectorRefactor.cloneStream(sectors[0].getStream(), movingArea.dataPlugin, sector), ReplaceStreamType.CHILDREN);
            sector.loadRowAttributes(sectors[0], start);
        }
    }
}
Also used : Sector(com.ramussoft.pb.Sector) NSector(com.ramussoft.pb.data.negine.NSector) AbstractSector(com.ramussoft.pb.data.AbstractSector) ByteArrayOutputStream(java.io.ByteArrayOutputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) Stream(com.ramussoft.pb.Stream) InputStream(java.io.InputStream) Row(com.ramussoft.pb.Row)

Example 2 with Stream

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

the class PaintSector method setChangeOptions.

/**
 * Метод, який викликається після зміни початку чи кінця сектора.
 *
 * @param point Точка, яка була змінена.
 */
private void setChangeOptions(final Point point) {
    setSectorPoints();
    createTexts();
    PaintSector[] sectors;
    Stream stream = null;
    if (getStart() != null) {
        sectors = movingArea.getRefactor().getOppozite(this, getStart());
        for (final PaintSector element : sectors) if (stream == null && element.getStream() != null) {
            stream = element.getStream();
            break;
        }
    }
    if (stream == null && getEnd() != null) {
        sectors = movingArea.getRefactor().getOppozite(this, getStart());
        for (final PaintSector element : sectors) if (stream == null && element.getStream() != null) {
            stream = element.getStream();
            break;
        }
    }
    if (stream != null && getSector().getStream() == null)
        setStream(stream, ReplaceStreamType.CHILDREN);
}
Also used : ByteArrayOutputStream(java.io.ByteArrayOutputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) Stream(com.ramussoft.pb.Stream) InputStream(java.io.InputStream)

Example 3 with Stream

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

the class SectorRefactor method fixNoNameBug.

private void fixNoNameBug(Crosspoint crosspoint, Sector sector) {
    if (crosspoint != null) {
        if (crosspoint.isDLevel()) {
            Sector[] oppozite = crosspoint.getOppozite(sector);
            if (oppozite.length == 1) {
                Sector opp = oppozite[0];
                Stream s = opp.getStream();
                ((NSector) sector).setThisStream(s);
            }
        }
    }
}
Also used : NSector(com.ramussoft.pb.data.negine.NSector) Sector(com.ramussoft.pb.Sector) NSector(com.ramussoft.pb.data.negine.NSector) ByteArrayOutputStream(java.io.ByteArrayOutputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) Stream(com.ramussoft.pb.Stream)

Example 4 with Stream

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

the class SectorRefactor method fillStartFromOwners.

private static void fillStartFromOwners(Sector sector, HashSet<Row> owners, DataPlugin dataPlugin, boolean[] hasFunctionOwners) {
    Crosspoint crosspoint = sector.getStart().getCrosspoint();
    Function function2 = sector.getStart().getFunction();
    if (function2 != null) {
        if (function2.getType() != Function.TYPE_DFDS_ROLE) {
            Row row = function2.getOwner();
            if (row != null && !owners.contains(row)) {
                owners.add(row);
                hasFunctionOwners[0] = true;
            }
        } else {
            Stream stream = (Stream) dataPlugin.findRowByGlobalId(function2.getLink());
            if (stream != null)
                for (Row row : stream.getAdded()) {
                    if (row != null && !owners.contains(row))
                        owners.add(row);
                }
        }
    }
    if (crosspoint != null)
        for (Sector sector2 : crosspoint.getOppozite(sector)) fillStartFromOwners(sector2, owners, dataPlugin, hasFunctionOwners);
}
Also used : Function(com.ramussoft.pb.Function) NFunction(com.ramussoft.pb.data.negine.NFunction) Sector(com.ramussoft.pb.Sector) NSector(com.ramussoft.pb.data.negine.NSector) ByteArrayOutputStream(java.io.ByteArrayOutputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) Stream(com.ramussoft.pb.Stream) Row(com.ramussoft.pb.Row) Crosspoint(com.ramussoft.pb.Crosspoint)

Example 5 with Stream

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

the class SectorRefactor method fillEndFromOwners.

private static void fillEndFromOwners(Sector sector, HashSet<Row> owners, DataPlugin dataPlugin, boolean[] hasFunctionOwners) {
    Crosspoint crosspoint = sector.getEnd().getCrosspoint();
    Function function2 = sector.getEnd().getFunction();
    if (function2 != null) {
        if (function2.getType() != Function.TYPE_DFDS_ROLE) {
            Row row = function2.getOwner();
            if (row != null && !owners.contains(row)) {
                owners.add(row);
                hasFunctionOwners[0] = true;
            }
        } else {
            Stream stream = (Stream) dataPlugin.findRowByGlobalId(function2.getLink());
            if (stream != null)
                for (Row row : stream.getAdded()) {
                    if (row != null && !owners.contains(row))
                        owners.add(row);
                }
        }
    }
    if (crosspoint != null)
        for (Sector sector2 : crosspoint.getOppozite(sector)) fillEndFromOwners(sector2, owners, dataPlugin, hasFunctionOwners);
}
Also used : Function(com.ramussoft.pb.Function) NFunction(com.ramussoft.pb.data.negine.NFunction) Sector(com.ramussoft.pb.Sector) NSector(com.ramussoft.pb.data.negine.NSector) ByteArrayOutputStream(java.io.ByteArrayOutputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) Stream(com.ramussoft.pb.Stream) Row(com.ramussoft.pb.Row) Crosspoint(com.ramussoft.pb.Crosspoint)

Aggregations

Stream (com.ramussoft.pb.Stream)51 Row (com.ramussoft.pb.Row)30 Function (com.ramussoft.pb.Function)21 Sector (com.ramussoft.pb.Sector)18 ByteArrayOutputStream (java.io.ByteArrayOutputStream)15 NSector (com.ramussoft.pb.data.negine.NSector)14 Vector (java.util.Vector)13 InputStream (java.io.InputStream)11 PaintSector (com.ramussoft.pb.idef.elements.PaintSector)10 ByteArrayInputStream (java.io.ByteArrayInputStream)10 Crosspoint (com.ramussoft.pb.Crosspoint)9 NFunction (com.ramussoft.pb.data.negine.NFunction)9 OutputStream (java.io.OutputStream)7 NStream (com.ramussoft.pb.data.negine.NStream)6 ArrayList (java.util.ArrayList)6 FloatPoint (com.dsoft.pb.types.FloatPoint)4 SectorRefactor (com.ramussoft.pb.idef.elements.SectorRefactor)4 MovingFunction (com.ramussoft.pb.idef.visual.MovingFunction)4 IOException (java.io.IOException)4 FRectangle (com.dsoft.pb.types.FRectangle)3