use of com.dsoft.utils.DataLoader.MemoryData in project ramus by Vitaliy-Yakovchuk.
the class MouseSelection method onProcessEndBoundsChange.
public void onProcessEndBoundsChange(MovingArea movingArea, MovingText[] panels, FloatPoint diff) {
for (MovingText text : panels) if (text instanceof DFDSRole) {
IDEF0Object idef = (IDEF0Object) text;
if (contains(text))
idef.onProcessEndBoundsChange(sectors);
}
for (MovingText text : panels) {
if (!(text instanceof DFDSRole))
if (contains(text)) {
if (text instanceof IDEF0Object) {
IDEF0Object idef = (IDEF0Object) text;
idef.onProcessEndBoundsChange(sectors);
}
}
}
List<Ordinate> xOrdinates = new ArrayList<Ordinate>();
List<Ordinate> yOrdinates = new ArrayList<Ordinate>();
for (PaintSector ps : sectors) {
for (Point point : ps.getPoints()) {
boolean has;
has = false;
for (Ordinate o : xOrdinates) if (o.getOrdinateId() == point.getXOrdinate().getOrdinateId()) {
has = true;
break;
}
if (!has)
xOrdinates.add(point.getXOrdinate());
has = false;
for (Ordinate o : yOrdinates) if (o.getOrdinateId() == point.getYOrdinate().getOrdinateId()) {
has = true;
break;
}
if (!has)
yOrdinates.add(point.getYOrdinate());
}
}
List<PaintSector> psrs = new ArrayList<PaintSector>();
psrs.addAll(sectors);
for (Ordinate xOrdinate : xOrdinates) {
xOrdinate.setPosition(xOrdinate.getPosition() + diff.getX());
for (Point point : xOrdinate.getPoints()) if (!psrs.contains(point.getSector()))
psrs.add(point.getSector());
}
for (Ordinate yOrdinate : yOrdinates) {
yOrdinate.setPosition(yOrdinate.getPosition() + diff.getY());
for (Point point : yOrdinate.getPoints()) if (!psrs.contains(point.getSector()))
psrs.add(point.getSector());
}
MemoryData data = new MemoryData();
for (PaintSector paintSector : sectors) {
Function sFunction = paintSector.getSector().getStart().getFunction();
if (sFunction != null) {
switch(paintSector.getSector().getStart().getFunctionType()) {
case MovingFunction.LEFT:
paintSector.getStartPoint().setX(sFunction.getBounds().getLeft());
break;
case MovingFunction.RIGHT:
paintSector.getStartPoint().setX(sFunction.getBounds().getRight());
break;
case MovingFunction.TOP:
paintSector.getStartPoint().setY(sFunction.getBounds().getTop());
break;
case MovingFunction.BOTTOM:
paintSector.getStartPoint().setY(sFunction.getBounds().getBottom());
break;
}
}
sFunction = paintSector.getSector().getEnd().getFunction();
if (sFunction != null) {
switch(paintSector.getSector().getEnd().getFunctionType()) {
case MovingFunction.LEFT:
paintSector.getEndPoint().setX(sFunction.getBounds().getLeft());
break;
case MovingFunction.RIGHT:
paintSector.getEndPoint().setX(sFunction.getBounds().getRight());
break;
case MovingFunction.TOP:
paintSector.getEndPoint().setY(sFunction.getBounds().getTop());
break;
case MovingFunction.BOTTOM:
paintSector.getEndPoint().setY(sFunction.getBounds().getBottom());
break;
}
}
}
for (MovingText text : panels) {
if (!(text instanceof DFDSRole))
if (contains(text)) {
if (!(text instanceof IDEF0Object)) {
text.onProcessEndBoundsChange();
if (text instanceof MovingLabel)
((MovingLabel) text).boundsCopy = text.getBounds();
}
}
}
for (PaintSector ps : psrs) PaintSector.save(ps, data, movingArea.getDataPlugin().getEngine());
}
Aggregations