Search in sources :

Example 21 with SectorRefactor

use of com.ramussoft.pb.idef.elements.SectorRefactor in project ramus by Vitaliy-Yakovchuk.

the class IDEF0Object method centerAddedSetors.

/**
 * Метод вирівнює розташування всіх під’єднаних до функціонального блока
 * секторів.
 */
@SuppressWarnings("unchecked")
public void centerAddedSetors() {
    final Vector<Point>[] vectors = new Vector[4];
    vectors[LEFT] = new Vector<Point>();
    vectors[RIGHT] = new Vector<Point>();
    vectors[TOP] = new Vector<Point>();
    vectors[BOTTOM] = new Vector<Point>();
    final SectorRefactor refactor = movingArea.getRefactor();
    for (int i = 0; i < refactor.getSectorsCount(); i++) {
        final PaintSector sector = refactor.getSector(i);
        if (function.equals(sector.getSector().getStart().getFunction()))
            vectors[sector.getSector().getStart().getFunctionType()].add(sector.getStartPoint());
        if (function.equals(sector.getSector().getEnd().getFunction()))
            vectors[sector.getSector().getEnd().getFunctionType()].add(sector.getEndPoint());
    }
    for (int i = 0; i < 4; i++) centerPoints(vectors[i], i == LEFT || i == RIGHT ? Ordinate.TYPE_Y : Ordinate.TYPE_X, i);
    for (int i = 0; i < refactor.getSectorsCount(); i++) {
        final PaintSector sector = refactor.getSector(i);
        if (function.equals(sector.getSector().getStart().getFunction()))
            sector.tryRemovePin(getMovingArea());
        else if (function.equals(sector.getSector().getEnd().getFunction()))
            sector.tryRemovePin(getMovingArea());
    }
}
Also used : SectorRefactor(com.ramussoft.pb.idef.elements.SectorRefactor) PaintSector(com.ramussoft.pb.idef.elements.PaintSector) Point(com.ramussoft.pb.idef.elements.Point) FloatPoint(com.dsoft.pb.types.FloatPoint) Vector(java.util.Vector) Point(com.ramussoft.pb.idef.elements.Point) FloatPoint(com.dsoft.pb.types.FloatPoint)

Aggregations

SectorRefactor (com.ramussoft.pb.idef.elements.SectorRefactor)21 PaintSector (com.ramussoft.pb.idef.elements.PaintSector)14 Function (com.ramussoft.pb.Function)10 Row (com.ramussoft.pb.Row)9 MovingArea (com.ramussoft.pb.idef.visual.MovingArea)9 FloatPoint (com.dsoft.pb.types.FloatPoint)8 Point (com.ramussoft.pb.idef.elements.Point)7 Crosspoint (com.ramussoft.pb.Crosspoint)6 NFunction (com.ramussoft.pb.data.negine.NFunction)6 FRectangle (com.dsoft.pb.types.FRectangle)5 ArrayList (java.util.ArrayList)5 MemoryData (com.dsoft.utils.DataLoader.MemoryData)4 Stream (com.ramussoft.pb.Stream)4 MovingLabel (com.ramussoft.pb.idef.visual.MovingLabel)4 Vector (java.util.Vector)4 Sector (com.ramussoft.pb.Sector)3 NRow (com.ramussoft.pb.data.negine.NRow)3 NSector (com.ramussoft.pb.data.negine.NSector)3 MovingFunction (com.ramussoft.pb.idef.visual.MovingFunction)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3