[Date Prev][Date Next][Index][Thread]
[SGT Mail Archive]
[SGT Main Page]
Deep zoom or setRange fails for small values
*************************************************
Message from the sgt mail list.
*************************************************
I am using JPLotLayout and LineCartesiaRenderer.
When the user range of axes is changed
(with mouse zoom or setRange method)to a too small
values respect to the user/device coordinate
the rendering fails to draw the symbols or the lines,
because the conversion from user to devices give a number
that is bigger/lesser then the maximum/minimum value of an integer.
For Y axes this usually mean that: or the line/symbol
it is note displayed or two lines are displayed.
It is possible to patch this behavior due to the
LineCartesian renderer inserting
in the method drawLine(Graphics g, SGTLine line, LineAttribute attr)
a check in the conversion , e.g :
from:
yp[count] = cg_.getYUtoD(yValues[count]);
to:
yp[count] = cg_.getYUtoD(yValues[count]);
if ( cg_.getYUtoD2(yValues[count])>= Integer.MAX_VALUE/2){
yp[count]=Integer.MAX_VALUE/2-1;
}else if ( cg_.getYUtoD2(yValues[count])<= Integer.MIN_VALUE/2){
yp[count]=Integer.MIN_VALUE/2+1;
}
The factor /2 is to allow a difference between max and min values lesser than the
Integer.MAX_VALUE.
For X axes the range of axis is set to an inverted and completly different values
e.g:
plot contains a line with x=y={0,1,2......999}
//THIS WORKs
Range2D rx=Range2D(752,754) //OK
Range2D ry=Range2D(750,760)
Domain domain=Domain(rx,ry);
plot.setRange(domain);
// printing the plot domain now give:
//x=[752.0;754.2],y=[750.0;761.0],
// xRev=false, yRev=false
//THIS DOESN'T WORK
Range2D rx=Range2D(753-1e-7,753+1e-7);
Range2D ry=Range2D(750,760);
Domain domain=Domain(rx,ry);
plot.setRange(domain);
// The plot is empty, the x axis labels disappear
// printing the plot domain now give:
//x=[42.94967294;-42.94967296],y=[750.0;761.0],
// xRev=false, yRev=false
The patch above doesn't work for x axis, the problem seem arise
when the PaneProxy repaint the component.
Does somebody know how to patch this behaviour?
Greeting
Andrea Lorenzani.
*************************************************
To remove yourself from this mailing list,
send mail to <epic-majordomo@noaa.gov> with
"unsubscribe sgt" in the message body.
==========
Privacy Notice,
External Links Disclaimer.