Definition at line 340 of file ZoomShiftRuler.h. References DrawMicroTicks(), DrawTick(), mAxisY, mSpan, mStart, mTickSpan, Pixel2Unit(), Unit2Pixel(), and OglGui::OglWindow::W(). Referenced by DisplayFunc(). 00341 { 00342 int startUnit = Pixel2Unit(0); 00343 int endUnit = Pixel2Unit(W()); 00344 00345 if (startUnit < mStart) 00346 startUnit = mStart; 00347 00348 int pixRange = Unit2Pixel(endUnit) - Unit2Pixel(startUnit); 00349 double range = endUnit - startUnit; 00350 double order = floor(log10(range)); 00351 double tmpSpan = mTickSpan = pow(10.,order); 00352 double quanta[9]= {.5,.2,.1, .05,.02,.01, .005,.002,.001}; 00353 //Alternative: 00354 //double quanta[9]= {.5,.25,.1, .025,.02,.01, .0025,.002,.001}; 00355 00356 int i = 0; 00357 while (i<9 && range/tmpSpan < (pixRange/140)) 00358 tmpSpan = mTickSpan * quanta[i++]; 00359 mTickSpan = tmpSpan; 00360 int firstTick = ceil(startUnit / mTickSpan); 00361 int tickCount = floor(endUnit / mTickSpan) - firstTick + 1; 00362 00363 SetStipple((short)oglSolid); 00364 DrawTick(startUnit, Unit2Pixel(startUnit), mAxisY, mTickSpan); 00365 00366 int startI = Unit2Pixel(mStart)<0 ? -1 : 0; 00367 for (i=startI; i<tickCount; i++) 00368 { 00369 long val = (i+firstTick) * mTickSpan; 00370 long x = Unit2Pixel(val); 00371 long nextX = Unit2Pixel(val+mTickSpan); 00372 00373 if (val > mStart+mSpan || x>W()) 00374 break; 00375 DrawMicroTicks(x, nextX); 00376 DrawTick(val, x, mAxisY, mTickSpan); 00377 } 00378 }
Here is the call graph for this function:
|