use of com.dsoft.pb.types.FRectangle in project ramus by Vitaliy-Yakovchuk.
the class MovingText method resetBounds.
/**
* Метод підгоняє розміри області відображення тексту під текст, який
* розташований на написі.
*/
public void resetBounds() {
final FRectangle old = getBounds();
final Rectangle2D r = getResetsBounds(old);
setBounds(old.getX(), /*-((r.getWidth()-old.getWidth())/2)*/
old.getY(), /*
* -(r.getHeight()-old.getHeight())/2
*/
r.getWidth(), r.getHeight());
// myBounds.setTransformNetBoundsMax(MovingArea.NET_LENGTH);
}
use of com.dsoft.pb.types.FRectangle in project ramus by Vitaliy-Yakovchuk.
the class PaintSector method loadFromSector.
public static PaintSector loadFromSector(final int version, final MovingArea area, final DataLoader.MemoryData memoryData, final DataPlugin dataPlugin, Sector llsector) throws IOException {
final PaintSector sector = new PaintSector(area);
sector.sector = llsector;
SectorPropertiesPersistent spp = sector.sector.getSectorProperties();
sector.showTilda = spp.getShowTilda() == 1;
sector.sector.reload();
loadPoints(memoryData, dataPlugin, sector);
sector.loadVisuals();
sector.setSectorPoints();
if (spp.getShowText() == 0)
sector.text = null;
else {
sector.createText();
if (sector.text != null) {
FRectangle bounds = new FRectangle();
bounds.setBounds(spp.getTextX(), spp.getTextY(), spp.getTextWidth(), spp.getTextHieght());
sector.text.setBounds(bounds);
sector.text.setTransparent(spp.getTransparent() == 1);
if (sector.showTilda)
sector.tildaPos.setPos(spp.getTildaPos());
}
}
return sector;
}
use of com.dsoft.pb.types.FRectangle in project ramus by Vitaliy-Yakovchuk.
the class SectorRefactor method getOutCoordinate.
private FloatPoint getOutCoordinate(final Function function, final FloatPoint in, final int borderType) {
final FloatPoint res = new FloatPoint();
final FRectangle b = function.getBounds();
switch(borderType) {
case MovingPanel.LEFT:
{
res.setX(b.getLeft());
res.setY(getOutPos(in.getY(), b.getHeight(), b.getTop(), movingArea.getDoubleHeight()));
}
break;
case MovingPanel.RIGHT:
{
res.setX(b.getRight());
res.setY(getOutPos(in.getY(), b.getHeight(), b.getTop(), movingArea.getDoubleHeight()));
}
break;
case MovingPanel.TOP:
{
res.setX(getOutPos(in.getX(), b.getWidth(), b.getLeft(), movingArea.getDoubleWidth()));
res.setY(b.getTop());
}
break;
case MovingPanel.BOTTOM:
{
res.setX(getOutPos(in.getX(), b.getWidth(), b.getLeft(), movingArea.getDoubleWidth()));
res.setY(b.getBottom());
}
break;
}
return res;
}
use of com.dsoft.pb.types.FRectangle in project ramus by Vitaliy-Yakovchuk.
the class PaintSector method save.
/**
* Зберігає сектор в потік.
*
* @param stream Потік даних.
* @param sector Сектор, який буде збережений.
* @throws IOException Виникає, якщо виникла помилка запису.
*/
public static void save(final PaintSector sector, final DataLoader.MemoryData memoryData, Engine engine) {
// sector.saveVisual();
SectorPropertiesPersistent spp = new SectorPropertiesPersistent();
spp.setShowTilda((sector.showTilda) ? 1 : 0);
savePoints(sector, engine);
if (sector.text == null)
spp.setShowText(0);
else {
spp.setShowText(1);
FRectangle bounds = sector.text.getBounds();
spp.setTextX(bounds.getX());
spp.setTextY(bounds.getY());
spp.setTextWidth(bounds.getWidth());
spp.setTextHieght(bounds.getHeight());
spp.setTransparent(sector.text.isTransparent() ? 1 : 0);
spp.setShowTilda(sector.showTilda ? 1 : 0);
if (sector.showTilda)
spp.setTildaPos(sector.tildaPos.getPos());
}
if (sector.sector.getCreateState() >= 0)
sector.sector.setCreateState(-1, 0);
sector.sector.setSectorProperties(spp);
}
use of com.dsoft.pb.types.FRectangle in project ramus by Vitaliy-Yakovchuk.
the class ArrowPainter method paintLink.
public void paintLink(Graphics2D g, FloatPoint point, int type, Function inner, Function outer) {
long innerQ = ((NFunction) inner).getQualifierId();
long outerQ = ((NFunction) outer).getQualifierId();
String text = MovingFunction.getIDEF0Kod((com.ramussoft.database.common.Row) outer);
String letter = outer.getProjectOptions().getDeligate().getModelLetter();
if (outer.getParentRow().getName().equals("F_BASE_FUNCTIONS")) {
if (letter == null)
text = "A-0";
else
text = letter + "-0";
}
if (innerQ != outerQ) {
if (letter == null || "A".equals(letter))
text = movingArea.getDataPlugin().getEngine().getQualifier(outerQ).getName() + "/" + text;
}
tunnelLength = movingArea.getIDoubleOrdinate(TUNNEL_LENGTH) * 1;
g.setStroke(ArrowPainter.THIN_STROKE);
g.setStroke(new BasicStroke(0.5f));
double x = movingArea.getIDoubleOrdinate(point.getX());
double y = movingArea.getIDoubleOrdinate(point.getY());
double helf = tunnelLength / 2;
switch(type) {
case MovingPanel.BOTTOM:
{
g.draw(new Ellipse2D.Double(x - helf, y, tunnelLength, tunnelLength));
boolean left = point.getX() < movingArea.CLIENT_WIDTH / 2;
if (!left) {
movingArea.paintText(g, text, new FRectangle(point.getX() + TUNNEL_LENGTH, 0, movingArea.CLIENT_WIDTH - point.getX() - TUNNEL_WIDTH * 10, movingArea.CLIENT_HEIGHT), Line.LEFT_ALIGN, true);
} else {
movingArea.paintText(g, text, new FRectangle(0, 0, point.getX() - TUNNEL_LENGTH, movingArea.CLIENT_HEIGHT), Line.RIGHT_ALIGN, true);
}
}
break;
case MovingPanel.TOP:
{
g.draw(new Ellipse2D.Double(x - helf, y - tunnelLength, tunnelLength, tunnelLength));
boolean left = point.getX() < movingArea.CLIENT_WIDTH / 2;
if (!left) {
movingArea.paintText(g, text, new FRectangle(point.getX() + TUNNEL_LENGTH, 0, movingArea.CLIENT_WIDTH - point.getX() - TUNNEL_WIDTH * 10, movingArea.CLIENT_HEIGHT), Line.LEFT_ALIGN, 2, true);
} else {
movingArea.paintText(g, text, new FRectangle(0, 0, point.getX() - TUNNEL_LENGTH, movingArea.CLIENT_HEIGHT), Line.RIGHT_ALIGN, 2, true);
}
}
break;
case MovingPanel.RIGHT:
{
g.draw(new Ellipse2D.Double(x, y - helf, tunnelLength, tunnelLength));
boolean top = point.getY() < movingArea.CLIENT_HEIGHT / 2;
if (!top) {
movingArea.paintText(g, text, new FRectangle(2, point.getY() + tunnelLength / 2, movingArea.CLIENT_WIDTH * 0.20, movingArea.CLIENT_HEIGHT - point.getY() - tunnelLength / 2), Line.LEFT_ALIGN, 0, true);
} else {
movingArea.paintText(g, text, new FRectangle(2, 0, movingArea.CLIENT_WIDTH * 0.20, point.getY() - tunnelLength / 2), Line.LEFT_ALIGN, 2, true);
}
}
break;
case MovingPanel.LEFT:
{
g.draw(new Ellipse2D.Double(x - tunnelLength, y - helf, tunnelLength, tunnelLength));
boolean top = point.getY() < movingArea.CLIENT_HEIGHT / 2;
if (!top) {
movingArea.paintText(g, text, new FRectangle(movingArea.CLIENT_WIDTH * 0.80, point.getY() + tunnelLength / 2, movingArea.CLIENT_WIDTH * 0.20 - 2, movingArea.CLIENT_HEIGHT - point.getY() - tunnelLength / 2), Line.RIGHT_ALIGN, 0, true);
} else {
movingArea.paintText(g, text, new FRectangle(movingArea.CLIENT_WIDTH * 0.80, 0, movingArea.CLIENT_WIDTH * 0.20 - 2, point.getY() - tunnelLength / 2), Line.RIGHT_ALIGN, 2, true);
}
}
break;
}
}
Aggregations