use of com.dsoft.pb.types.FloatPoint in project ramus by Vitaliy-Yakovchuk.
the class DFDFunction method getTriangle.
protected int getTriangle(final FloatPoint point) {
int res = -1;
FloatPoint l = getLocation();
for (int type = MovingPanel.RIGHT; type <= MovingPanel.TOP; type++) {
GeneralPath gp = getTrianglePath(type);
double y = point.getY() + l.getY();
double x = point.getX() + l.getX();
if (gp.contains(new Point2D.Double(x, y))) {
res = type;
break;
}
}
return res;
}
use of com.dsoft.pb.types.FloatPoint in project ramus by Vitaliy-Yakovchuk.
the class IDLImporter method createSegment.
private void createSegment(Arrowseg seg, MovingArea area) {
SectorRefactor sr = area.getRefactor();
Sector s = plugin.createSector();
Function f = getFunction();
s.setFunction(f);
PaintSector ps = new PaintSector();
ps.setSector(s);
ps.setMovingArea(area);
sr.addSector(ps);
seg.sector = ps;
ArrayList<FloatPoint> list = new ArrayList<FloatPoint>();
StringTokenizer st = new StringTokenizer(seg.path, "() ");
while (st.hasMoreElements()) list.add(toPoint(st.nextToken()));
seg.pointsList = list;
String text = seg.getText();
if ((text != null) && (text.length() > 0)) {
s.setStream(getStream(text), ReplaceStreamType.CHILDREN);
if (seg.coordinates != null) {
MovingLabel label = new MovingLabel(area);
StringTokenizer st2 = new StringTokenizer(seg.coordinates, "()");
FloatPoint point = toPoint(st2.nextToken());
label.getBounds().setX(point.getX());
label.getBounds().setY(point.getY() - 10);
label.setText(text);
ps.setText(label);
if (seg.squiggleCoordinates != null) {
ps.setShowTilda(true);
}
}
if (seg.label.startsWith("{")) {
StringTokenizer st2 = new StringTokenizer(seg.label, " ");
st2.nextElement();
st2.nextElement();
try {
int font = Integer.parseInt(st2.nextToken());
if (font < uniqueFonts.size())
ps.setFont(uniqueFonts.get(font));
} catch (Exception e) {
}
int color = Integer.parseInt(st2.nextToken());
if (color < COLORS.length)
ps.setColor(COLORS[color]);
}
}
}
use of com.dsoft.pb.types.FloatPoint in project ramus by Vitaliy-Yakovchuk.
the class IDEF0Object method mouseMoved.
/*
* (non-Javadoc)
*
* @seecom.jason.clasificators.frames.idf.MovingPanel#mouseMoved(com.jason.
* clasificators.frames.idf.FloatPoint)
*/
@Override
public int mouseMoved(final FloatPoint point) {
super.mouseMoved(point);
int res;
if ((movingArea.getChangingState() == MovingArea.ARROW_CHANGING_STATE) && (movingArea.isOkForCross()))
res = getTriangle(point);
else
res = -1;
if (res != paintTriangle) {
paintTriangle = res;
movingArea.repaintAsync();
}
return paintTriangle;
}
use of com.dsoft.pb.types.FloatPoint in project ramus by Vitaliy-Yakovchuk.
the class MovingPanel method mouseMoved.
public int mouseMoved(final FloatPoint point) {
final int type = getPressType(point);
if (type != mouseType) {
mouseType = type;
if (movingArea.getVisualCopyCursor() != null)
movingArea.setCursor(movingArea.getVisualCopyCursor());
else if (type == -1)
movingArea.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
else if (type == STATE_MOVE)
movingArea.setCursor(new Cursor(Cursor.MOVE_CURSOR));
else if (type == STATE_STOP)
movingArea.setCursor(new Cursor(Cursor.MOVE_CURSOR));
else if (type == STATE_RESIZE_LEFT)
movingArea.setCursor(new Cursor(Cursor.W_RESIZE_CURSOR));
else if (type == STATE_RESIZE_RIGHT)
movingArea.setCursor(new Cursor(Cursor.E_RESIZE_CURSOR));
else if (type == STATE_RESIZE_TOP)
movingArea.setCursor(new Cursor(Cursor.N_RESIZE_CURSOR));
else if (type == STATE_RESIZE_BOTTOM)
movingArea.setCursor(new Cursor(Cursor.S_RESIZE_CURSOR));
else if (type == STATE_RESIZE_BOTTOM_LEFT)
movingArea.setCursor(new Cursor(Cursor.SW_RESIZE_CURSOR));
else if (type == STATE_RESIZE_RIGHT_BOTTOM)
movingArea.setCursor(new Cursor(Cursor.SE_RESIZE_CURSOR));
else if (type == STATE_RESIZE_TOP_RIGHT)
movingArea.setCursor(new Cursor(Cursor.NE_RESIZE_CURSOR));
else if (type == STATE_RESIZE_LEFT_TOP)
movingArea.setCursor(new Cursor(Cursor.NW_RESIZE_CURSOR));
}
movingArea.repaint();
return -1;
}
use of com.dsoft.pb.types.FloatPoint in project ramus by Vitaliy-Yakovchuk.
the class SectorRefactor method createMiss.
private Sector createMiss(final PerspectivePoint point) {
if (point.functionType >= 0) {
point.crosspoint = getDataPlugin().createCrosspoint();
double inPos;
if (point.functionType == MovingPanel.LEFT || point.functionType == MovingPanel.RIGHT)
inPos = point.point.getY();
else
inPos = point.point.getX();
return createPartIn(point.crosspoint, point.function, point.functionType, inPos, point.type == TYPE_END);
} else if (point.borderType == -1) {
// Tochka na inshomu sektory
final PaintSector.Pin pin = point.pin;
final double x = point.x;
final double y = point.y;
double oX;
double oY;
double opX;
double opY;
final boolean start = point.type == TYPE_START;
if (start) {
oX = pointA.x;
oY = pointA.y;
opX = pointB.getX();
opY = pointB.getY();
} else {
opX = pointA.getX();
opY = pointA.getY();
oX = pointB.x;
oY = pointB.y;
}
final Point p = new Point();
if (pin.isNearStart(x, y) && pin.isFirst()) {
final Crosspoint crosspoint = pin.getSector().getStart();
if (crosspoint.isCanAddOut() && point.type == TYPE_START || crosspoint.isCanAddIn() && point.type == TYPE_END) {
final int type = pin.getStart().isCanConnected(opX, opY);
if (type >= 0) {
p.setType(type);
p.setXOrdinate(pin.getStart().getXOrdinate());
p.setYOrdinate(pin.getStart().getYOrdinate());
point.crosspoint = crosspoint;
point.point = p;
return null;
}
}
} else if (pin.isNearEnd(x, y) && pin.isEnd()) {
final Crosspoint crosspoint = pin.getSector().getEnd();
if (crosspoint.isCanAddOut() && point.type == TYPE_START || crosspoint.isCanAddIn() && point.type == TYPE_END) {
final int type = pin.getEnd().isCanConnected(opX, opY);
if (type >= 0) {
p.setType(type);
p.setXOrdinate(pin.getEnd().getXOrdinate());
p.setYOrdinate(pin.getEnd().getYOrdinate());
point.crosspoint = crosspoint;
point.point = p;
return null;
}
}
}
final PaintSector sector = pin.getSector();
final SplitSectorType sst = sector.splitSector(pin, new FloatPoint(point.x, point.y), oX, oY, opX, opY, start);
final PaintSector aSector = sst.paintSector;
point.crosspoint = sector.getEnd();
point.point = new Point(sector.getEndPoint().getXOrdinate(), sector.getEndPoint().getYOrdinate());
point.point.setType(sst.type);
tryRemoveText(aSector);
tryRemoveText(sector);
addSector(aSector);
} else {
// TOCHKA NA KRAU
createBorderPoints(point, function);
}
return null;
}
Aggregations