Inheritance diagram for ActiveCanvas::

Public Methods | |
| ActiveCanvas () | |
| ActiveCanvas (Dimension d) | |
| ActiveCanvas (int layers) | |
| ActiveCanvas (Dimension d, int layers) | |
| ActiveCanvas (Dimension d, boolean fixedSize, int layers, int checkMode) | |
| int | getMode () |
| Get the viewer mode (see class ViewerMode). More... | |
| int | getSubMode () |
| Get the viewer sub-mode (see class ViewerMode). More... | |
| void | setMode (int mode, int subMode) |
| Set the viewer mode (see class ViewerMode). More... | |
| void | setCanvasInspectionUser (CanvasInspectionUser user) |
| void | handleMousePress (MouseEvent e) |
| Interface for MouseListener events, called by LayeredCanvasPane. More... | |
| void | handleMouseEnter (MouseEvent e) |
| void | handleMouseExit (MouseEvent e) |
| void | handleMouseMove (MouseEvent e) |
| Interface for MouseMotionListener events, called by LayeredCanvasPane. More... | |
Static Public Attributes | |
| final int | CLOSENESS = 0 |
| final int | INCLUSION = 1 |
Protected Attributes | |
| double | lastX = -1.0 |
| double | lastY = -1.0 |
| int | lastLayer = -1 |
| int | lastIndex = -1 |
| int | checkMode = CLOSENESS |
|
|
00035 {
00036 this(new Dimension(MIN_SIZE, MIN_SIZE), MIN_LAYERS);
00037 }
|
|
|
00041 {
00042 this(d, MIN_LAYERS);
00043 }
|
|
|
|
|
||||||||||||
|
00053 {
00054 super(d, false, layers);
00055 }
|
|
||||||||||||||||||||
|
|
|
|
Get the viewer mode (see class ViewerMode).
Reimplemented in ScribbleCanvas.
00074 {
00075 return -1;
00076 }
|
|
|
Get the viewer sub-mode (see class ViewerMode).
Reimplemented in ScribbleCanvas.
00082 {
00083 return -1;
00084 }
|
|
||||||||||||
|
Set the viewer mode (see class ViewerMode).
Reimplemented in ScribbleCanvas.
00090 {
00091 // ignore
00092 }
|
|
|
00095 {
00096 _inspUser = user;
00097 }
|
|
|
Interface for MouseListener events, called by LayeredCanvasPane.
Reimplemented from IcsCanvas. Reimplemented in ScribbleCanvas.
00104 {
00105 if (DEBUG_EVENTS)
00106 OutputStreamArea.println("AC handleMousePress (" + getID() + "): " + e.getPoint());
00107 // Convert mouse position from Canvas CS to Image CS
00108
00109 int[] ccs_vals = new int[] { e.getX(), e.getY() };
00110 double[] ics_vals = Converter.CCStoICS(ccs_vals, getZoomFactor());
00111
00112 double x = ics_vals[0];
00113 double y = ics_vals[1];
00114 lastLayer = -1;
00115 lastIndex = -1;
00116 boolean check = false;
00117
00118 // Check all layers for CanvasObjects
00119
00120 lastX = x;
00121 lastY = y;
00122 int ID = -1;
00123 CanvasObject cObj = null;
00124
00125 for (int i=nrOfLayers-1; i>=0; i--) {
00126 if (!isEnabled(i)) {
00127 continue;
00128 }
00129 Vector objs = _repository.getAllObjectsAt(i);
00130 for (int j=objs.size()-1; j>=0; j--) {
00131 cObj = (CanvasObject) objs.elementAt(j);
00132 if (checkMode == INCLUSION) {
00133 check = cObj.isInsideCcs(e.getX(), e.getY());
00134 } else {
00135 check = cObj.isNearCcs(e.getX(), e.getY());
00136 }
00137
00138 if (check) {
00139 lastLayer = i;
00140 lastIndex = j;
00141 ID = _repository.getObjectID(i, j);
00142 break;
00143 }
00144 }
00145 if (check) {
00146 break;
00147 }
00148 }
00149
00150 if (lastLayer != -1) {
00151 if (_inspUser != null)
00152 _inspUser.objectSelected(this, cObj, ID, x, y);
00153 } else {
00154 if (_inspUser != null)
00155 _inspUser.canvasSelected(this, x, y);
00156 }
00157 }
|
|
|
Reimplemented from IcsCanvas. Reimplemented in ScribbleCanvas.
00161 {
00162 if (DEBUG_EVENTS)
00163 OutputStreamArea.println("AC handleMouseEnter (" + getID() + "): " + e.getPoint());
00164 // Convert mouse position from Canvas CS to Image CS
00165
00166 int[] ccs_vals = new int[] { e.getX(), e.getY() };
00167 double[] ics_vals = Converter.CCStoICS(ccs_vals, getZoomFactor());
00168
00169 double x = ics_vals[0];
00170 double y = ics_vals[1];
00171
00172 lastX = x;
00173 lastY = y;
00174 lastLayer = -1;
00175 lastIndex = -1;
00176 if (_inspUser != null)
00177 _inspUser.canvasEntered(this, x, y);
00178 }
|
|
|
Reimplemented from IcsCanvas. Reimplemented in ScribbleCanvas.
00182 {
00183 if (DEBUG_EVENTS)
00184 OutputStreamArea.println("AC handleMouseExit (" + getID() + "): " + e.getPoint());
00185 lastX = -1.0;
00186 lastY = -1.0;
00187 lastLayer = -1;
00188 lastIndex = -1;
00189 if (_inspUser != null)
00190 _inspUser.canvasExited(this);
00191 }
|
|
|
Interface for MouseMotionListener events, called by LayeredCanvasPane.
Reimplemented from IcsCanvas. Reimplemented in ScribbleCanvas.
00195 {
00196 if (DEBUG_EVENTS)
00197 OutputStreamArea.println("AC handleMouseMove (" + getID() + "): " + e.getPoint());
00198 // Convert mouse position from Canvas CS to Image CS
00199
00200 int[] ccs_vals = new int[] { e.getX(), e.getY() };
00201 double[] ics_vals = Converter.CCStoICS(ccs_vals, getZoomFactor());
00202
00203 double x = ics_vals[0];
00204 double y = ics_vals[1];
00205 boolean check = false;
00206 CanvasObject cObj = null;
00207
00208 // Check all layers for CanvasObjects
00209
00210 for (int i=nrOfLayers-1; i>=0; i--) {
00211 if (!isEnabled(i)) {
00212 continue;
00213 }
00214 Vector objs = _repository.getAllObjectsAt(i);
00215 for (int j=objs.size()-1; j>=0; j--) {
00216 cObj = (CanvasObject) objs.elementAt(j);
00217 if (checkMode == INCLUSION) {
00218 check = cObj.isInsideCcs(e.getX(), e.getY());
00219 } else {
00220 check = cObj.isNearCcs(e.getX(), e.getY());
00221 }
00222
00223 if (check) {
00224 lastX = x;
00225 lastY = y;
00226 int ID = _repository.getObjectID(i, j);
00227 if (i == lastLayer && j == lastIndex) {
00228 if (_inspUser != null)
00229 _inspUser.objectProbed(this, cObj, ID, x, y);
00230 return;
00231 }
00232 lastLayer = i;
00233 lastIndex = j;
00234 if (_inspUser != null)
00235 _inspUser.objectEntered(this, cObj, ID, x, y);
00236 return;
00237 }
00238 }
00239 }
00240 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1.2.12 written by Dimitri van Heesch,
© 1997-2001