- Timestamp:
- 09/18/18 11:57:32 (6 years ago)
- Location:
- trunk/src/org
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/apollo/ApolloGestureActions.java
r1098 r1142 170 170 for (Item i : current.getItems()) { 171 171 Point pos = i.getPosition(); 172 pos. x %= windowSize.width;173 pos. y %= windowSize.height;172 pos.setX(pos.getX() % windowSize.width); 173 pos.setY(pos.getY() % windowSize.height); 174 174 i.setPosition(pos); 175 175 } -
trunk/src/org/apollo/audio/structure/AudioStructureModel.java
r1102 r1142 347 347 if (localFileName != null) { 348 348 tracks.put(localFileName, new TrackModelData( 349 initiationTime, -1, name, result.position. y)); // pass -1 for running time to signify that must be read from audio file349 initiationTime, -1, name, result.position.getY())); // pass -1 for running time to signify that must be read from audio file 350 350 } 351 351 … … 389 389 if (virtualFilename != null) { 390 390 linkedTracks.put(virtualFilename, new LinkedTrackModelData( 391 initiationTime, result.explink, name, result.position. y)); // pass -1 for running time to signify that must be read from audio file391 initiationTime, result.explink, name, result.position.getY())); // pass -1 for running time to signify that must be read from audio file 392 392 } 393 393 -
trunk/src/org/apollo/gui/FrameLayoutDaemon.java
r1102 r1142 562 562 int offsetX = width / 2; 563 563 int offsetY = freespaceTrackToFormat.getHeight() / 2; 564 freespaceTrackToFormat.setPosition(containerPoint. x - offsetX, containerPoint.y- offsetY);564 freespaceTrackToFormat.setPosition(containerPoint.getX() - offsetX, containerPoint.getY() - offsetY); 565 565 StandardGestureActions.resetOffset(); 566 566 } -
trunk/src/org/apollo/io/SampledAudioFileImporter.java
r1102 r1142 25 25 f, 26 26 DisplayController.getCurrentFrame(), 27 location. x,28 location. y);27 location.getX(), 28 location.getY()); 29 29 30 30 // Add the sampled track widget to the current frame -
trunk/src/org/apollo/items/EmulatedTextItem.java
r1125 r1142 97 97 Point p = EcosystemManager.getInputManager().getCursorPosition(); 98 98 99 return isOnEmulatedText(p. x, p.y);99 return isOnEmulatedText(p.getX(), p.getY()); 100 100 } 101 101 … … 134 134 135 135 // If so and the event really comes from its parent ... 136 if (isOnEmulatedText(p. x, p.y)) {136 if (isOnEmulatedText(p.getX(), p.getY())) { 137 137 138 138 int yOffset = -6; … … 154 154 { 155 155 // Insert the text according to the current mouse position 156 Point newMouse = emulatedSource.insertChar(e.getKeyChar(), p. x, p.y);156 Point newMouse = emulatedSource.insertChar(e.getKeyChar(), p.getX(), p.getY()); 157 157 158 158 List<String> lines = emulatedSource.getTextList(); … … 166 166 // Move "cursored mouse" 167 167 if (newMouse != null) { 168 EcosystemManager.getInputManager().setCursorPosition(new Point((int) newMouse. x, (int) newMouse.y+ yOffset));168 EcosystemManager.getInputManager().setCursorPosition(new Point((int) newMouse.getX(), (int) newMouse.getY() + yOffset)); 169 169 } 170 170 } … … 193 193 194 194 // If so and the event really comes from its parent ... 195 if (isOnEmulatedText(p. x, p.y)) {195 if (isOnEmulatedText(p.getX(), p.getY())) { 196 196 197 197 int yOffset = -6; … … 207 207 208 208 if (newMouse != null) { 209 EcosystemManager.getInputManager().setCursorPosition(new Point((int) newMouse. x, (int) newMouse.y+ yOffset));209 EcosystemManager.getInputManager().setCursorPosition(new Point((int) newMouse.getX(), (int) newMouse.getY() + yOffset)); 210 210 } 211 211 … … 241 241 242 242 // If so and the event really comes from its parent ... 243 if (isOnEmulatedText(p. x, p.y)) {243 if (isOnEmulatedText(p.getX(), p.getY())) { 244 244 245 245 String toMoveIntoFreespace = null; … … 267 267 if (target != null) { 268 268 Text selectionCopy = new Text(target.getNextItemID(), toMoveIntoFreespace); 269 selectionCopy.setPosition(p. x, p.y);269 selectionCopy.setPosition(p.getX(), p.getY()); 270 270 selectionCopy.setSize(emulatedSource.getSize()); 271 271 StandardGestureActions.pickup(selectionCopy); … … 290 290 291 291 // If so and the event really comes from its parent ... 292 if (isOnEmulatedText(p. x, p.y)) {292 if (isOnEmulatedText(p.getX(), p.getY())) { 293 293 294 294 emulatedSource.clearSelection(); 295 emulatedSource.setSelectionStart(p. x, p.y, e.getButton());295 emulatedSource.setSelectionStart(p.getX(), p.getY(), e.getButton()); 296 296 297 297 repaint(); … … 313 313 314 314 // If so and the event really comes from its parent ... 315 if (isOnEmulatedText(p. x, p.y)) {315 if (isOnEmulatedText(p.getX(), p.getY())) { 316 316 317 317 EcosystemManager.getGraphicsManager().setCursor(new Cursor(Cursor.CursorType.TEXT)); 318 318 319 emulatedSource.setSelectionEnd(p. x, p.y);319 emulatedSource.setSelectionEnd(p.getX(), p.getY()); 320 320 repaint(); 321 321 -
trunk/src/org/apollo/widgets/LinkedTrack.java
r1102 r1142 1814 1814 if (y < 0) { 1815 1815 y = LinkedTrack.this.getY() + LinkedTrack.this.getHeight() + 2; 1816 animationSource.getTopLeft(). y = y - 2;1816 animationSource.getTopLeft().setY(y - 2); 1817 1817 } 1818 1818 -
trunk/src/org/apollo/widgets/SampledTrack.java
r1102 r1142 1274 1274 ((Graphics2D)g).setStroke(EditableSampledTrackGraphView.GRAPH_BAR_STROKE); 1275 1275 g.drawLine( 1276 containerPoint. x+ me.getX(),1277 containerPoint. y,1278 containerPoint. x+ me.getX(),1279 containerPoint. y+ me.getComponent().getHeight());1276 containerPoint.getX() + me.getX(), 1277 containerPoint.getY(), 1278 containerPoint.getX() + me.getX(), 1279 containerPoint.getY() + me.getComponent().getHeight()); 1280 1280 1281 1281 DisplayController.invalidateArea(new AxisAlignedBoxBounds( 1282 containerPoint. x+ me.getX(),1283 containerPoint. y,1282 containerPoint.getX() + me.getX(), 1283 containerPoint.getY(), 1284 1284 1, 1285 containerPoint. y+ me.getComponent().getHeight() + 1));1285 containerPoint.getY() + me.getComponent().getHeight() + 1)); 1286 1286 1287 1287 // Restore clip -
trunk/src/org/expeditee/actions/Debug.java
r1134 r1142 19 19 package org.expeditee.actions; 20 20 21 import java.awt. AWTException;21 import java.awt.Graphics; 22 22 import java.awt.Robot; 23 23 import java.util.List; 24 24 import java.util.concurrent.TimeUnit; 25 26 import javax.swing.JFrame; 27 import javax.swing.JPanel; 25 28 26 29 import org.expeditee.gio.swing.SwingGraphicsManager; … … 68 71 } 69 72 73 @SuppressWarnings("serial") 74 public static void GraphicsTranslateTest() { 75 final JFrame f = new JFrame(); 76 f.setContentPane(new JPanel() { 77 public void paintComponent(Graphics g) { 78 final int pos = 10; 79 final int size = 100; 80 int translate = 10; 81 for(int i = 0; i < 5; i++) { 82 g.translate(translate, translate); 83 g.drawRect(pos, pos, size, size); 84 g.translate(-translate, -translate); 85 } 86 } 87 }); 88 f.setSize(400, 400); 89 f.setVisible(true); 90 } 91 70 92 public static void RobotTest() { 71 93 try { -
trunk/src/org/expeditee/actions/Misc.java
r1111 r1142 997 997 if (text.isFloating()) { 998 998 Point cursorPos = EcosystemManager.getInputManager().getCursorPosition(); 999 text.setPosition(cursorPos. x, cursorPos.y);999 text.setPosition(cursorPos.getX(), cursorPos.getY()); 1000 1000 StandardGestureActions.resetOffset(); 1001 1001 } else { … … 1084 1084 1085 1085 Point cursorPos = DisplayController.getMousePosition(); 1086 float curX = cursorPos. x;1087 float curY = cursorPos. y;1086 float curX = cursorPos.getX(); 1087 float curY = cursorPos.getY(); 1088 1088 1089 1089 Collection<Item> newItems = new LinkedList<Item>(); -
trunk/src/org/expeditee/actions/Simple.java
r1102 r1142 1129 1129 for (Text text : targetFrame.getTextItems()) { 1130 1130 Point startPoint = text.getPosition(); 1131 if (Math.abs(startPoint. y - endPoint.y) < 101132 && Math.abs(startPoint. x - endPoint.x) < 20) {1131 if (Math.abs(startPoint.getY() - endPoint.getY()) < 10 1132 && Math.abs(startPoint.getX() - endPoint.getX()) < 20) { 1133 1133 found = true; 1134 1134 valueItem = text; … … 1380 1380 for (Text text : targetFrame.getTextItems()) { 1381 1381 Point startPoint = text.getPosition(); 1382 if (Math.abs(startPoint. y - endPoint.y) < 101383 && Math.abs(startPoint. x - endPoint.x) < 20) {1382 if (Math.abs(startPoint.getY() - endPoint.getY()) < 10 1383 && Math.abs(startPoint.getX() - endPoint.getX()) < 20) { 1384 1384 found = true; 1385 1385 valueItem = text; … … 1591 1591 Point pos = ((Item) context.getPointers().getVariable( 1592 1592 tokens[1]).getValue()).getPosition(); 1593 Integer x = pos. x;1594 Integer y = pos. y;1593 Integer x = pos.getX(); 1594 Integer y = pos.getY(); 1595 1595 context.getPrimitives() 1596 1596 .setValue(tokens[2], new SInteger(x)); -
trunk/src/org/expeditee/agents/Sort.java
r1102 r1142 64 64 for (int i = 0; i < positions.size(); i++) 65 65 textItems.get(i) 66 .setPosition(positions.get(i). x, positions.get(i).y);66 .setPosition(positions.get(i).getX(), positions.get(i).getY()); 67 67 68 68 // items will need to be resorted after this -
trunk/src/org/expeditee/agents/SwitchyardTree.java
r1102 r1142 50 50 Text itemCopy = childItem.copy(); 51 51 // add to the right of parent item 52 lastItemEnd.set(lastItemEnd. x + 20, lastItemEnd.y);53 itemCopy.setPosition(lastItemEnd. x, lastItemEnd.y);52 lastItemEnd.set(lastItemEnd.getX() + 20, lastItemEnd.getY()); 53 itemCopy.setPosition(lastItemEnd.getX(), lastItemEnd.getY()); 54 54 lastItemEnd = itemCopy 55 55 .getParagraphEndPosition(); -
trunk/src/org/expeditee/agents/mail/MailSession.java
r1102 r1142 479 479 if (newItem != null) { 480 480 mailItems.add(newItem); 481 point. y += newItem.getBoundsHeight();481 point.setY(point.getY() + newItem.getBoundsHeight()); 482 482 messagesRead++; 483 483 } else { -
trunk/src/org/expeditee/core/Line.java
r1097 r1142 55 55 public int deltaX() 56 56 { 57 return _p2. x - _p1.x;57 return _p2.getX() - _p1.getX(); 58 58 } 59 59 … … 61 61 public int deltaY() 62 62 { 63 return _p2. y - _p1.y;63 return _p2.getY() - _p1.getY(); 64 64 } 65 65 … … 89 89 } else { 90 90 double u = ((double) numerator) / denominator; 91 return u >= 0 && u <= 1 && this.contains(new Point((int) (q. x + u * s.x), (int) (q.y + u * s.y)), error);91 return u >= 0 && u <= 1 && this.contains(new Point((int) (q.getX() + u * s.getX()), (int) (q.getY() + u * s.getY())), error); 92 92 } 93 93 } … … 98 98 private int crossLength(Point a, Point b) 99 99 { 100 return a. x * b.y - a.y * b.x;100 return a.getX() * b.getY() - a.getY() * b.getX(); 101 101 } 102 102 … … 174 174 } else { 175 175 double scaleFactor = projectionLength / lineLength; 176 return _p1.clone().add((_p2. x - _p1.x) * scaleFactor, (_p2.y - _p1.y) * scaleFactor);176 return _p1.clone().add((_p2.getX() - _p1.getX()) * scaleFactor, (_p2.getY() - _p1.getY()) * scaleFactor); 177 177 } 178 178 } -
trunk/src/org/expeditee/core/Point.java
r1097 r1142 2 2 3 3 /** 4 * Represents a (x,y)-coordinate in 2-dimensional space. 5 * Coordinates areintegral.4 * Represents a (x,y)-coordinate in 2-dimensional space. Coordinates are 5 * integral. 6 6 * 7 7 * @author cts16 8 8 */ 9 9 public class Point { 10 10 11 11 /** The origin of the coordinate system. */ 12 12 public static final Point ORIGIN = new Point(0, 0); 13 13 14 14 /** The x-coordinate of this point. */ 15 p ublicint x;15 private int x; 16 16 /** The y-coordinate of this point. */ 17 p ublicint y;18 17 private int y; 18 19 19 /** Default constructor creates a point at the origin. */ 20 public Point() 21 { 20 public Point() { 22 21 this(0, 0); 23 22 } 24 23 25 24 /** Standard constructor. */ 26 public Point(int x, int y) 27 { 25 public Point(int x, int y) { 28 26 set(x, y); 29 27 } 30 28 31 29 /** Convenience constructor automatically casts floats to ints. */ 32 public Point(float x, float y) 33 { 30 public Point(float x, float y) { 34 31 this((int) x, (int) y); 35 32 } 36 33 37 34 /** Copy constructor. */ 38 public Point(Point other) 39 { 35 public Point(Point other) { 40 36 this(); 41 37 set(other); 42 38 } 43 39 44 40 /** Sets the position of the point. */ 45 public Point set(int x, int y) 46 { 47 this.x = x; 48 this.y = y; 49 return this; 50 } 51 52 /** Sets the position of this point to be the same as the given point. 53 If p is null, no change is made. */ 54 public Point set(Point p) 55 { 56 if (p != null) set(p.x, p.y); 57 return this; 58 } 59 41 public Point set(int x, int y) { 42 this.setX(x); 43 this.setY(y); 44 return this; 45 } 46 47 /** 48 * Sets the position of this point to be the same as the given point. If p is 49 * null, no change is made. 50 */ 51 public Point set(Point p) { 52 if (p != null) 53 set(p.getX(), p.getY()); 54 return this; 55 } 56 60 57 /** Moves the point by the given amount in each dimension. */ 61 public Point add(int x, int y) 62 {63 this. x += x;64 this.y += y;65 return this;66 } 67 68 /** Moves the point by the given amount in each dimension.69 Doubles are automatically cast to ints. */70 public Point add(double x, double y)71 {58 public Point add(int x, int y) { 59 this.setX(this.getX() + x); 60 this.setY(this.getY() + y); 61 return this; 62 } 63 64 /** 65 * Moves the point by the given amount in each dimension. Doubles are 66 * automatically cast to ints. 67 */ 68 public Point add(double x, double y) { 72 69 return add((int) x, (int) y); 73 70 } 74 75 /** Adds the coordinates of the given point to this point's coordinates 76 (treating points as vectors). */ 77 public Point add(Point p) 78 { 79 if (p != null) add(p.x, p.y); 80 return this; 81 } 82 71 72 /** 73 * Adds the coordinates of the given point to this point's coordinates (treating 74 * points as vectors). 75 */ 76 public Point add(Point p) { 77 if (p != null) 78 add(p.getX(), p.getY()); 79 return this; 80 } 81 83 82 /** 84 83 * Rotates this point around another point. 85 84 * 86 85 * @param angle 87 * 86 * The angle to rotate through (clockwise, in radians). 88 87 * 89 88 * @param x 90 * 89 * The x-coordinate of the centre of rotation. 91 90 * 92 91 * @param y 93 * The y-coordinate of the centre of rotation. 94 */ 95 public Point rotate(double angle, int x, int y) 96 { 92 * The y-coordinate of the centre of rotation. 93 */ 94 public Point rotate(double angle, int x, int y) { 97 95 // Find the distance from this point to the centre of rotation 98 96 // (should stay the same during rotation) 99 double length = Point.distanceBetween(x, y, this. x, this.y);100 97 double length = Point.distanceBetween(x, y, this.getX(), this.getY()); 98 101 99 // Find the starting elevation angle of this point relative to 102 100 // the centre of rotation. 103 double startingAngle = Math.atan2(this. y - y, this.x- x);104 105 // Increase/decrease the elevation angle by the given amount 101 double startingAngle = Math.atan2(this.getY() - y, this.getX() - x); 102 103 // Increase/decrease the elevation angle by the given amount 106 104 double finalAngle = startingAngle + angle; 107 105 108 106 // Calculate the point at the same distance from the centre of rotation 109 107 // elevated at the new angle. 110 this. x = (int) (x + length * Math.cos(finalAngle));111 this. y = (int) (y + length * Math.sin(finalAngle));112 113 return this; 114 } 115 108 this.setX((int) (x + length * Math.cos(finalAngle))); 109 this.setY((int) (y + length * Math.sin(finalAngle))); 110 111 return this; 112 } 113 116 114 /** 117 115 * Rotates this point around another point. 118 116 * 119 117 * @param angle 120 * 118 * The angle to rotate through (clockwise, in radians). 121 119 * 122 120 * @param cor 123 * 124 */ 125 public Point rotate(double angle, Point cor) 126 {127 if (cor != null) rotate(angle, cor.x, cor.y);128 return this; 129 } 130 121 * The centre of rotation. 122 */ 123 public Point rotate(double angle, Point cor) { 124 if (cor != null) 125 rotate(angle, cor.getX(), cor.getY()); 126 return this; 127 } 128 131 129 /** Gets the distance from this point to another point. */ 132 public double getDistanceTo(Point other) 133 { 130 public double getDistanceTo(Point other) { 134 131 return distanceBetween(this, other); 135 132 } 136 133 137 134 /** Gets the distance between two points. */ 138 public static double distanceBetween(Point p1, Point p2) 139 {140 if (p1 == null || p2 == null)return 0.0;141 142 return distanceBetween(p1. x, p1.y, p2.x, p2.y);135 public static double distanceBetween(Point p1, Point p2) { 136 if (p1 == null || p2 == null) 137 return 0.0; 138 139 return distanceBetween(p1.getX(), p1.getY(), p2.getX(), p2.getY()); 143 140 } 144 141 145 142 /** Gets the distance between two points specified by their coordinates. */ 146 public static double distanceBetween(int x1, int y1, int x2, int y2) 147 { 143 public static double distanceBetween(int x1, int y1, int x2, int y2) { 148 144 double x = x1 - x2; 149 145 double y = y1 - y2; 150 146 return Math.sqrt(x * x + y * y); 151 147 } 152 148 153 149 @Override 154 public boolean equals(Object other) 155 { 150 public boolean equals(Object other) { 156 151 if (other instanceof Point) { 157 152 Point p = (Point) other; 158 return this. x == p.x && this.y == p.y;153 return this.getX() == p.getX() && this.getY() == p.getY(); 159 154 } 160 155 return false; … … 162 157 163 158 /** Gets the x-coordinate of this point. */ 164 public int getX() 165 { 159 public int getX() { 166 160 return x; 167 161 } 168 162 169 163 /** Gets the y-coordinate of this point. */ 170 public int getY() 171 { 164 public int getY() { 172 165 return y; 173 166 } 174 167 175 168 @Override 176 public Point clone() 177 { 169 public Point clone() { 178 170 return new Point(this); 179 171 } 180 181 /** Gets a point representing the difference between the two given points 182 (returned point should be treated as a vector). */ 183 public static Point difference(Point p1, Point p2) 184 { 185 if (p1 == null || p2 == null) return null; 186 return new Point(p1.x - p2.x, p1.y - p2.y); 187 } 188 172 173 /** 174 * Gets a point representing the difference between the two given points 175 * (returned point should be treated as a vector). 176 */ 177 public static Point difference(Point p1, Point p2) { 178 if (p1 == null || p2 == null) 179 return null; 180 return new Point(p1.getX() - p2.getX(), p1.getY() - p2.getY()); 181 } 182 189 183 /** Calculates the dot-product between two lines that share a common point. */ 190 public static double dotProduct(Point commonPoint, Point lineEnd1, Point lineEnd2) 191 {192 if (commonPoint == null || lineEnd1 == null || lineEnd2 == null)return 0.0;193 194 Point p1 = new Point(lineEnd1. x - commonPoint.x, lineEnd1.y - commonPoint.y);195 Point p2 = new Point(lineEnd2. x - commonPoint.x, lineEnd2.y - commonPoint.y);196 return p1. x * p2.x + p1.y * p2.y;197 } 198 184 public static double dotProduct(Point commonPoint, Point lineEnd1, Point lineEnd2) { 185 if (commonPoint == null || lineEnd1 == null || lineEnd2 == null) 186 return 0.0; 187 188 Point p1 = new Point(lineEnd1.getX() - commonPoint.getX(), lineEnd1.getY() - commonPoint.getY()); 189 Point p2 = new Point(lineEnd2.getX() - commonPoint.getX(), lineEnd2.getY() - commonPoint.getY()); 190 return p1.getX() * p2.getX() + p1.getY() * p2.getY(); 191 } 192 199 193 @Override 200 public String toString() 201 { 202 return "(" + x + ", " + y + ")"; 194 public String toString() { 195 return "(" + getX() + ", " + getY() + ")"; 196 } 197 198 public void setY(int y) { 199 this.y = y; 200 } 201 202 public void setX(int x) { 203 this.x = x; 203 204 } 204 205 } -
trunk/src/org/expeditee/core/bounds/AxisAlignedBoxBounds.java
r1097 r1142 107 107 public int getCentreX() 108 108 { 109 return _topLeft. x+ _size.width / 2;109 return _topLeft.getX() + _size.width / 2; 110 110 } 111 111 … … 113 113 public int getCentreY() 114 114 { 115 return _topLeft. y+ _size.height / 2;115 return _topLeft.getY() + _size.height / 2; 116 116 } 117 117 … … 167 167 public boolean contains(int x, int y) 168 168 { 169 return (x >= _topLeft. x&&170 x < (_topLeft. x+ _size.width) &&171 y >= _topLeft. y&&172 y < (_topLeft. y+ _size.height));169 return (x >= _topLeft.getX() && 170 x < (_topLeft.getX() + _size.width) && 171 y >= _topLeft.getY() && 172 y < (_topLeft.getY() + _size.height)); 173 173 } 174 174 … … 176 176 public int getMaxX() 177 177 { 178 return _topLeft. x+ _size.width - 1;178 return _topLeft.getX() + _size.width - 1; 179 179 } 180 180 … … 182 182 public int getMinX() 183 183 { 184 return _topLeft. x;184 return _topLeft.getX(); 185 185 } 186 186 … … 188 188 public int getMaxY() 189 189 { 190 return _topLeft. y+ _size.height - 1;190 return _topLeft.getY() + _size.height - 1; 191 191 } 192 192 … … 194 194 public int getMinY() 195 195 { 196 return _topLeft. y;196 return _topLeft.getY(); 197 197 } 198 198 -
trunk/src/org/expeditee/core/bounds/Bounds.java
r1097 r1142 26 26 public boolean contains(Point p) 27 27 { 28 return contains(p. x, p.y);28 return contains(p.getX(), p.getY()); 29 29 } 30 30 -
trunk/src/org/expeditee/core/bounds/EllipticalBounds.java
r1097 r1142 76 76 77 77 // Get the position of the given coordinates with respect to the ellipse centre 78 Point pRel = new Point(x - _centre. x, y - _centre.y);78 Point pRel = new Point(x - _centre.getX(), y - _centre.getY()); 79 79 80 80 // x^2 / r_x^2 + y^2 / r_y^2 must be <= 1 81 81 // (using diameters instead of radii hence the 4.0f value) 82 float xNorm = (((float) pRel. x) * pRel.x) / (((float) _diameters.width) * _diameters.width);83 float yNorm = (((float) pRel. y) * pRel.y) / (((float) _diameters.height) * _diameters.height);82 float xNorm = (((float) pRel.getX()) * pRel.getX()) / (((float) _diameters.width) * _diameters.width); 83 float yNorm = (((float) pRel.getY()) * pRel.getY()) / (((float) _diameters.height) * _diameters.height); 84 84 return (xNorm + yNorm <= 4.0f); 85 85 } … … 88 88 public int getMaxX() 89 89 { 90 return _centre. x+ (_diameters.width / 2 + _diameters.width % 2);90 return _centre.getX() + (_diameters.width / 2 + _diameters.width % 2); 91 91 } 92 92 … … 94 94 public int getMinX() 95 95 { 96 return _centre. x-(_diameters.width / 2 + _diameters.width % 2);96 return _centre.getX() -(_diameters.width / 2 + _diameters.width % 2); 97 97 } 98 98 … … 100 100 public int getMaxY() 101 101 { 102 return _centre. y+ (_diameters.height / 2 + _diameters.height % 2);102 return _centre.getY() + (_diameters.height / 2 + _diameters.height % 2); 103 103 } 104 104 … … 106 106 public int getMinY() 107 107 { 108 return _centre. y- (_diameters.height / 2 + _diameters.height % 2);108 return _centre.getY() - (_diameters.height / 2 + _diameters.height % 2); 109 109 } 110 110 … … 256 256 257 257 Point pRel = Point.difference(p, _centre); 258 return Math.atan2(pRel. y, pRel.x);258 return Math.atan2(pRel.getY(), pRel.getX()); 259 259 } 260 260 … … 269 269 double r_y = _diameters.height / 2.0; 270 270 Point lineStartRel = Point.difference(line.getFirstEnd(), _centre); 271 double x_0 = lineStartRel. x;272 double y_0 = lineStartRel. y;271 double x_0 = lineStartRel.getX(); 272 double y_0 = lineStartRel.getY(); 273 273 double x_d = line.deltaX(); 274 274 double y_d = line.deltaY(); -
trunk/src/org/expeditee/core/bounds/PolygonBounds.java
r1097 r1142 61 61 public void addPoint(Point p) 62 62 { 63 addPoint(p. x, p.y);63 addPoint(p.getX(), p.getY()); 64 64 } 65 65 … … 142 142 public void rotate(double angle, Point cor) 143 143 { 144 rotate(angle, cor. x, cor.y);144 rotate(angle, cor.getX(), cor.getY()); 145 145 } 146 146 … … 159 159 int hits = 0; 160 160 161 int lastx = _points.get(npoints - 1). x;162 int lasty = _points.get(npoints - 1). y;161 int lastx = _points.get(npoints - 1).getX(); 162 int lasty = _points.get(npoints - 1).getY(); 163 163 int curx, cury; 164 164 165 165 // Walk the edges of the polygon 166 166 for (int i = 0; i < npoints; lastx = curx, lasty = cury, i++) { 167 curx = _points.get(i). x;168 cury = _points.get(i). y;167 curx = _points.get(i).getX(); 168 cury = _points.get(i).getY(); 169 169 170 170 if (cury == lasty) { … … 379 379 Point p1 = _points.get(i); 380 380 Point p2 = _points.get((i + 1) % _points.size()); 381 area += p1. x * p2.y - p2.x * p1.y;381 area += p1.getX() * p2.getY() - p2.getX() * p1.getY(); 382 382 } 383 383 … … 500 500 if (ellipse == null || nSegments < 3) return null; 501 501 502 int centreX = ellipse.getCentre(). x;503 int centreY = ellipse.getCentre(). y;502 int centreX = ellipse.getCentre().getX(); 503 int centreY = ellipse.getCentre().getY(); 504 504 double xRadius = ellipse.getDiameters().width / 2.0; 505 505 double yRadius = ellipse.getDiameters().height / 2.0; … … 532 532 533 533 for (Point p : _points) { 534 if (_maxX == null || p. x > _maxX.intValue()) _maxX = new Integer(p.x);535 if (_minX == null || p. x < _minX.intValue()) _minX = new Integer(p.x);536 if (_maxY == null || p. y > _maxY.intValue()) _maxY = new Integer(p.y);537 if (_minY == null || p. y < _minY.intValue()) _minY = new Integer(p.y);534 if (_maxX == null || p.getX() > _maxX.intValue()) _maxX = new Integer(p.getX()); 535 if (_minX == null || p.getX() < _minX.intValue()) _minX = new Integer(p.getX()); 536 if (_maxY == null || p.getY() > _maxY.intValue()) _maxY = new Integer(p.getY()); 537 if (_minY == null || p.getY() < _minY.intValue()) _minY = new Integer(p.getY()); 538 538 } 539 539 } -
trunk/src/org/expeditee/gio/DragAndDropManager.java
r1097 r1142 109 109 110 110 if (lastItem == null) { 111 currentPoint. y += 30;111 currentPoint.setY(currentPoint.getY() + 30); 112 112 } else { 113 currentPoint. y += lastItem.getBoundsHeight();113 currentPoint.setY(currentPoint.getY() + lastItem.getBoundsHeight()); 114 114 } 115 115 // of the item that was created -
trunk/src/org/expeditee/gio/GraphicsManager.java
r1097 r1142 240 240 if (p1 == null || p2 == null) return; 241 241 242 drawLine(p1. x, p1.y, p2.x, p2.y, colour, stroke);242 drawLine(p1.getX(), p1.getY(), p2.getX(), p2.getY(), colour, stroke); 243 243 } 244 244 -
trunk/src/org/expeditee/gio/GraphicsSurfaceStack.java
r1097 r1142 10 10 /** 11 11 * Helper-class for the graphics manager to maintain a stack of drawing 12 * surfaces. Should be sub-typed by the platform-specific graphics manager 13 * touse the appropriate surface class.12 * surfaces. Should be sub-typed by the platform-specific graphics manager to 13 * use the appropriate surface class. 14 14 */ 15 15 public abstract class GraphicsSurfaceStack<T> { … … 31 31 /** The clip-stack for each drawing surface. */ 32 32 private Stack<EnforcedClipStack> _clipStackStack; 33 33 34 34 /** Constructor specifying no root surface. */ 35 public GraphicsSurfaceStack() 36 { 35 public GraphicsSurfaceStack() { 37 36 this(null); 38 37 } 39 38 40 39 /** Constructor specifying the root surface. */ 41 public GraphicsSurfaceStack(T rootSurface) 42 { 40 public GraphicsSurfaceStack(T rootSurface) { 43 41 setRootSurface(rootSurface); 44 42 _currentImage = null; … … 48 46 _clipStackStack = new Stack<EnforcedClipStack>(); 49 47 } 50 51 /** Should be overridden by sub-types to allow a drawing surface to be extracted from an image. */ 48 49 /** 50 * Should be overridden by sub-types to allow a drawing surface to be extracted 51 * from an image. 52 */ 52 53 public abstract T getSurfaceFromImage(Image image); 53 54 /** Should be overridden by sub-types to set the actual clip on a given surface. */ 54 55 /** 56 * Should be overridden by sub-types to set the actual clip on a given surface. 57 */ 55 58 public abstract void setSurfaceClip(T surface, Clip clip); 56 57 /** Pushes a new image onto the stack, and sets it as the current drawing surface. */ 58 public void push(Image image) 59 { 60 if (image == null) return; 61 59 60 /** 61 * Pushes a new image onto the stack, and sets it as the current drawing 62 * surface. 63 */ 64 public void push(Image image) { 65 if (image == null) 66 return; 67 62 68 _currentSurface = getSurfaceFromImage(image); 63 69 _currentImage = image; … … 67 73 _clipStackStack.push(_currentClipStack); 68 74 } 69 70 /** Removes an image from the stack. The removed image is returned, or null if the root surface was current. */ 71 public Image pop() 72 { 73 if (_surfaceStack.isEmpty()) return null; 74 75 76 /** 77 * Removes an image from the stack. The removed image is returned, or null if 78 * the root surface was current. 79 */ 80 public Image pop() { 81 if (_surfaceStack.isEmpty()) 82 return null; 83 75 84 Image oldTop = _imageStack.pop(); 76 85 _surfaceStack.pop(); 77 86 _clipStackStack.pop(); 78 87 79 88 if (!_surfaceStack.isEmpty()) { 80 89 _currentSurface = _surfaceStack.peek(); … … 86 95 _currentClipStack = _rootClipStack; 87 96 } 88 97 89 98 return oldTop; 90 99 } 91 100 92 101 /** Gets a reference to the current drawing surface. */ 93 public T getCurrentSurface() 94 { 102 public T getCurrentSurface() { 95 103 return _currentSurface; 96 104 } 97 105 98 106 /** Gets a reference to the top image on the stack. */ 99 public Image getCurrentImage() 100 { 107 public Image getCurrentImage() { 101 108 return _currentImage; 102 109 } 103 104 /** Pushes a new clip onto the stack, ensuring that it is a sub-area of the top of the stack. */ 105 public EnforcedClipKey pushClip(Clip clip) 106 { 110 111 /** 112 * Pushes a new clip onto the stack, ensuring that it is a sub-area of the top 113 * of the stack. 114 */ 115 public EnforcedClipKey pushClip(Clip clip) { 107 116 EnforcedClipKey key = _currentClipStack.push(clip); 108 if (key != null) ensureClip(); 117 if (key != null) 118 ensureClip(); 109 119 return key; 110 120 } 111 112 /** Pops the top of the current clip-stack if there given key corresponds to it. */ 113 public Clip popClip(EnforcedClipKey key) 114 { 121 122 /** 123 * Pops the top of the current clip-stack if there given key corresponds to it. 124 */ 125 public Clip popClip(EnforcedClipKey key) { 115 126 Clip clip = _currentClipStack.pop(key); 116 if (clip != null) ensureClip(); 127 if (clip != null) 128 ensureClip(); 117 129 return clip; 118 130 } 119 131 120 132 /** Returns a copy of the top of the current clip-stack. */ 121 public Clip peekClip() 122 { 133 public Clip peekClip() { 123 134 return _currentClipStack.peek(); 124 135 } 125 136 126 137 /** Ensures the current clip is applied to the underlying surface. */ 127 public void ensureClip() 128 { 138 public void ensureClip() { 129 139 setSurfaceClip(_currentSurface, _currentClipStack.peek()); 130 140 } 131 141 132 142 /** Updates the root surface. Does not affect any stacked image surfaces. */ 133 public void setRootSurface(T rootSurface) 134 {135 if (_currentSurface == _rootSurface)_currentSurface = rootSurface;143 public void setRootSurface(T rootSurface) { 144 if (_currentSurface == _rootSurface) 145 _currentSurface = rootSurface; 136 146 _rootSurface = rootSurface; 137 147 138 148 } 139 149 } -
trunk/src/org/expeditee/gio/TextLayoutManager.java
r1097 r1142 17 17 public List<TextLayout> layoutStringRelative(String string, Font font, int widthLimit, int lineSpacing, boolean dontBreakWords, boolean fullJustify) 18 18 { 19 return layoutString(string, font, Point.ORIGIN , null, widthLimit, lineSpacing, dontBreakWords, fullJustify);19 return layoutString(string, font, Point.ORIGIN.clone(), null, widthLimit, lineSpacing, dontBreakWords, fullJustify); 20 20 } 21 21 … … 71 71 for(Line l : lines) { 72 72 // check for lines that cross over our y 73 if((l.getFirstEnd(). y >= p.y && l.getSecondEnd().y <= p.y) || (l.getFirstEnd().y <= p.y && l.getSecondEnd().y >= p.y)) {74 float dX = l.getFirstEnd(). x - l.getSecondEnd().x;75 float dY = l.getFirstEnd(). y - l.getSecondEnd().y;73 if((l.getFirstEnd().getY() >= p.getY() && l.getSecondEnd().getY() <= p.getY()) || (l.getFirstEnd().getY() <= p.getY() && l.getSecondEnd().getY() >= p.getY())) { 74 float dX = l.getFirstEnd().getX() - l.getSecondEnd().getX(); 75 float dY = l.getFirstEnd().getY() - l.getSecondEnd().getY(); 76 76 float newWidth; 77 77 if(dX == 0) { 78 newWidth = l.getFirstEnd(). x;78 newWidth = l.getFirstEnd().getX(); 79 79 } else if(dY == 0) { 80 newWidth = Math.min(l.getFirstEnd(). x, l.getSecondEnd().x);80 newWidth = Math.min(l.getFirstEnd().getX(), l.getSecondEnd().getX()); 81 81 } else { 82 newWidth = l.getFirstEnd(). x + (p.y - l.getFirstEnd().y) * dX / dY;82 newWidth = l.getFirstEnd().getX() + (p.getY() - l.getFirstEnd().getY()) * dX / dY; 83 83 } 84 if(newWidth < p. x) {84 if(newWidth < p.getX()) { 85 85 continue; 86 86 } … … 90 90 } 91 91 } 92 return width - p. x;92 return width - p.getX(); 93 93 } 94 94
Note:
See TracChangeset
for help on using the changeset viewer.