Inheritance diagram for CanvasArrowGrid::
Public Methods | |
CanvasArrowGrid (double x, double y, double[][] lengths, int[][] angles) | |
CanvasArrowGrid (double x, double y, double[][] lengths, int[][] angles, double distance) | |
CanvasArrowGrid (double x, double y, double[][] lengths, int[][] angles, double distance, Color color) | |
CanvasArrowGrid (double x, double y, double[][] lengths, int[][] angles, double distance, Color color, boolean stroke, float linew, float trans, double ccsScale) | |
void | draw (Graphics g) |
Draw CanvasObject on 'g', using internal CCS values. More... | |
Object | clone () |
Return an identical copy of this CanvasObject. More... | |
boolean | isInside (double x, double y) |
boolean | isNear (double x, double y) |
void | setDimension (double w, double h) |
Resize CanvasObject to width 'w' and height 'h'. More... | |
void | setZoomFactor (double zoomFactor) |
Scale CanvasObject according to 'zoomFactor'. More... | |
void | doMove (double w, double h) |
Move CanvasObject 'w' positions in x-direction, and 'h' posi- tions in y-direction. More... | |
boolean | isInsideCcs (int x, int y) |
To be removed. More... | |
boolean | isNearCcs (int x, int y) |
To be removed. More... | |
void | setDimension (int w, int h) |
void | doMove (int w, int h) |
Static Public Attributes | |
final double | DEF_DIST = 1.0 |
Protected Methods | |
void | initGrid (double[][] lengths, int[][] angles, double distance) |
void | allocGridSpace () |
void | placeArrows () |
void | transformICStoCCS () |
Perform a full ICS to CCS coordinate transformation. More... | |
void | transformCCStoICS () |
Perform a full CCS to ICS coordinate transformation. More... | |
Protected Attributes | |
int | nr_x = 0 |
int | nr_y = 0 |
double | distance = DEF_DIST |
double[] | ics_xs = null |
double[] | ics_ys = null |
double[][] | ics_xHeads = null |
double[][] | ics_yHeads = null |
double[][] | ics_Bx = null |
double[][] | ics_By = null |
double[][] | ics_Gx = null |
double[][] | ics_Gy = null |
int[] | ccs_xs = null |
int[] | ccs_ys = null |
int[][] | ccs_xHeads = null |
int[][] | ccs_yHeads = null |
int[][] | ccs_Bx = null |
int[][] | ccs_By = null |
int[][] | ccs_Gx = null |
int[][] | ccs_Gy = null |
double[][] | lengths = null |
int[][] | angles = null |
Static Protected Attributes | |
final int | HEAD_LENGTH = 6 |
final int | HEAD_ANGLE = 20 |
|
|
|
|
|
|
|
|
|
Draw CanvasObject on 'g', using internal CCS values.
Reimplemented from CanvasObject.
00075 { 00076 setupDrawMode(g); 00077 if (!getTransformOK()) { 00078 transformICStoCCS(); 00079 } 00080 for (int i=0; i<nr_y; i++) { 00081 for (int j=0; j<nr_x; j++) { 00082 g.drawLine(ccs_xs[j], ccs_ys[i], 00083 ccs_xHeads[i][j], ccs_yHeads[i][j]); 00084 g.drawLine(ccs_xHeads[i][j], ccs_yHeads[i][j], 00085 ccs_Bx[i][j], ccs_By[i][j]); 00086 g.drawLine(ccs_xHeads[i][j], ccs_yHeads[i][j], 00087 ccs_Gx[i][j], ccs_Gy[i][j]); 00088 } 00089 } 00090 } |
|
Return an identical copy of this CanvasObject.
Reimplemented from CanvasObject.
00094 { 00095 Color color = drawColor; 00096 if (hasNoColor) { 00097 color = NO_COLOR; 00098 } 00099 return (new CanvasArrowGrid(getX1(), getY1(), lengths, angles, 00100 distance, color, strokeSet, 00101 lineWidth, transparency, getZoomFactor())); 00102 } |
|
00106 { 00107 return inBoundingBox(x, y); 00108 } |
|
00112 { 00113 return inBoundingBox(x, y); 00114 } |
|
Resize CanvasObject to width 'w' and height 'h'. Parameters are assumed Image Coordinate System values. Reimplemented from ScribbleObject.
00118 { 00119 // overrule super.setDimension(w, h), and do nothing 00120 00121 return; 00122 } |
|
Scale CanvasObject according to 'zoomFactor'. The internal ICS values are taken as base values to calculate the associated CCS values. Reimplemented from CanvasObject.
00126 { 00127 super.setZoomFactor(zoomFactor); 00128 placeArrows(); 00129 } |
|
Move CanvasObject 'w' positions in x-direction, and 'h' posi- tions in y-direction. Parameters are assumed Image Coordinate System values. Reimplemented from ScribbleObject.
00133 { 00134 super.doMove(w, h); 00135 placeArrows(); 00136 } |
|
To be removed.
Reimplemented from CanvasObject.
00154 { 00155 return inBoundingBoxCcs(x, y); 00156 } |
|
To be removed.
Reimplemented from CanvasObject.
00160 { 00161 return inBoundingBoxCcs(x, y); 00162 } |
|
Reimplemented from ScribbleObject.
00166 { 00167 // overrule super.setDimension(w, h), and do nothing 00168 00169 return; 00170 } |
|
Reimplemented from ScribbleObject.
00174 { 00175 super.doMove(w, h); 00176 placeArrows(); 00177 } |
|
00192 { 00193 resizeable = false; 00194 setInputSource(INP_SASYSTEM); 00195 nr_x = lengths[0].length; 00196 nr_y = lengths.length; 00197 this.distance = distance; 00198 00199 setWidth((nr_x - 1) * distance); 00200 setHeight((nr_y - 1) * distance); 00201 00202 allocGridSpace(); 00203 00204 for (int i=0; i<nr_y; i++) { 00205 for (int j=0; j<nr_x; j++) { 00206 this.lengths[i][j] = lengths[i][j]; 00207 this.angles[i][j] = angles[i][j]; 00208 } 00209 } 00210 00211 placeArrows(); 00212 transformICStoCCS(); 00213 } |
|
00217 { 00218 ics_xs = new double[nr_x]; 00219 ics_ys = new double[nr_y]; 00220 ics_xHeads = new double[nr_y][nr_x]; 00221 ics_yHeads = new double[nr_y][nr_x]; 00222 ics_Bx = new double[nr_y][nr_x]; 00223 ics_By = new double[nr_y][nr_x]; 00224 ics_Gx = new double[nr_y][nr_x]; 00225 ics_Gy = new double[nr_y][nr_x]; 00226 00227 ccs_xs = new int[nr_x]; 00228 ccs_ys = new int[nr_y]; 00229 ccs_xHeads = new int[nr_y][nr_x]; 00230 ccs_yHeads = new int[nr_y][nr_x]; 00231 ccs_Bx = new int[nr_y][nr_x]; 00232 ccs_By = new int[nr_y][nr_x]; 00233 ccs_Gx = new int[nr_y][nr_x]; 00234 ccs_Gy = new int[nr_y][nr_x]; 00235 00236 this.lengths = new double[nr_y][nr_x]; 00237 this.angles = new int[nr_y][nr_x]; 00238 } |
|
00242 { 00243 double cosa, sina; 00244 double cosb, sinb; 00245 double cosg, sing; 00246 double tmp_l; 00247 00248 int beta, gamma; 00249 00250 for (int i=0; i<nr_x; i++) { 00251 ics_xs[i] = getX1() + i * distance; 00252 } 00253 for (int i=0; i<nr_y; i++) { 00254 ics_ys[i] = getY1() + i * distance; 00255 } 00256 00257 for (int i=0; i<nr_y; i++) { 00258 for (int j=0; j<nr_x; j++) { 00259 this.lengths[i][j] = lengths[i][j]; 00260 this.angles[i][j] = angles[i][j]; 00261 00262 beta = 90 - angles[i][j] - HEAD_ANGLE; 00263 gamma = angles[i][j] - HEAD_ANGLE; 00264 00265 cosa = Math.cos((angles[i][j] * Math.PI) / 180); 00266 sina = Math.sin((angles[i][j] * Math.PI) / 180); 00267 cosb = Math.cos((beta * Math.PI) / 180); 00268 sinb = Math.sin((beta * Math.PI) / 180); 00269 cosg = Math.cos((gamma* Math.PI) / 180); 00270 sing = Math.sin((gamma* Math.PI) / 180); 00271 00272 ics_xHeads[i][j] = ics_xs[j] + lengths[i][j] * cosa; 00273 ics_yHeads[i][j] = ics_ys[i] - lengths[i][j] * sina; 00274 00275 tmp_l = Math.min(lengths[i][j]/2 + 1, HEAD_LENGTH/getZoomFactor()); 00276 00277 ics_Bx[i][j] = ics_xHeads[i][j] - tmp_l * sinb; 00278 ics_By[i][j] = ics_yHeads[i][j] + tmp_l * cosb; 00279 ics_Gx[i][j] = ics_xHeads[i][j] - tmp_l * cosg; 00280 ics_Gy[i][j] = ics_yHeads[i][j] + tmp_l * sing; 00281 } 00282 } 00283 setTransformOK(false); 00284 } |
|
Perform a full ICS to CCS coordinate transformation.
Reimplemented from CanvasObject.
00288 { 00289 super.transformICStoCCS(); 00290 00291 if (nr_x > 0 && nr_y > 0) { 00292 ccs_xs = Converter.ICStoCCS(ics_xs, getZoomFactor()); 00293 ccs_ys = Converter.ICStoCCS(ics_ys, getZoomFactor()); 00294 00295 for (int i=0; i<nr_y; i++) { 00296 ccs_xHeads[i] = Converter.ICStoCCS(ics_xHeads[i], getZoomFactor()); 00297 ccs_yHeads[i] = Converter.ICStoCCS(ics_yHeads[i], getZoomFactor()); 00298 ccs_Bx[i] = Converter.ICStoCCS(ics_Bx[i], getZoomFactor()); 00299 ccs_By[i] = Converter.ICStoCCS(ics_By[i], getZoomFactor()); 00300 ccs_Gx[i] = Converter.ICStoCCS(ics_Gx[i], getZoomFactor()); 00301 ccs_Gy[i] = Converter.ICStoCCS(ics_Gy[i], getZoomFactor()); 00302 } 00303 } 00304 setTransformOK(true); 00305 } |
|
Perform a full CCS to ICS coordinate transformation. This function is used only for scribbled objects. Reimplemented from CanvasObject.
00309 { 00310 super.transformCCStoICS(); 00311 00312 if (nr_x > 0 && nr_y > 0) { 00313 ics_xs = Converter.CCStoICS(ccs_xs, getZoomFactor()); 00314 ics_ys = Converter.CCStoICS(ccs_ys, getZoomFactor()); 00315 00316 for (int i=0; i<nr_y; i++) { 00317 ics_xHeads[i] = Converter.CCStoICS(ccs_xHeads[i], getZoomFactor()); 00318 ics_yHeads[i] = Converter.CCStoICS(ccs_yHeads[i], getZoomFactor()); 00319 ics_Bx[i] = Converter.CCStoICS(ccs_Bx[i], getZoomFactor()); 00320 ics_By[i] = Converter.CCStoICS(ccs_By[i], getZoomFactor()); 00321 ics_Gx[i] = Converter.CCStoICS(ccs_Gx[i], getZoomFactor()); 00322 ics_Gy[i] = Converter.CCStoICS(ccs_Gy[i], getZoomFactor()); 00323 } 00324 } 00325 } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|