Search in sources :

Example 11 with MovingArea

use of com.ramussoft.pb.idef.visual.MovingArea in project ramus by Vitaliy-Yakovchuk.

the class IDLImporter method createSegments.

private void createSegments() {
    MovingArea area = new MovingArea(plugin, getFunction());
    area.setActiveFunction(getFunction());
    for (Arrowseg seg : segments) createSegment(seg, area);
    for (Arrowseg seg : segments) setSegment(seg, area);
    area.getRefactor().saveToFunction();
}
Also used : MovingArea(com.ramussoft.pb.idef.visual.MovingArea)

Example 12 with MovingArea

use of com.ramussoft.pb.idef.visual.MovingArea in project ramus by Vitaliy-Yakovchuk.

the class ClassicTemplate method createChilds.

@Override
public synchronized void createChilds(final Function function, final DataPlugin dataPlugin) {
    final MovingArea movingArea = new MovingArea(dataPlugin);
    movingArea.setDataPlugin(dataPlugin);
    movingArea.setActiveFunction(function);
    movingArea.setArrowAddingState();
    super.createChilds(function, dataPlugin, movingArea);
    int num = count / 2;
    if (2 * num == count)
        num--;
    createSimpleArrow(function, movingArea, num);
    PaintSector s;
    final Function f = (Function) function.getChildAt(num);
    createFrom(movingArea, f, top);
    createInPoint(movingArea, TOP, (Function) function.getChildAt(count - 1));
    s = movingArea.getRefactor().getSector();
    for (int i = count - 2; i > num; i--) {
        final Function fS = (Function) function.getChildAt(i);
        createFrom(movingArea, fS, s, getX(fS), POS);
        createInPoint(movingArea, TOP, fS);
    }
    createFrom(movingArea, f, bottom);
    createInPoint(movingArea, BOTTOM, (Function) function.getChildAt(count - 1));
    s = movingArea.getRefactor().getSector();
    for (int i = count - 2; i > num; i--) {
        final Function fS = (Function) function.getChildAt(i);
        createFrom(movingArea, fS, s, getX(fS), movingArea.CLIENT_HEIGHT - POS);
        createInPoint(movingArea, BOTTOM, fS);
    }
    if (num > 0) {
        createFrom(movingArea, f, top, getX(f), POS - 1);
        createInPoint(movingArea, TOP, (Function) function.getChildAt(0));
        s = movingArea.getRefactor().getSector();
        for (int i = 1; i < num; i++) {
            final Function fS = (Function) function.getChildAt(i);
            createFrom(movingArea, fS, s, getX(fS), POS);
            createInPoint(movingArea, TOP, fS);
        }
        createFrom(movingArea, f, bottom);
        createInPoint(movingArea, BOTTOM, (Function) function.getChildAt(0));
        s = movingArea.getRefactor().getSector();
        for (int i = 1; i < num; i++) {
            final Function fS = (Function) function.getChildAt(i);
            createFrom(movingArea, fS, s, getX(fS), movingArea.CLIENT_HEIGHT - POS);
            createInPoint(movingArea, BOTTOM, fS);
        }
    }
    movingArea.getRefactor().saveToFunction();
}
Also used : MovingArea(com.ramussoft.pb.idef.visual.MovingArea) Function(com.ramussoft.pb.Function) PaintSector(com.ramussoft.pb.idef.elements.PaintSector)

Example 13 with MovingArea

use of com.ramussoft.pb.idef.visual.MovingArea in project ramus by Vitaliy-Yakovchuk.

the class IDLExporter method loadFonts.

private void loadFonts() throws IOException {
    addFont(new Font("Arial", 0, 13));
    addFont(new Font("Arial", 0, 24));
    addFont(new Font("Courier New", 0, 11));
    rec(new FunctionCallback() {

        @Override
        public void call(Function f) {
            addFont(f.getFont());
            SectorRefactor sr = new SectorRefactor(new MovingArea(dataPlugin));
            sr.loadFromFunction(f, false);
            for (int i = 0; i < sr.getSectorsCount(); i++) {
                PaintSector ps = sr.getSector(i);
                addFont(ps.getFont());
            }
        }
    }, false);
}
Also used : MovingArea(com.ramussoft.pb.idef.visual.MovingArea) Function(com.ramussoft.pb.Function) MovingFunction(com.ramussoft.pb.idef.visual.MovingFunction) SectorRefactor(com.ramussoft.pb.idef.elements.SectorRefactor) PaintSector(com.ramussoft.pb.idef.elements.PaintSector) Font(java.awt.Font)

Example 14 with MovingArea

use of com.ramussoft.pb.idef.visual.MovingArea in project ramus by Vitaliy-Yakovchuk.

the class HTMLHelper method getDiagram.

/*
     *
	 * private static final int IMAGE_WIDTH = 850; private static final int
	 * IMAGE_HEIGHT = 738;
	 */
public String getDiagram(final String sId, final String functionController, final String clasificatorController) {
    if (sId == null)
        return null;
    final Row r = dataPlugin.findRowByGlobalId(GlobalId.convert(sId));
    if (r instanceof Function) {
        final Function function = (Function) r;
        final int imageWidth = IMAGE_WIDTH;
        final int imageHeight = IMAGE_HEIGHT;
        final DiagramHolder htmlStream = new DiagramHolder();
        htmlStream.println("<img border=0 width=" + imageWidth + " height=" + imageHeight + " src=\"" + functionController + "idef0/" + function.getGlobalId().toString() + "\" useMap=#M" + function.getGlobalId().toString() + ">");
        htmlStream.println("<map name=M" + function.getGlobalId().toString() + ">");
        final Vector childs = dataPlugin.getChilds(function, true);
        final MovingArea area = PIDEF0painter.createMovingArea(new Dimension(imageWidth, imageHeight), dataPlugin);
        final SectorRefactor refactor = area.getRefactor();
        for (int i = 0; i < childs.size(); i++) {
            final Function fun = (Function) childs.get(i);
            String where;
            if (fun.isLeaf())
                where = clasificatorController;
            else
                where = functionController + "index/";
            htmlStream.print("<area shape=RECT coords=" + getAreaCoords(fun.getBounds(), area) + " href=\"" + where + fun.getGlobalId().toString() + "\"");
            htmlStream.println(">");
        }
        refactor.loadFromFunction(function, false);
        final int sc = refactor.getSectorsCount();
        for (int i = 0; i < sc; i++) {
            final PaintSector sector = refactor.getSector(i);
            final Stream stream = sector.getStream();
            final MovingLabel text = refactor.getSector(i).getText();
            if (text != null && stream != null) {
                htmlStream.print("<area shape=RECT coords=" + getAreaCoords(text.getBounds(), area) + " href=\"" + clasificatorController + stream.getGlobalId().toString() + "\"");
                htmlStream.println(">");
            }
            final int l = sector.getPinCount();
            for (int j = 0; j < l; j++) if (stream != null) {
                final Pin pin = sector.getPin(j);
                htmlStream.print("<area shape=RECT coords=" + getPinCoords(pin, area) + " href=\"" + clasificatorController + stream.getGlobalId().toString() + "\"");
                htmlStream.println(">");
            }
        }
        htmlStream.println("<map>");
        return htmlStream.toString();
    }
    return null;
}
Also used : MovingArea(com.ramussoft.pb.idef.visual.MovingArea) SectorRefactor(com.ramussoft.pb.idef.elements.SectorRefactor) Dimension(java.awt.Dimension) Function(com.ramussoft.pb.Function) MovingLabel(com.ramussoft.pb.idef.visual.MovingLabel) Pin(com.ramussoft.pb.idef.elements.PaintSector.Pin) PaintSector(com.ramussoft.pb.idef.elements.PaintSector) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Stream(com.ramussoft.pb.Stream) Row(com.ramussoft.pb.Row) Vector(java.util.Vector)

Example 15 with MovingArea

use of com.ramussoft.pb.idef.visual.MovingArea in project ramus by Vitaliy-Yakovchuk.

the class PIDEF0painter method createMovingArea.

public static MovingArea createMovingArea(final Dimension d, final DataPlugin dataPlugin) {
    final MovingArea movingArea = new MovingArea(dataPlugin);
    final double zh = (double) d.height / (double) movingArea.MOVING_AREA_HEIGHT;
    final double zw = (double) d.width / (double) movingArea.MOVING_AREA_WIDTH;
    final double zoom = zw < zh ? zw : zh;
    movingArea.setZoom(zoom);
    movingArea.setSize(movingArea.getIntOrdinate(movingArea.MOVING_AREA_WIDTH), movingArea.getIntOrdinate(movingArea.CLIENT_HEIGHT));
    return movingArea;
}
Also used : MovingArea(com.ramussoft.pb.idef.visual.MovingArea)

Aggregations

MovingArea (com.ramussoft.pb.idef.visual.MovingArea)16 PaintSector (com.ramussoft.pb.idef.elements.PaintSector)9 SectorRefactor (com.ramussoft.pb.idef.elements.SectorRefactor)9 Function (com.ramussoft.pb.Function)8 Row (com.ramussoft.pb.Row)6 Stream (com.ramussoft.pb.Stream)3 MovingLabel (com.ramussoft.pb.idef.visual.MovingLabel)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3 Crosspoint (com.ramussoft.pb.Crosspoint)2 NSector (com.ramussoft.pb.data.negine.NSector)2 Pin (com.ramussoft.pb.idef.elements.PaintSector.Pin)2 MovingFunction (com.ramussoft.pb.idef.visual.MovingFunction)2 Dimension (java.awt.Dimension)2 IOException (java.io.IOException)2 InputStream (java.io.InputStream)2 OutputStream (java.io.OutputStream)2 Vector (java.util.Vector)2 FRectangle (com.dsoft.pb.types.FRectangle)1 FloatPoint (com.dsoft.pb.types.FloatPoint)1 DataLoader (com.dsoft.utils.DataLoader)1