Commit ea385221 authored by Claes Sjofors's avatar Claes Sjofors

Java AxisArc and dynamics for Axis added

parent 1d7aa0b9
This diff is collapsed.
...@@ -225,6 +225,12 @@ public class GlowVector { ...@@ -225,6 +225,12 @@ public class GlowVector {
a.add( c); a.add( c);
break; break;
} }
case Glow.eSave_GrowAxisArc: {
GrowAxisArc c = new GrowAxisArc( cmn);
c.open( reader);
a.add( c);
break;
}
case Glow.eSave_GrowImage: { case Glow.eSave_GrowImage: {
GrowImage c = new GrowImage( cmn); GrowImage c = new GrowImage( cmn);
c.open( reader); c.open( reader);
......
...@@ -476,4 +476,166 @@ public class GrowAxis extends GrowRect { ...@@ -476,4 +476,166 @@ public class GrowAxis extends GrowRect {
return userdata; return userdata;
} }
public class Range {
public Range(int lines, int longq, int vvalq, int hvalq, String format) {
this.lines = lines;
this.longq = longq;
this.vvalq = vvalq;
this.hvalq = hvalq;
this.format = format;
}
int lines;
int longq;
int vvalq;
int hvalq;
String format;
}
public void set_range( double minval, double maxval, int keep_settings) {
Range[][] rdata = new Range[][] {
new Range[] {
new Range( 26, 5, 5, 10, "%3.1f"), // 1
new Range( 21, 5, 5, 10, "%3.1f"), // 2
new Range( 31, 5, 10, 10, "%3.1f"), // 3
new Range( 41, 5, 10, 20, "%3.1f"), // 4
new Range( 26, 5, 5, 10, "%1.0f"), // 5
new Range( 31, 5, 10, 10, "%1.0f"), // 6
new Range( 36, 5, 10, 10, "%1.0f"), // 7
new Range( 17, 2, 4, 4, "%1.0f"), // 8
new Range( 19, 2, 4, 4, "%1.0f"), // 9
new Range( 21, 2, 4, 8, "%2.0f"), // 10
new Range( 23, 2, 4, 8, "%2.0f"), // 11
new Range( 13, 4, 4, 4, "%2.0f"), // 12
new Range( 14, 4, 4, 4, "%2.0f"), // 13
new Range( 15, 4, 4, 4, "%2.0f"), // 14
new Range( 16, 5, 5, 5, "%2.0f"), // 15
new Range( 17, 5, 5, 5, "%2.0f"), // 16
new Range( 18, 5, 5, 5, "%2.0f"), // 17
new Range( 19, 5, 5, 5, "%2.0f"), // 18
new Range( 20, 5, 5, 5, "%2.0f"), // 19
new Range( 21, 5, 5, 5, "%2.0f"), // 20
new Range( 22, 5, 5, 5, "%2.0f"), // 21
new Range( 23, 5, 5, 5, "%2.0f"), // 22
new Range( 24, 5, 5, 5, "%2.0f"), // 23
new Range( 25, 5, 5, 5, "%2.0f"), // 24
new Range( 26, 5, 5, 10, "%2.0f")},// 25
new Range[] {
new Range( 101, 5, 10, 20, "%3.1f"), // 1
new Range( 101, 5, 10, 20, "%3.1f"), // 2
new Range( 61, 10, 10, 20, "%3.1f"), // 3
new Range( 81, 10, 10, 20, "%3.1f"), // 4
new Range( 101, 10, 20, 20, "%1.0f"), // 5
new Range( 61, 5, 10, 20, "%1.0f"), // 6
new Range( 71, 5, 10, 20, "%1.0f"), // 7
new Range( 81, 5, 10, 20, "%1.0f"), // 8
new Range( 91, 5, 10, 20, "%1.0f"), // 9
new Range( 101, 5, 10, 20, "%2.0f"), // 10
new Range( 56, 5, 5, 5, "%2.0f"), // 11
new Range( 61, 5, 10, 10, "%2.0f"), // 12
new Range( 66, 5, 10, 20, "%2.0f"), // 13
new Range( 71, 5, 10, 20, "%2.0f"), // 14
new Range( 76, 5, 10, 20, "%2.0f"), // 15
new Range( 81, 5, 10, 20, "%2.0f"), // 16
new Range( 86, 5, 10, 20, "%2.0f"), // 17
new Range( 91, 5, 10, 20, "%2.0f"), // 18
new Range( 96, 5, 10, 20, "%2.0f"), // 19
new Range( 101, 5, 10, 25, "%2.0f"), // 20
new Range( 43, 2, 6, 6, "%2.0f"), // 21
new Range( 45, 2, 4, 8, "%2.0f"), // 22
new Range( 47, 2, 4, 8, "%2.0f"), // 23
new Range( 49, 2, 4, 8, "%2.0f"), // 24
new Range( 26, 5, 5, 5, "%2.0f")}}; // 25
max_value = maxval;
min_value = minval;
int x1 = (int)( trf.x( ll.x, ll.y) * cmn.mw.zoom_factor_x) - cmn.mw.offset_x;
int y1 = (int)( trf.y( ll.x, ll.y) * cmn.mw.zoom_factor_y) - cmn.mw.offset_y;
int x2 = (int)( trf.x( ur.x, ur.y) * cmn.mw.zoom_factor_x) - cmn.mw.offset_x;
int y2 = (int)( trf.y( ur.x, ur.y) * cmn.mw.zoom_factor_y) - cmn.mw.offset_y;
double rotation = (trf.rot() / 360 - Math.floor( trf.rot() / 360)) * 360;
if ( keep_settings == 0) {
int len;
int lix;
int di;
int horizontal = ( rotation < 45 || (rotation > 135 && rotation < 225) || rotation > 315) ? 0 : 1;
if ( horizontal != 0)
len = Math.abs( x2 - x1);
else
len = Math.abs( y2 - y1);
if ( len < 150)
lix = 0;
else
lix = 1;
double d = Math.abs( maxval - minval);
if ( d < 5)
d = 1000 * d;
di = (int) (d + 0.5);
while ( di >= 25)
di /= 10;
if ( di > 0 && di <= 25) {
lines = rdata[lix][di-1].lines;
longquotient = rdata[lix][di-1].longq;
if ( horizontal != 0)
valuequotient = rdata[lix][di-1].hvalq;
else
valuequotient = rdata[lix][di-1].vvalq;
}
double m = Math.max(Math.abs(maxval),Math.abs(minval));
switch ( lix) {
case 0: {
if ( m < 0.01)
format = "%g";
else if ( m < 0.1)
format = "%5.3f";
else if ( m < 1)
format = "%4.2f";
else if ( m < 3)
format = "%3.1f";
else if ( m <= 20)
format = "%2.0f";
else if ( m <= 200)
format = "%3.0f";
else if ( m < 2000)
format = "%4.0f";
else if ( m < 20000)
format = "%5.0f";
else
format = "%g";
break;
}
case 1: {
if ( m < 0.01)
format = "%g";
else if ( m < 0.1)
format = "%5.3f";
else if ( m < 1)
format = "%4.2f";
else if ( m <= 4)
format = "%3.1f";
else if ( m <= 20)
format = "%2.0f";
else if ( m <= 200)
format = "%3.0f";
else if ( m < 2000)
format = "%4.0f";
else if ( m < 20000)
format = "%5.0f";
else
format = "%g";
break;
}
default: ;
}
}
configure();
draw();
}
} }
This diff is collapsed.
...@@ -630,7 +630,9 @@ public class GrowCtx implements GrowCtxIfc { ...@@ -630,7 +630,9 @@ public class GrowCtx implements GrowCtxIfc {
cmn.a.get(i).type() == Glow.eObjectType_GrowXYCurve || cmn.a.get(i).type() == Glow.eObjectType_GrowXYCurve ||
cmn.a.get(i).type() == Glow.eObjectType_GrowPie || cmn.a.get(i).type() == Glow.eObjectType_GrowPie ||
cmn.a.get(i).type() == Glow.eObjectType_GrowBarChart || cmn.a.get(i).type() == Glow.eObjectType_GrowBarChart ||
cmn.a.get(i).type() == Glow.eObjectType_GrowToolbar) { cmn.a.get(i).type() == Glow.eObjectType_GrowToolbar ||
cmn.a.get(i).type() == Glow.eObjectType_GrowAxis ||
cmn.a.get(i).type() == Glow.eObjectType_GrowAxisArc) {
cmn.appl.traceConnect(cmn.a.get(i)); cmn.appl.traceConnect(cmn.a.get(i));
if ( cmn.a.get(i).type() == Glow.eObjectType_GrowGroup) { if ( cmn.a.get(i).type() == Glow.eObjectType_GrowGroup) {
for ( int j = 0; j < ((GrowNode)cmn.a.get(i)).nc.a.size(); j++) { for ( int j = 0; j < ((GrowNode)cmn.a.get(i)).nc.a.size(); j++) {
...@@ -665,7 +667,9 @@ public class GrowCtx implements GrowCtxIfc { ...@@ -665,7 +667,9 @@ public class GrowCtx implements GrowCtxIfc {
cmn.a.get(i).type() == Glow.eObjectType_GrowFolder || cmn.a.get(i).type() == Glow.eObjectType_GrowFolder ||
cmn.a.get(i).type() == Glow.eObjectType_GrowXYCurve || cmn.a.get(i).type() == Glow.eObjectType_GrowXYCurve ||
cmn.a.get(i).type() == Glow.eObjectType_GrowPie || cmn.a.get(i).type() == Glow.eObjectType_GrowPie ||
cmn.a.get(i).type() == Glow.eObjectType_GrowBarChart) { cmn.a.get(i).type() == Glow.eObjectType_GrowBarChart ||
cmn.a.get(i).type() == Glow.eObjectType_GrowAxis ||
cmn.a.get(i).type() == Glow.eObjectType_GrowAxisArc) {
cmn.appl.traceDisconnect(cmn.a.get(i)); cmn.appl.traceDisconnect(cmn.a.get(i));
if ( cmn.a.get(i).type() == Glow.eObjectType_GrowGroup) { if ( cmn.a.get(i).type() == Glow.eObjectType_GrowGroup) {
for ( int j = 0; j < ((GrowNode)cmn.a.get(i)).nc.a.size(); j++) { for ( int j = 0; j < ((GrowNode)cmn.a.get(i)).nc.a.size(); j++) {
...@@ -697,7 +701,9 @@ public class GrowCtx implements GrowCtxIfc { ...@@ -697,7 +701,9 @@ public class GrowCtx implements GrowCtxIfc {
cmn.a.get(i).type() == Glow.eObjectType_GrowFolder || cmn.a.get(i).type() == Glow.eObjectType_GrowFolder ||
cmn.a.get(i).type() == Glow.eObjectType_GrowXYCurve || cmn.a.get(i).type() == Glow.eObjectType_GrowXYCurve ||
cmn.a.get(i).type() == Glow.eObjectType_GrowPie || cmn.a.get(i).type() == Glow.eObjectType_GrowPie ||
cmn.a.get(i).type() == Glow.eObjectType_GrowBarChart) { cmn.a.get(i).type() == Glow.eObjectType_GrowBarChart ||
cmn.a.get(i).type() == Glow.eObjectType_GrowAxis ||
cmn.a.get(i).type() == Glow.eObjectType_GrowAxisArc) {
cmn.appl.traceScan(cmn.a.get(i)); cmn.appl.traceScan(cmn.a.get(i));
if ( cmn.a.get(i).type() == Glow.eObjectType_GrowGroup) { if ( cmn.a.get(i).type() == Glow.eObjectType_GrowGroup) {
for ( int j = 0; j < ((GrowNode)cmn.a.get(i)).nc.a.size(); j++) { for ( int j = 0; j < ((GrowNode)cmn.a.get(i)).nc.a.size(); j++) {
......
...@@ -46,6 +46,7 @@ local_java_sources := \ ...@@ -46,6 +46,7 @@ local_java_sources := \
GrowSlider.java,\ GrowSlider.java,\
GrowAxis.java,\ GrowAxis.java,\
GrowArc.java,\ GrowArc.java,\
GrowAxisArc.java,\
GrowLine.java,\ GrowLine.java,\
GrowPolyline.java,\ GrowPolyline.java,\
GrowText.java,\ GrowText.java,\
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment