Search in sources :

Example 1 with Row

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

the class ArrowPainter method paintBottom.

public void paintBottom(final Graphics2D g, final int height, MovingArea area, Font bottomFont, int partNumber, int hPageCount) {
    if (!area.isPrinting()) {
        if (!MovingArea.DISABLE_RENDERING_HINTS) {
            g.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
            g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
            g.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
            g.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
            g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
            g.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
            g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
        }
    }
    g.setFont(bottomFont);
    final Font font = bottomFont;
    final Function activeFunction = movingArea.getActiveFunction();
    int width = movingArea.getIntOrdinate(movingArea.MOVING_AREA_WIDTH);
    width /= hPageCount;
    int left = 0;
    if (partNumber > 0) {
        left = width * partNumber;
        width += 1;
    }
    final int x = left + width / 5;
    g.drawLine(left, 0, left, height - 1);
    g.drawLine(width - 1, 0, width - 1, height - 1);
    g.drawRect(left, 0, width - 1, height - 1);
    g.drawLine(x, 0, x, height - 1);
    g.drawLine(left + width / 5 * 4, 0, left + width / 5 * 4, height - 1);
    g.setFont(movingArea.getFont(g.getFont()));
    String number = NUMBER + " " + movingArea.getFunctionNumber();
    if (hPageCount > 1)
        number += "." + (partNumber + 1);
    String node = NODE_B;
    final double nodeWidth = g.getFont().getStringBounds(node, g.getFontRenderContext()).getWidth();
    final int nT = 5 + 4 + (int) g.getFont().getStringBounds(node, g.getFontRenderContext()).getHeight();
    g.drawString(node, left + 5, nT);
    g.drawString(number, left + width / 5 * 4 + 5, nT);
    node = TITLE_B;
    final int titleWidth = (int) g.getFont().getStringBounds(node, g.getFontRenderContext()).getWidth();
    g.drawString(node, x + 5, nT);
    if (activeFunction.getDecompositionType() == MovingArea.DIAGRAM_TYPE_DFDS) {
        node = MovingFunction.getDFDSKod((com.ramussoft.database.common.Row) activeFunction, movingArea.dataPlugin);
    } else
        node = MovingFunction.getIDEF0Kod((com.ramussoft.database.common.Row) activeFunction);
    g.drawString(node, left + (int) nodeWidth + 10, nT);
    node = activeFunction.getName();
    if (activeFunction.equals(movingArea.dataPlugin.getBaseFunction()) && activeFunction.getDecompositionType() != MovingArea.DIAGRAM_TYPE_DFDS) {
        final Vector v = movingArea.dataPlugin.getChilds(activeFunction, true);
        if (v.size() > 0)
            node = ((Row) v.get(0)).getName();
    }
    g.setFont(font);
    movingArea.paintText(g, node, movingArea.getFBounds(new Rectangle(x + 10 + titleWidth, 2, x * 3 - 10 - titleWidth - 3 * left, height)), Line.CENTER_ALIGN, 1, true);
}
Also used : Function(com.ramussoft.pb.Function) NFunction(com.ramussoft.pb.data.negine.NFunction) MovingFunction(com.ramussoft.pb.idef.visual.MovingFunction) Rectangle(java.awt.Rectangle) FRectangle(com.dsoft.pb.types.FRectangle) Row(com.ramussoft.pb.Row) Vector(java.util.Vector) Font(java.awt.Font) FloatPoint(com.dsoft.pb.types.FloatPoint)

Example 2 with Row

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

the class PaintSector method removeAther.

/**
 * Перевіряє і видаляє під’єднані до сектора сектори.
 */
private void removeAther(final Crosspoint point) {
    // System.out.println("Remove other "+point);
    if (point != null) {
        Row[] del;
        if (getStream() == null)
            del = new Row[] {};
        else
            del = getStream().getAdded();
        if (!point.isDLevel()) {
            final boolean start = !point.isIn(sector);
            ((AbstractSector) sector).removeFromParent(del, start);
        }
        if (point.isRemoveable()) {
            PaintSector s = null;
            for (int i = 0; i < movingArea.getRefactor().getSectorsCount(); i++) {
                s = movingArea.getRefactor().getSector(i);
                if (point.isIn(s.getSector()))
                    break;
            }
            if (s == null)
                return;
            try {
                s.joinSector(movingArea.getRefactor().getOppozite(s, point)[0]);
            } catch (Exception exception) {
                exception.printStackTrace();
            }
            s.createTexts();
        }
    }
}
Also used : AbstractSector(com.ramussoft.pb.data.AbstractSector) Row(com.ramussoft.pb.Row) NCrosspoint(com.ramussoft.pb.data.negine.NCrosspoint) Crosspoint(com.ramussoft.pb.Crosspoint) FloatPoint(com.dsoft.pb.types.FloatPoint) IOException(java.io.IOException)

Example 3 with Row

use of com.ramussoft.pb.Row 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 4 with Row

use of com.ramussoft.pb.Row 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 Row

use of com.ramussoft.pb.Row 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

Row (com.ramussoft.pb.Row)93 Function (com.ramussoft.pb.Function)35 Stream (com.ramussoft.pb.Stream)30 Vector (java.util.Vector)28 NFunction (com.ramussoft.pb.data.negine.NFunction)19 Sector (com.ramussoft.pb.Sector)15 NRow (com.ramussoft.pb.data.negine.NRow)14 Qualifier (com.ramussoft.common.Qualifier)13 Crosspoint (com.ramussoft.pb.Crosspoint)13 NSector (com.ramussoft.pb.data.negine.NSector)13 PaintSector (com.ramussoft.pb.idef.elements.PaintSector)12 ByteArrayOutputStream (java.io.ByteArrayOutputStream)11 ArrayList (java.util.ArrayList)11 SectorRefactor (com.ramussoft.pb.idef.elements.SectorRefactor)10 Attribute (com.ramussoft.common.Attribute)9 MovingFunction (com.ramussoft.pb.idef.visual.MovingFunction)9 IOException (java.io.IOException)9 FloatPoint (com.dsoft.pb.types.FloatPoint)8 Point (com.ramussoft.pb.idef.elements.Point)8 Element (com.ramussoft.common.Element)7