Changeset 21 for trunk/src/org/expeditee/items/Dot.java
- Timestamp:
- 05/08/08 14:30:09 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/items/Dot.java
r7 r21 3 3 import java.awt.Graphics2D; 4 4 import java.awt.Polygon; 5 import java.awt.Rectangle; 5 6 import java.util.ArrayList; 6 7 import java.util.LinkedList; 7 8 import java.util.List; 9 10 import org.expeditee.gui.Frame; 8 11 9 12 /** … … 19 22 // Standard Item variables 20 23 24 private static final int _MINIMUM_DOT_SIZE = 6; 25 21 26 // contains all dots (including this one) that form an enclosure 22 27 // if this dot is part of an enclosing shape … … 32 37 33 38 private boolean _filled = true; 34 39 35 40 protected boolean _filledHighlight = false; 36 41 … … 108 113 @Override 109 114 public void paint(Graphics2D g) { 110 if (isHighlighted() ) {115 if (isHighlighted() /* && !Frame.FreeItems.contains(this) */) { 111 116 g.setColor(getHighlightColor()); 112 117 // Draw the highlighting rectangle surrounding the dot 113 118 // this is drawn even if its part of a rectangle 114 if (_filledHighlight) 115 g.fillPolygon(getPolygon()); 116 else 117 g.drawPolygon(getPolygon()); 119 Rectangle rect = getPolygon().getBounds(); 120 if (_mode == SelectedMode.Enclosed || 121 // Make sure single dots are highlighted filled 122 this.getConnected().size() <= 1) 123 g.fillRect(rect.x, rect.y, rect.width, rect.height); 124 else if (_mode == SelectedMode.Connected) 125 g.drawRect(rect.x, rect.y, rect.width, rect.height); 126 else if (_mode == SelectedMode.Normal) { 127 g.fillOval(rect.x, rect.y, rect.width, rect.height); 128 } 129 //System.out.println(_mode.toString()); 118 130 } 119 131 … … 129 141 130 142 int width = thick / 2; 131 132 // if(_thickness < 1)133 /*134 * if(_filled) g.fillRect(getX(), getY(), thick,thick); else135 * g.drawRect(getX(), getY(), thick,thick); else136 */137 143 138 144 if (_pointType == Item.POINTTYPE_CIRCLE) { … … 168 174 int thick = (int) Math.ceil(getThickness()); 169 175 // Sets a minimum size for the dot 170 thick = Math.max(thick, 10);176 thick = Math.max(thick, _MINIMUM_DOT_SIZE); 171 177 172 178 int x = getX() - thick / 2; … … 205 211 206 212 @Override 207 public int s howHighlight(boolean val) {208 super.s howHighlight(val);213 public int setSelectionColor() { 214 super.setSelectionColor(); 209 215 210 216 return Item.DEFAULT_CURSOR; … … 353 359 return "P " + getID(); 354 360 } 355 361 356 362 @Override 357 363 public void setFilledHighlight(boolean value) { 358 364 _filledHighlight = value; 359 365 } 360 366 361 367 @Override 362 368 public void delete() { 363 369 super.delete(); 364 365 for (Line l: this.getLines())370 371 for (Line l : this.getLines()) 366 372 l.delete(); 367 373 }
Note:
See TracChangeset
for help on using the changeset viewer.