Search in sources :

Example 21 with Crosspoint

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

the class SectorRefactor method fixEndOwners.

private static void fixEndOwners(Sector sector, DataPlugin dataPlugin) {
    Function function2 = sector.getStart().getFunction();
    if (function2 != null && function2.getType() == Function.TYPE_DFDS_ROLE)
        fillFromOwners(function2, dataPlugin);
    Crosspoint crosspoint = sector.getEnd().getCrosspoint();
    if (crosspoint != null) {
        for (Sector sector2 : crosspoint.getOppozite(sector)) fixEndOwners(sector2, dataPlugin);
    }
}
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) Crosspoint(com.ramussoft.pb.Crosspoint)

Example 22 with Crosspoint

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

the class SectorRefactor method getOppozite.

/**
 * Медод повертає набір секторів, протилежних до точки перетену.
 *
 * @param sector Сектор відображення, для якого необхідно знайти протилежні.
 * @param point  Точка - перхрестя.
 * @return Масив секторів, які є пролежними до переданого.
 */
public PaintSector[] getOppozite(final PaintSector sector, final Crosspoint point) {
    final Sector[] sectors = point.getOppozite(sector.getSector());
    final Vector<PaintSector> r = new Vector<PaintSector>();
    for (int i = 0; i < getSectorsCount(); i++) {
        final PaintSector s = getSector(i);
        final Sector sec = s.getSector();
        for (final Sector element : sectors) if (sec.equals(element))
            r.add(s);
    }
    final PaintSector[] rs = new PaintSector[r.size()];
    for (int i = 0; i < rs.length; i++) rs[i] = r.get(i);
    return rs;
}
Also used : Sector(com.ramussoft.pb.Sector) NSector(com.ramussoft.pb.data.negine.NSector) Vector(java.util.Vector) Crosspoint(com.ramussoft.pb.Crosspoint) FloatPoint(com.dsoft.pb.types.FloatPoint)

Example 23 with Crosspoint

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

the class DFDSFunction method getTriangle.

@Override
protected int getTriangle(FloatPoint point) {
    int changingState = getMovingArea().getPointChangingType();
    PaintSector activeSector = getMovingArea().getRefactor().getSector();
    if (activeSector != null)
        if (changingState == SectorRefactor.TYPE_START) {
            Crosspoint crosspoint = activeSector.getStart();
            Function function2 = activeSector.getSector().getStart().getFunction();
            if (crosspoint != null && crosspoint.isDLevel() && function2 != null && function2.getType() == Function.TYPE_DFDS_ROLE)
                return -1;
        } else if (changingState == SectorRefactor.TYPE_END) {
            Crosspoint crosspoint = activeSector.getEnd();
            Function function2 = activeSector.getSector().getEnd().getFunction();
            if (crosspoint != null && crosspoint.isDLevel() && function2 != null && function2.getType() == Function.TYPE_DFDS_ROLE)
                return -1;
        }
    return super.getTriangle(point);
}
Also used : DFDFunction(com.ramussoft.pb.dfd.visual.DFDFunction) NFunction(com.ramussoft.pb.data.negine.NFunction) Function(com.ramussoft.pb.Function) PaintSector(com.ramussoft.pb.idef.elements.PaintSector) Crosspoint(com.ramussoft.pb.Crosspoint) FloatPoint(com.dsoft.pb.types.FloatPoint) Crosspoint(com.ramussoft.pb.Crosspoint)

Example 24 with Crosspoint

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

the class IDLImporter method setSegment.

private void setSegment(Arrowseg seg, MovingArea area) {
    if (seg.seted)
        return;
    List<Arrowseg> source = loadConnected(seg.source);
    List<Arrowseg> sink = loadConnected(seg.sink);
    if (source != null) {
        for (Arrowseg s : source) {
            if (!s.seted)
                setSegment(s, area);
        }
        Crosspoint c = null;
        for (Arrowseg s : source) {
            if (s.sector.getEnd() != null) {
                c = (NCrosspoint) s.sector.getEnd();
            }
        }
        if (c == null)
            c = dataPlugin.createCrosspoint();
        seg.sector.getSector().getStart().setCrosspointA(c);
        seg.sector.getSector().getStart().commit();
        for (Arrowseg s : source) {
            if (s.sector.getEnd() == null) {
                s.sector.getSector().getEnd().setCrosspointA(c);
                s.sector.getSector().getEnd().commit();
            }
        }
    }
    PaintSector ps = seg.sector;
    Point[] points = new Point[seg.pointsList.size()];
    int type = seg.getFirstPinType();
    Ordinate x = null;
    Ordinate y = null;
    if (source != null) {
        for (Arrowseg arrowseg : source) {
            int sType = arrowseg.getLastPinType();
            if (type == sType) {
                if (arrowseg.sector.getLastPin().getType() == Ordinate.TYPE_X) {
                    y = arrowseg.sector.getLastPin().getOrdinate();
                    x = arrowseg.sector.getLastPin().getPOrdinate();
                } else {
                    x = arrowseg.sector.getLastPin().getOrdinate();
                    y = arrowseg.sector.getLastPin().getPOrdinate();
                }
            } else {
                if (arrowseg.sector.getLastPin().getType() == Ordinate.TYPE_Y) {
                    x = arrowseg.sector.getLastPin().getOrdinate();
                    y = arrowseg.sector.getLastPin().getPOrdinate();
                } else {
                    y = arrowseg.sector.getLastPin().getOrdinate();
                    x = arrowseg.sector.getLastPin().getPOrdinate();
                }
            }
        }
    }
    if (x == null) {
        x = new Ordinate(Ordinate.TYPE_X);
        x.setPosition(seg.pointsList.get(0).getX());
    }
    if (y == null) {
        y = new Ordinate(Ordinate.TYPE_Y);
        y.setPosition(seg.pointsList.get(0).getY());
    }
    points[0] = new Point(x, y);
    for (int i = 1; i < seg.pointsList.size(); i++) {
        FloatPoint point = seg.pointsList.get(i);
        type = seg.getPinType(i - 1);
        if (type == Ordinate.TYPE_X) {
            x = new Ordinate(Ordinate.TYPE_X);
            x.setPosition(point.getX());
        } else {
            y = new Ordinate(Ordinate.TYPE_Y);
            y.setPosition(point.getY());
        }
        if ((i == seg.pointsList.size() - 1) && (sink != null) && (sink.size() == 1)) {
            Arrowseg s = sink.get(0);
            List<Arrowseg> list = loadConnected(s.source);
            for (Arrowseg arrowseg : list) {
                if (arrowseg.seted) {
                    Point point2 = arrowseg.sector.getLastPin().getEnd();
                    Ordinate xo = point2.getXOrdinate();
                    for (Point point3 : xo.getPoints()) {
                        point3.setXOrdinate(x);
                    }
                    Ordinate yo = point2.getYOrdinate();
                    for (Point point3 : yo.getPoints()) {
                        point3.setYOrdinate(y);
                    }
                }
            }
        }
        points[i] = new Point(x, y);
    }
    ps.setPoints(points);
    if (source == null)
        initCrosspoint(seg.sector.getSector().getStart(), seg.source, area, seg.sector, true, seg);
    if (sink == null) {
        initCrosspoint(seg.sector.getSector().getEnd(), seg.sink, area, seg.sector, false, seg);
    }
    seg.seted = true;
}
Also used : FloatPoint(com.dsoft.pb.types.FloatPoint) PaintSector(com.ramussoft.pb.idef.elements.PaintSector) Point(com.ramussoft.pb.idef.elements.Point) FloatPoint(com.dsoft.pb.types.FloatPoint) Crosspoint(com.ramussoft.pb.Crosspoint) Crosspoint(com.ramussoft.pb.Crosspoint) Point(com.ramussoft.pb.idef.elements.Point) FloatPoint(com.dsoft.pb.types.FloatPoint) Ordinate(com.ramussoft.pb.idef.elements.Ordinate)

Example 25 with Crosspoint

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

the class NDataPlugin method createCrosspoint.

public Crosspoint createCrosspoint() {
    long id = IDEF0Plugin.getNextCrosspointId(engine);
    final Crosspoint c = createCrosspoint(id);
    return c;
}
Also used : Crosspoint(com.ramussoft.pb.Crosspoint)

Aggregations

Crosspoint (com.ramussoft.pb.Crosspoint)29 NSector (com.ramussoft.pb.data.negine.NSector)18 Sector (com.ramussoft.pb.Sector)16 FloatPoint (com.dsoft.pb.types.FloatPoint)15 Function (com.ramussoft.pb.Function)12 NFunction (com.ramussoft.pb.data.negine.NFunction)11 NCrosspoint (com.ramussoft.pb.data.negine.NCrosspoint)9 Row (com.ramussoft.pb.Row)6 Vector (java.util.Vector)6 AbstractSector (com.ramussoft.pb.data.AbstractSector)5 PaintSector (com.ramussoft.pb.idef.elements.PaintSector)5 Stream (com.ramussoft.pb.Stream)4 Point (com.ramussoft.pb.idef.elements.Point)4 DFDFunction (com.ramussoft.pb.dfd.visual.DFDFunction)3 ByteArrayInputStream (java.io.ByteArrayInputStream)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3 ArrayList (java.util.ArrayList)3 DFDSFunction (com.ramussoft.pb.dfds.visual.DFDSFunction)2 Ordinate (com.ramussoft.pb.idef.elements.Ordinate)2 SectorRefactor (com.ramussoft.pb.idef.elements.SectorRefactor)2