Hello
Thanks to Bill(thanks..) i find out how to use CoordinateSystem,but I
now have another problem with displaying data.
When I use a point mode everything is ok:->
[url=http://img266.imageshack.us/my.php?image=pointmodegl4.png][img=http://img266.imageshack.us/img266/7214/pointmodegl4
.th.png][/url]
link:http://img266.imageshack.us/img266/7214/pointmodegl4.th.png
I have points for y=2,3,4,5,15,18
but when I switch to a "normal"mode- point mode set to false ,the
sections are not painted in place where I want them to
be drawn (for y=18 i want from (18+15)/2 or 15+ (15/18)*3 to 18 ;for
y=15 I want from (15+4)/2 or 4+(4/15)*11
but I get
[url=http://img266.imageshack.us/my.php?image=normalmodeep8.png][img=http://img266.imageshack.us/img266/5843/normalmodee
p8.th.png][/url]
link:http://img266.imageshack.us/img266/5843/normalmodeep8.th.png
so that 15 is not in proper place..
Is there a way to display it how I want (correctly -I can't catch Is
this displayed now)
I have another question.
I display a very large data (in my real application).Making visad
display takes some time and costs a lot of memory.
For example I have 1000000 for x axis (a1,a2..a100000)
I would like to display at first all samples but I could count
averedges so (a1+a2+a3+a4)/4 etc at displays it and when
user zoom
so that he could see normal sample I would like to show him normal
samples.Is there a way to find out how many samples
are now displayed for one pixel?? with extending MouseBehaviorJ2D I
understand that I can only find out about scaling
(how much I scale in a step on zooming)
Thanks for any help
Roman Sachar
Code:(whitch i think may be helpfull..)
latitude = RealType.getRealType("latitude");
longitude = RealType.getRealType("longitude");
RealType longitudeB =
RealType.getRealType("logitudeB",SI.second,null);
loglatitude=RealType.getRealType("loglatitude",CommonUnit.promiscuous);
CoordinateSystem logCS = new MyCoordinateSystem(new
RealTupleType(loglatitude,longitudeB));
double[]val=new double[] {1.0,2.0,3.0,4.0,15.0,18.0};
((MyCoordinateSystem)logCS).setAxisYValues(val);
domain_tuple = new RealTupleType(latitude, longitude,logCS,null);
temperature = RealType.getRealType("temperature");
func_dom_temp = new FunctionType( domain_tuple, temperature);
int NCOLS = 7;//the order could be inproper
int NROWS = 6;
domain_set = new Linear2DSet(domain_tuple, 1.0, NCOLS, NCOLS,1.0,
NROWS, NROWS);
float[][] temp_vals = new float[][]{{1, 6, 12, 18, 24,30},
{1, 7, 12, 19, 25,31},
{2, 8, 14, 20, 26,32},
{3, 9, 15, 21, 27,33},
{4, 10, 16, 22, 28,34},
{4, 10, 16, 22, 28,35},
{5, 11, 17, 23, 29,37} };
float[][] flat_samples = new float[1][NCOLS * NROWS];
for(int c = 0; c < NROWS; c++)
for(int r = 0; r < NCOLS; r++)
{
flat_samples[0][ c * NCOLS+ r ] = temp_vals[r][c];
}
vals_ff = new FlatField( func_dom_temp, domain_set);
etc..
and
public class MyCoordinateSystem extends CoordinateSystem {
public void setAxisYValues(double []val) {
valy=val;
}
public double[][] toReference(double[][] values) throws
VisADException {
if (valy==null || values == null || values[0].length < 1)
return
values;
int len = values[0].length;
double[][] logValues = new double[getDimension()][len];
System.arraycopy(values[0],0,logValues[0],0,logValues[0].length);
int width=values[0].length/valy.length;
int k=0;
for (int i=0;i<valy.length;i++) {
for (int j=0;j<width;j++) {
logValues[1][k++]=valy[valy.length-i-1];
}
}
for(int i = 2; i < getDimension(); i++)
{
System.arraycopy(values[i],0,logValues[i],0,logValues[i].length);
}
return logValues;
}
}
Once more:
Thanks for any help
----------------------------------------------------
Pierwsza od piętnastu lat książka
Václava Havla "Tylko krótko proszę" - już w księgarniach!
http://klik.wp.pl/?adr=http%3A%2F%2Fadv.reklama.wp.pl%2Fas%2Fhavel.html&sid=15