use of com.dsoft.pb.types.FRectangle in project ramus by Vitaliy-Yakovchuk.
the class HTMLHelper method getPinCoords.
private String getPinCoords(final Pin pin, final MovingArea area) {
final double d = 2;
final FRectangle bounds = new FRectangle();
if (pin.getType() == PaintSector.PIN_TYPE_X) {
double x1 = pin.getStart().getX();
double x2 = pin.getEnd().getX();
final double y = pin.getEnd().getY();
if (x2 < x1) {
final double x = x1;
x1 = x2;
x2 = x;
}
bounds.setX(x1);
bounds.setWidth(x2 - x1);
bounds.setY(y - d);
bounds.setHeight(d * 2);
} else {
double y1 = pin.getStart().getY();
double y2 = pin.getEnd().getY();
final double x = pin.getEnd().getX();
if (y2 < y1) {
final double y = y1;
y1 = y2;
y2 = y;
}
bounds.setY(y1);
bounds.setHeight(y2 - y1);
bounds.setX(x - d);
bounds.setWidth(d * 2);
}
return getAreaCoords(bounds, area);
}
use of com.dsoft.pb.types.FRectangle in project ramus by Vitaliy-Yakovchuk.
the class DFDSMovingLabel method resetBounds.
@Override
public void resetBounds() {
final FRectangle old = getBounds();
final Rectangle2D r = getResetsBounds(old);
double w = r.getWidth();
double h = r.getHeight();
if (w < old.getWidth())
w = old.getWidth();
if (h < old.getHeight())
h = old.getHeight();
setBounds(old.getX(), /*-((r.getWidth()-old.getWidth())/2)*/
old.getY(), /*
* -(r.getHeight()-old.getHeight())/2
*/
w, h);
// myBounds.setTransformNetBoundsMax(MovingArea.NET_LENGTH);
}
use of com.dsoft.pb.types.FRectangle in project ramus by Vitaliy-Yakovchuk.
the class DFDSMovingLabel method paint.
@Override
public void paint(Graphics2D g) {
final Rectangle2D rec = movingArea.getBounds(getBounds());
FRectangle textBounds = new FRectangle(getTextBounds());
textBounds.setX(textBounds.getX() + 0.5d);
double mx = movingArea.getIDoubleOrdinate(4);
double my = movingArea.getIDoubleOrdinate(2);
double sx = movingArea.getIDoubleOrdinate(2);
double sy = movingArea.getIDoubleOrdinate(1);
double maxX = rec.getMaxX() + movingArea.getIDoubleOrdinate(0.5);
double xm = maxX - mx;
if (rec.getX() > xm - sx)
xm = maxX;
double ym = rec.getMaxY() - my;
double maxY = rec.getMaxY();
if (rec.getY() > ym - sy)
ym = maxY;
int c = 1;
if (!transparent && sector.getStream() != null && sector.getStream().getAdded() != null)
c = sector.getStream().getAdded().length;
if (!transparent || isNegative()) {
g.setColor(fiterColor(Color.WHITE));
GeneralPath gp = new GeneralPath(GeneralPath.WIND_NON_ZERO);
gp.moveTo(maxX, ym);
gp.lineTo(maxX, rec.getY());
gp.lineTo(rec.getX(), rec.getY());
gp.lineTo(rec.getX(), maxY);
gp.lineTo(xm, maxY);
gp.lineTo(maxX, ym);
g.fill(gp);
}
for (int i = c - 1; i > 0; i--) {
AffineTransform translateInstance = AffineTransform.getTranslateInstance(movingArea.getIDoubleOrdinate(i) * 2d, movingArea.getIDoubleOrdinate(i) * 2d);
if (!transparent || isNegative()) {
g.setColor(fiterColor(Color.WHITE));
GeneralPath gp = new GeneralPath(GeneralPath.WIND_NON_ZERO);
gp.moveTo(maxX, ym);
gp.lineTo(maxX, rec.getY());
gp.lineTo(rec.getX(), rec.getY());
gp.lineTo(rec.getX(), maxY);
gp.lineTo(xm, maxY);
gp.lineTo(maxX, ym);
g.fill(gp.createTransformedShape(translateInstance));
}
g.setColor(fiterColor(getColor()));
GeneralPath gp = new GeneralPath(GeneralPath.WIND_NON_ZERO);
gp.moveTo(xm, maxY);
gp.lineTo(xm, ym);
gp.lineTo(maxX, ym);
gp.lineTo(maxX, rec.getY());
gp.lineTo(rec.getX(), rec.getY());
gp.lineTo(rec.getX(), maxY);
gp.lineTo(xm, maxY);
gp.lineTo(maxX, ym);
g.draw(gp.createTransformedShape(translateInstance));
}
if (!transparent || isNegative()) {
g.setColor(fiterColor(Color.WHITE));
GeneralPath gp = new GeneralPath(GeneralPath.WIND_NON_ZERO);
gp.moveTo(maxX, ym);
gp.lineTo(maxX, rec.getY());
gp.lineTo(rec.getX(), rec.getY());
gp.lineTo(rec.getX(), maxY);
gp.lineTo(xm, maxY);
gp.lineTo(maxX, ym);
g.fill(gp);
}
GeneralPath gp = new GeneralPath(GeneralPath.WIND_NON_ZERO);
gp.moveTo(xm, maxY);
gp.lineTo(xm, ym);
gp.lineTo(maxX, ym);
gp.lineTo(maxX, rec.getY());
gp.lineTo(rec.getX(), rec.getY());
gp.lineTo(rec.getX(), maxY);
gp.lineTo(xm, maxY);
gp.lineTo(maxX, ym);
g.setColor(fiterColor(getColor()));
g.draw(gp);
g.setFont(getFont());
movingArea.paintText(g, getText(), textBounds, getAlign(), 0, true);
paintBorder(g);
}
use of com.dsoft.pb.types.FRectangle in project ramus by Vitaliy-Yakovchuk.
the class DFDSRole method compareTo.
@Override
public int compareTo(DFDSRole obj) {
FRectangle my = getBounds();
FRectangle o = obj.getBounds();
if (my.getX() < o.getX())
return -1;
if (my.getX() > o.getX())
return 1;
return 0;
}
use of com.dsoft.pb.types.FRectangle in project ramus by Vitaliy-Yakovchuk.
the class AbstractTemplate method createChilds.
private synchronized void createChilds(final Rectangle rectangle) {
// final IdGenerator g = GlobalId.getGenerator();
// GlobalId.setGenerator(generator);
dataPlugin = NDataPluginFactory.getTemplateDataPlugin();
Function f = dataPlugin.getBaseFunction();
final ProjectOptions po = f.getProjectOptions();
po.setChangeDate(po.getDateChangeDate());
po.setProjectAutor(po.getProjectAutor());
po.setProjectName(po.getProjectName());
po.setUsedAt(po.getUsedAt());
f.setProjectOptions(po);
final Attribute attribute = dataPlugin.getEngine().createAttribute(new com.ramussoft.common.AttributeType("Core", "Text", true));
Qualifier q = dataPlugin.getBaseFunctionQualifier();
q.getAttributes().add(attribute);
q.setAttributeForName(attribute.getId());
dataPlugin.getEngine().updateQualifier(q);
f = (Function) dataPlugin.createRow(f, true);
diagram = f;
f.setDecompositionType(decompositionType);
final FRectangle rect = f.getBounds();
rect.setX(rectangle.getWidth() / 2 - rect.getWidth() / 2);
rect.setY(rectangle.getHeight() / 2 - rect.getHeight() / 2);
f.setBounds(rect);
createChilds(f, dataPlugin);
base = f;
// GlobalId.setGenerator(g);
}
Aggregations