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();
}
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();
}
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);
}
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;
}
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;
}
Aggregations