Static Public Methods | |
int | stringToMode (String name) |
Translate the given string to a viewer mode. More... | |
int | stringToDrawMode (String name) |
Translate the given string to a draw sub-mode. More... | |
int | stringToReshapeMode (String name) |
Translate the given string to a reshape sub-mode. More... | |
String[] | viewerSubModes () |
All sub-modes as array of strings. More... | |
int | stringToSubMode (String name) |
Translate the given string to a sub-mode. More... | |
Static Public Attributes | |
final int | SELECT = 0 |
Main viewer mode: select object. More... | |
final int | DRAW = 1 |
Main viewer mode: draw graphical object. More... | |
final int | MOVE = 2 |
Main viewer mode: move graphical object. More... | |
final int | COPY = 3 |
Main viewer mode: copy graphical object. More... | |
final int | RESIZE = 4 |
Main viewer mode: resize graphical object. More... | |
final int | RESHAPE = 5 |
Main viewer mode: reshape graphical object. More... | |
final int | DELETE = 6 |
Main viewer mode: delete object. More... | |
final int | DRAW_POINT = 100 |
Draw sub-mode: draw point. More... | |
final int | DRAW_LINE = 101 |
Draw sub-mode: draw line. More... | |
final int | DRAW_ARROW = 102 |
Draw sub-mode: draw arrow. More... | |
final int | DRAW_SQUARE = 103 |
Draw sub-mode: draw square. More... | |
final int | DRAW_RECTANGLE = 104 |
Draw sub-mode: draw rectangle. More... | |
final int | DRAW_CIRCLE = 105 |
Draw sub-mode: draw circle. More... | |
final int | DRAW_OVAL = 106 |
Draw sub-mode: draw oval. More... | |
final int | DRAW_POLYGON = 107 |
Draw sub-mode: draw polygon. More... | |
final int | DRAW_POLYLINE = 108 |
Draw sub-mode: draw polyline. More... | |
final int | DRAW_FREE_CLOSED = 109 |
Draw sub-mode: draw closed freehand. More... | |
final int | DRAW_FREE_OPEN = 110 |
Draw sub-mode: draw open freehand. More... | |
final int | DRAW_STRING = 111 |
Draw sub-mode: draw string. More... | |
final int | RESHAPE_MOVE_P = 500 |
Reshape sub-mode: move point. More... | |
final int | RESHAPE_DEL_P = 501 |
Reshape sub-mode: delete point. More... | |
final int | UNDEFINED = -1 |
No mode defined. More... | |
final String[] | viewerModes |
Main viewer modes as array of strings. More... | |
final String[] | drawModes |
Draw sub-modes as array of strings. More... | |
final String[] | reshapeModes |
Reshape sub-modes as array of strings. More... |
Some modes (draw, reshape) also have sub-modes. The modes are garanteed to start at 0 and to be consecutive. Sub-modes are garanteed to start at "mode*100" and to be consecutive.
|
Translate the given string to a viewer mode.
00126 { 00127 if (name.equals("Select")) 00128 return SELECT; 00129 if (name.equals("Draw")) 00130 return DRAW; 00131 if (name.equals("Move")) 00132 return MOVE; 00133 if (name.equals("Copy")) 00134 return COPY; 00135 if (name.equals("Resize")) 00136 return RESIZE; 00137 if (name.equals("Reshape")) 00138 return RESHAPE; 00139 if (name.equals("Delete")) 00140 return DELETE; 00141 return UNDEFINED; 00142 } |
|
Translate the given string to a draw sub-mode.
00148 { 00149 if (name.equals("Point")) 00150 return DRAW_POINT; 00151 if (name.equals("Line")) 00152 return DRAW_LINE; 00153 if (name.equals("Arrow")) 00154 return DRAW_ARROW; 00155 if (name.equals("Square")) 00156 return DRAW_SQUARE; 00157 if (name.equals("Rectangle")) 00158 return DRAW_RECTANGLE; 00159 if (name.equals("Circle")) 00160 return DRAW_CIRCLE; 00161 if (name.equals("Oval")) 00162 return DRAW_OVAL; 00163 if (name.equals("Polyline")) 00164 return DRAW_POLYLINE; 00165 if (name.equals("Polygon")) 00166 return DRAW_POLYGON; 00167 if (name.equals("Freehand Open")) 00168 return DRAW_FREE_OPEN; 00169 if (name.equals("Freehand Closed")) 00170 return DRAW_FREE_CLOSED; 00171 if (name.equals("String")) 00172 return DRAW_STRING; 00173 return UNDEFINED; 00174 } |
|
Translate the given string to a reshape sub-mode.
00180 { 00181 if (name.equals("Move Point")) 00182 return RESHAPE_MOVE_P; 00183 if (name.equals("Delete Point")) 00184 return RESHAPE_DEL_P; 00185 return UNDEFINED; 00186 } |
|
All sub-modes as array of strings.
00192 { 00193 int i, n; 00194 n = drawModes.length; 00195 n += reshapeModes.length; 00196 String[] res = new String[n]; 00197 n = 0; 00198 for (i=0 ; i<drawModes.length ; i++) 00199 res[i] = drawModes[i]; 00200 n += drawModes.length; 00201 for (i=0 ; i<reshapeModes.length ; i++) 00202 res[n+i] = reshapeModes[i]; 00203 return res; 00204 } |
|
Translate the given string to a sub-mode.
00210 { 00211 int mode = stringToDrawMode(name); 00212 if (mode != UNDEFINED) 00213 return mode; 00214 mode = stringToReshapeMode(name); 00215 return mode; 00216 } |
|
Main viewer mode: select object.
|
|
Main viewer mode: draw graphical object.
|
|
Main viewer mode: move graphical object.
|
|
Main viewer mode: copy graphical object.
|
|
Main viewer mode: resize graphical object.
|
|
Main viewer mode: reshape graphical object.
|
|
Main viewer mode: delete object.
|
|
Draw sub-mode: draw point.
|
|
Draw sub-mode: draw line.
|
|
Draw sub-mode: draw arrow.
|
|
Draw sub-mode: draw square.
|
|
Draw sub-mode: draw rectangle.
|
|
Draw sub-mode: draw circle.
|
|
Draw sub-mode: draw oval.
|
|
Draw sub-mode: draw polygon.
|
|
Draw sub-mode: draw polyline.
|
|
Draw sub-mode: draw closed freehand.
|
|
Draw sub-mode: draw open freehand.
|
|
Draw sub-mode: draw string.
|
|
Reshape sub-mode: move point.
|
|
Reshape sub-mode: delete point.
|
|
No mode defined.
|
|
Initial value: new String[] {"Select", "Draw", "Move", "Copy", "Resize", "Reshape", "Delete" }
|
|
Initial value: new String[] {"Point", "Line", "Arrow", "Square", "Rectangle", "Circle", "Oval", "Polygon", "Polyline", "Freehand Closed", "Freehand Open", "String" }
|
|
Initial value: new String[] {"Move Point", "Delete Point" }
|