use of com.ramussoft.pb.idef.elements.PaintSector in project ramus by Vitaliy-Yakovchuk.
the class DFDSFunction method onProcessEndBoundsChange.
@Override
public void onProcessEndBoundsChange() {
FRectangle oldRec = function.getBounds();
myBounds.setTransformNetBounds(MovingArea.NET_LENGTH);
FRectangle newRect = new FRectangle(myBounds);
function.setBounds(newRect);
final SectorRefactor refactor = movingArea.getRefactor();
MemoryData memoryData = new MemoryData();
List<PaintSector> list = new ArrayList<PaintSector>();
for (int i = 0; i < refactor.getSectorsCount(); i++) {
PaintSector sector = refactor.getSector(i);
try {
setAddedSectorPos(oldRec, sector, list);
} catch (Exception e) {
e.printStackTrace();
}
}
for (PaintSector ps : list) PaintSector.save(ps, memoryData, ((NFunction) function).getEngine());
setAddedRolesPos(oldRec, newRect);
}
use of com.ramussoft.pb.idef.elements.PaintSector in project ramus by Vitaliy-Yakovchuk.
the class DFDSRole method onProcessEndBoundsChange.
@Override
public void onProcessEndBoundsChange() {
final FRectangle oldRec = function.getBounds();
myBounds.setTransformNetBounds(MovingArea.NET_LENGTH);
List<PaintSector> list = new ArrayList<PaintSector>();
final SectorRefactor refactor = movingArea.getRefactor();
boolean sectorReplaced = false;
DFDSFunction function = movingArea.findDFDSFunction(this.getBounds());
if (function != null) {
getFunction().setOwner(function.getFunction());
for (int i = 0; i < refactor.getSectorsCount(); i++) {
PaintSector ps = refactor.getSector(i);
Function function2 = ps.getSector().getStart().getFunction();
if (function2 != null && function2.equals(this.function)) {
replaceFunction(ps.getSector().getStart(), ps, list, ps.getStartPoint(), ps.getSector().getStart().getFunctionType(), function, refactor, true);
}
Function function3 = ps.getSector().getEnd().getFunction();
if (function3 != null && function3.equals(this.function)) {
replaceFunction(ps.getSector().getEnd(), ps, list, ps.getEndPoint(), ps.getSector().getEnd().getFunctionType(), function, refactor, false);
}
}
function.justifyRoles();
sectorReplaced = true;
} else {
if (this.getFunction().getOwner() != null) {
DFDSFunction function2 = movingArea.findDFDSFunction(this.getFunction().getOwner());
if (function2 != null && function2.getBounds().intersects(this.getBounds())) {
function2.justifyRoles();
} else
this.function.setBounds(new FRectangle(myBounds));
} else
this.function.setBounds(new FRectangle(myBounds));
}
MemoryData memoryData = new MemoryData();
if (!sectorReplaced) {
for (int i = 0; i < refactor.getSectorsCount(); i++) {
PaintSector sector = refactor.getSector(i);
setAddedSectorPos(oldRec, sector, list);
}
}
for (PaintSector ps : list) PaintSector.save(ps, memoryData, ((NFunction) this.function).getEngine());
long l = this.function.getLink();
if (l >= 0l) {
Stream stream = (Stream) movingArea.getDataPlugin().findRowByGlobalId(l);
if (stream != null) {
Row[] rows = stream.getAdded();
RectangleVisualOptions ops = new RectangleVisualOptions();
ops.bounds = this.function.getBounds();
ops.background = this.function.getBackground();
ops.font = this.function.getFont();
ops.foreground = this.function.getForeground();
for (Row row : rows) if (row != null) {
IDEF0Plugin.setDefaultRectangleVisualOptions(movingArea.getDataPlugin().getEngine(), row.getElement(), ops);
}
}
}
}
use of com.ramussoft.pb.idef.elements.PaintSector in project ramus by Vitaliy-Yakovchuk.
the class UserTemplate method recRemove.
private static void recRemove(PaintSector ps, List<PaintSector> paintSectors) {
boolean remed;
do {
remed = false;
for (int i = 0; i < paintSectors.size(); i++) {
PaintSector s = paintSectors.get(i);
if (hasCross(s, ps.getStart())) {
remed = true;
recRemove(paintSectors.remove(i), paintSectors);
break;
}
if (hasCross(s, ps.getEnd())) {
remed = true;
recRemove(paintSectors.remove(i), paintSectors);
break;
}
}
} while (remed);
}
use of com.ramussoft.pb.idef.elements.PaintSector in project ramus by Vitaliy-Yakovchuk.
the class UserTemplate method remove.
private static boolean remove(List<PaintSector> paintSectors, int i, List<Function> functions, DataPlugin dataPlugin) {
PaintSector ps = paintSectors.get(i);
if (hasFunction(functions, ((NSector) ps.getSector()).getStart().getFunction()) && hasFunction(functions, ((NSector) ps.getSector()).getEnd().getFunction()))
return false;
paintSectors.remove(i);
recRemove(ps, paintSectors);
return true;
}
use of com.ramussoft.pb.idef.elements.PaintSector in project ramus by Vitaliy-Yakovchuk.
the class IDLExporter method printSegments.
protected void printSegments(Function f) throws IOException {
MovingArea movingArea = new MovingArea(dataPlugin, f);
movingArea.setActiveFunction(f);
SectorRefactor sr = movingArea.getRefactor();
for (int i = 0; i < sr.getSectorsCount(); i++) {
PaintSector ps = sr.getSector(i);
writer.p1("ARROWSEG " + (i + 1));
writer.right();
writer.p1("SOURCE " + getName(ps.getSector().getStart(), f, ps.getSector(), sr, ps.getPoint(0)));
StringBuffer path = new StringBuffer();
path.append("PATH ");
for (int j = 0; j < ps.getPointCount(); j++) {
Point point = ps.getPoint(j);
path.append(toCoortinate(point.getX(), point.getY()));
}
writer.p1(path.toString());
String s = ps.getAlternativeText();
if ("".equals(s))
s = ps.getSector().getName();
if ((s != null) && (s.length() > 0)) {
MovingLabel text = ps.getText();
if (text != null) {
final PStringBounder nb = new PStringBounder(null);
nb.setFont(text.getFont());
final PStringBounder.Tokanizer tokanizer = nb.getTokanizer(s, text.getBounds().getWidth(), 0);
StringBuffer sb = new StringBuffer();
if (tokanizer.hasMoreData())
sb.append(tokanizer.getNext());
while (tokanizer.hasMoreData()) {
sb.append("<CR>");
sb.append(tokanizer.getNext());
}
writer.p2("LABEL {0}", "{LWI I 0 " + toByteTextIndex(text.getColor()) + " " + toByteTextIndex(text.getColor()) + " }" + sb.toString());
writer.p1("LABEL COORDINATES " + toCoortinate(ps.getText().getBounds().getX(), ps.getText().getBounds().getCenter().getY()));
if (ps.isShowTilda()) {
writer.p1("SQUIGGLE COORDINATES " + toCoortinate(ps.getTildaOPoint()) + " " + toCoortinate(ps.getTildaPoint()));
}
} else
writer.p2("LABEL {0}", s);
}
writer.p1("SINK " + getName(ps.getSector().getEnd(), f, ps.getSector(), sr, ps.getPoint(ps.getPointCount() - 1)));
writer.left();
writer.p1("ENDSEG");
}
}
Aggregations