|
@@ -103,16 +103,16 @@ class MyCanvas extends JPanel implements MouseListener, MouseMotionListener {
|
|
|
// drawEdges
|
|
|
g2.setColor(Color.BLACK);
|
|
|
if (drawEdge)
|
|
|
- g2.drawLine(tempCps.getPos().x + GlobalVariables.SCALE_DIVIDED2,
|
|
|
- tempCps.getPos().y + GlobalVariables.SCALE_DIVIDED2, x, y);
|
|
|
+ g2.drawLine(tempCps.getPosition().x + GlobalVariables.SCALE_DIVIDED2,
|
|
|
+ tempCps.getPosition().y + GlobalVariables.SCALE_DIVIDED2, x, y);
|
|
|
|
|
|
for (CpsObject cps : model.getObjectsOnCanvas()) {
|
|
|
for (CpsObject con : cps.getConnectedTo()) {
|
|
|
if (con.getID() != model.getSelectedObjectID() && cps.getID() != model.getSelectedObjectID())
|
|
|
- g2.drawLine(cps.getPos().x + GlobalVariables.SCALE_DIVIDED2,
|
|
|
- cps.getPos().y + GlobalVariables.SCALE_DIVIDED2,
|
|
|
- con.getPos().x + GlobalVariables.SCALE_DIVIDED2,
|
|
|
- con.getPos().y + GlobalVariables.SCALE_DIVIDED2);
|
|
|
+ g2.drawLine(cps.getPosition().x + GlobalVariables.SCALE_DIVIDED2,
|
|
|
+ cps.getPosition().y + GlobalVariables.SCALE_DIVIDED2,
|
|
|
+ con.getPosition().x + GlobalVariables.SCALE_DIVIDED2,
|
|
|
+ con.getPosition().y + GlobalVariables.SCALE_DIVIDED2);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -121,17 +121,17 @@ class MyCanvas extends JPanel implements MouseListener, MouseMotionListener {
|
|
|
for (CpsObject cps : model.getObjectsOnCanvas()) {
|
|
|
for (CpsObject con : cps.getConnectedTo()) {
|
|
|
if (con.getID() == model.getSelectedObjectID())
|
|
|
- g2.drawLine(cps.getPos().x + GlobalVariables.SCALE_DIVIDED2,
|
|
|
- cps.getPos().y + GlobalVariables.SCALE_DIVIDED2,
|
|
|
- con.getPos().x + GlobalVariables.SCALE_DIVIDED2,
|
|
|
- con.getPos().y + GlobalVariables.SCALE_DIVIDED2);
|
|
|
+ g2.drawLine(cps.getPosition().x + GlobalVariables.SCALE_DIVIDED2,
|
|
|
+ cps.getPosition().y + GlobalVariables.SCALE_DIVIDED2,
|
|
|
+ con.getPosition().x + GlobalVariables.SCALE_DIVIDED2,
|
|
|
+ con.getPosition().y + GlobalVariables.SCALE_DIVIDED2);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// Objects
|
|
|
for (CpsObject cps : model.getObjectsOnCanvas()) {
|
|
|
img = new ImageIcon(this.getClass().getResource(cps.getImage())).getImage();
|
|
|
- g2.drawImage(img, cps.getPos().x, cps.getPos().y, GlobalVariables.SCALE, GlobalVariables.SCALE, null);
|
|
|
+ g2.drawImage(img, cps.getPosition().x, cps.getPosition().y, GlobalVariables.SCALE, GlobalVariables.SCALE, null);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -161,8 +161,8 @@ class MyCanvas extends JPanel implements MouseListener, MouseMotionListener {
|
|
|
tempCps = null;
|
|
|
// Object Selection
|
|
|
for (CpsObject cps : model.getObjectsOnCanvas()) {
|
|
|
- cx = cps.getPos().x;
|
|
|
- cy = cps.getPos().y;
|
|
|
+ cx = cps.getPosition().x;
|
|
|
+ cy = cps.getPosition().y;
|
|
|
if (x - GlobalVariables.SCALE <= cx && y - GlobalVariables.SCALE <= cy && x >= cx && y >= cy) {
|
|
|
tempCps = cps;
|
|
|
if (e.isControlDown())
|
|
@@ -188,7 +188,7 @@ class MyCanvas extends JPanel implements MouseListener, MouseMotionListener {
|
|
|
y = e.getY();
|
|
|
|
|
|
dragging = false;
|
|
|
- tempCps.setPos(e.getX() - GlobalVariables.SCALE_DIVIDED2, e.getY() - GlobalVariables.SCALE_DIVIDED2);
|
|
|
+ tempCps.setPosition(e.getX() - GlobalVariables.SCALE_DIVIDED2, e.getY() - GlobalVariables.SCALE_DIVIDED2);
|
|
|
tempCps = null;
|
|
|
}
|
|
|
|
|
@@ -214,12 +214,12 @@ class MyCanvas extends JPanel implements MouseListener, MouseMotionListener {
|
|
|
repaint();
|
|
|
} else {
|
|
|
try {
|
|
|
- tempCps.setPos(e.getX() - GlobalVariables.SCALE_DIVIDED2, e.getY() - GlobalVariables.SCALE_DIVIDED2);
|
|
|
+ tempCps.setPosition(e.getX() - GlobalVariables.SCALE_DIVIDED2, e.getY() - GlobalVariables.SCALE_DIVIDED2);
|
|
|
dragging = true;
|
|
|
- selectRect.setLocation(tempCps.getPos().x - (GlobalVariables.SCALE / 20),
|
|
|
- tempCps.getPos().y - (GlobalVariables.SCALE / 20));
|
|
|
+ selectRect.setLocation(tempCps.getPosition().x - (GlobalVariables.SCALE / 20),
|
|
|
+ tempCps.getPosition().y - (GlobalVariables.SCALE / 20));
|
|
|
objectTT.setTipText(tempCps.getName());
|
|
|
- objectTT.setLocation(tempCps.getPos().x, tempCps.getPos().y);
|
|
|
+ objectTT.setLocation(tempCps.getPosition().x, tempCps.getPosition().y);
|
|
|
repaint();
|
|
|
} catch (Exception e2) {
|
|
|
// TODO: handle exception
|
|
@@ -234,8 +234,8 @@ class MyCanvas extends JPanel implements MouseListener, MouseMotionListener {
|
|
|
|
|
|
boolean on = false;
|
|
|
for (CpsObject cps : model.getObjectsOnCanvas()) {
|
|
|
- cx = cps.getPos().x;
|
|
|
- cy = cps.getPos().y;
|
|
|
+ cx = cps.getPosition().x;
|
|
|
+ cy = cps.getPosition().y;
|
|
|
if (x - GlobalVariables.SCALE <= cx && y - GlobalVariables.SCALE <= cy && x >= cx && y >= cy) {
|
|
|
objectTT.setTipText(cps.getName());
|
|
|
objectTT.setLocation(cx, cy);
|
|
@@ -253,8 +253,8 @@ class MyCanvas extends JPanel implements MouseListener, MouseMotionListener {
|
|
|
*/
|
|
|
private void objectSelectionHighlighting() {
|
|
|
if (tempCps != null) {
|
|
|
- selectRect.setBounds(tempCps.getPos().x - (GlobalVariables.SCALE / 20),
|
|
|
- tempCps.getPos().y - (GlobalVariables.SCALE / 20),
|
|
|
+ selectRect.setBounds(tempCps.getPosition().x - (GlobalVariables.SCALE / 20),
|
|
|
+ tempCps.getPosition().y - (GlobalVariables.SCALE / 20),
|
|
|
GlobalVariables.SCALE + GlobalVariables.SCALE / 10,
|
|
|
GlobalVariables.SCALE + GlobalVariables.SCALE / 10);
|
|
|
controller.setSelectedObjectID(tempCps.getID());
|
|
@@ -269,8 +269,8 @@ class MyCanvas extends JPanel implements MouseListener, MouseMotionListener {
|
|
|
*/
|
|
|
private void drawDeleteEdge() {
|
|
|
for (CpsObject cps : model.getObjectsOnCanvas()) {
|
|
|
- cx = cps.getPos().x;
|
|
|
- cy = cps.getPos().y;
|
|
|
+ cx = cps.getPosition().x;
|
|
|
+ cy = cps.getPosition().y;
|
|
|
if (x - GlobalVariables.SCALE <= cx && y - GlobalVariables.SCALE <= cy && x >= cx && y >= cy) {
|
|
|
if (!cps.getConnectedTo().contains(tempCps)) {
|
|
|
cps.AddConnection(tempCps);
|