Commit 7df9e038 authored by Claes Sjofors's avatar Claes Sjofors

Java pwg-files, XY_Curve addedDyn.java

parent 935c5eaa
...@@ -42,6 +42,7 @@ public class DynParsedAttrName { ...@@ -42,6 +42,7 @@ public class DynParsedAttrName {
public String tname; public String tname;
public boolean inverted; public boolean inverted;
public int elements; public int elements;
public int index;
public int type; public int type;
public int database; public int database;
public int bitmask; public int bitmask;
......
...@@ -196,22 +196,22 @@ public class Graph implements GraphIfc, GrowApplIfc { ...@@ -196,22 +196,22 @@ public class Graph implements GraphIfc, GrowApplIfc {
return 0; return 0;
} }
int stringToElements( String str) { int stringToIndex( String str) {
int idx1, idx2; int idx1, idx2;
int elements; int index;
if ( (idx1 = str.indexOf('[')) != -1 && if ( (idx1 = str.indexOf('[')) != -1 &&
(idx2 = str.indexOf(']')) != -1 && (idx2 = str.indexOf(']')) != -1 &&
idx2 > idx1) { idx2 > idx1) {
try { try {
System.out.println("Elements: " + str.substring(idx1+1, idx2)); System.out.println("Elements: " + str.substring(idx1+1, idx2));
elements = new Integer(str.substring(idx1+1, idx2)).intValue(); index = new Integer(str.substring(idx1+1, idx2)).intValue();
} }
catch( NumberFormatException e) { catch( NumberFormatException e) {
System.out.println("Element syntax error, " + str); System.out.println("Element syntax error, " + str);
return 1; return 1;
} }
return elements; return index;
} }
return 1; return 1;
} }
...@@ -294,19 +294,29 @@ public class Graph implements GraphIfc, GrowApplIfc { ...@@ -294,19 +294,29 @@ public class Graph implements GraphIfc, GrowApplIfc {
pname.tname = new String(str); pname.tname = new String(str);
if ( (idx = str.indexOf('[')) != -1 && if ( (idx = str.indexOf('[')) == -1) {
(eidx = str.lastIndexOf('#')) != -1 && if ((eidx = str.lastIndexOf('#')) != -1 &&
str.charAt(eidx-1) != '#') { str.charAt(eidx-1) != '#') {
pname.elements = stringToElements(str); pname.elements = new Integer(str.substring(eidx+1)).intValue();
str = str.substring(0, idx-1); str = str.substring(0, eidx);
} }
else else
pname.elements = 1; pname.elements = 1;
}
else {
pname.index = stringToIndex(str);
pname.elements = 1;
if ((eidx = str.lastIndexOf('#')) != -1 &&
str.charAt(eidx-1) != '#')
str = str.substring( 0, eidx-1);
else
str = str.substring(0, idx-1);
}
if ( (tidx = str.indexOf("##")) != -1) { if ( (tidx = str.indexOf("##")) != -1) {
if ( str.toLowerCase().startsWith("bit", tidx+2)) { if ( str.toLowerCase().startsWith("bit", tidx+2)) {
String typestr = str.substring(tidx+2); String typestr = str.substring(tidx+2);
int bit = stringToElements(str); int bit = stringToIndex(str);
pname.bitmask = 1 << bit; pname.bitmask = 1 << bit;
str = str.substring(0, tidx+5); str = str.substring(0, tidx+5);
} }
......
...@@ -611,7 +611,8 @@ public class GrowCtx implements GrowCtxIfc { ...@@ -611,7 +611,8 @@ public class GrowCtx implements GrowCtxIfc {
cmn.a.get(i).type() == Glow.eObjectType_GrowTable || cmn.a.get(i).type() == Glow.eObjectType_GrowTable ||
cmn.a.get(i).type() == Glow.eObjectType_GrowSlider || cmn.a.get(i).type() == Glow.eObjectType_GrowSlider ||
cmn.a.get(i).type() == Glow.eObjectType_GrowWindow || cmn.a.get(i).type() == Glow.eObjectType_GrowWindow ||
cmn.a.get(i).type() == Glow.eObjectType_GrowFolder) { cmn.a.get(i).type() == Glow.eObjectType_GrowFolder ||
cmn.a.get(i).type() == Glow.eObjectType_GrowXYCurve) {
System.out.println("GrowCtx connect " + i + " (" + cmn.a.size() + ") " + cmn.a.get(i)); System.out.println("GrowCtx connect " + i + " (" + cmn.a.size() + ") " + cmn.a.get(i));
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) {
...@@ -644,7 +645,8 @@ public class GrowCtx implements GrowCtxIfc { ...@@ -644,7 +645,8 @@ public class GrowCtx implements GrowCtxIfc {
cmn.a.get(i).type() == Glow.eObjectType_GrowTable || cmn.a.get(i).type() == Glow.eObjectType_GrowTable ||
cmn.a.get(i).type() == Glow.eObjectType_GrowSlider || cmn.a.get(i).type() == Glow.eObjectType_GrowSlider ||
cmn.a.get(i).type() == Glow.eObjectType_GrowWindow || cmn.a.get(i).type() == Glow.eObjectType_GrowWindow ||
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.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++) {
...@@ -664,6 +666,7 @@ public class GrowCtx implements GrowCtxIfc { ...@@ -664,6 +666,7 @@ public class GrowCtx implements GrowCtxIfc {
} }
public void traceScan() { public void traceScan() {
int sts; int sts;
for ( int i = 0; i < cmn.a.size(); i++) { for ( int i = 0; i < cmn.a.size(); i++) {
if ( cmn.a.get(i).type() == Glow.eObjectType_GrowNode || if ( cmn.a.get(i).type() == Glow.eObjectType_GrowNode ||
cmn.a.get(i).type() == Glow.eObjectType_GrowGroup || cmn.a.get(i).type() == Glow.eObjectType_GrowGroup ||
...@@ -672,7 +675,8 @@ public class GrowCtx implements GrowCtxIfc { ...@@ -672,7 +675,8 @@ public class GrowCtx implements GrowCtxIfc {
cmn.a.get(i).type() == Glow.eObjectType_GrowTable || cmn.a.get(i).type() == Glow.eObjectType_GrowTable ||
cmn.a.get(i).type() == Glow.eObjectType_GrowSlider || cmn.a.get(i).type() == Glow.eObjectType_GrowSlider ||
cmn.a.get(i).type() == Glow.eObjectType_GrowWindow || cmn.a.get(i).type() == Glow.eObjectType_GrowWindow ||
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.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++) {
......
...@@ -466,4 +466,7 @@ public class GrowTrend extends GrowRect { ...@@ -466,4 +466,7 @@ public class GrowTrend extends GrowRect {
public double get_scan_time() { public double get_scan_time() {
return scan_time; return scan_time;
} }
public int get_no_of_points() {
return no_of_points;
}
} }
...@@ -95,14 +95,14 @@ public class GrowXYCurve extends GrowTrend { ...@@ -95,14 +95,14 @@ public class GrowXYCurve extends GrowTrend {
public void set_xy_range_x( int curve, double min, double max) { public void set_xy_range_x( int curve, double min, double max) {
if ( curve > Glow.TREND_MAX_CURVES) if ( curve > Glow.TREND_MAX_CURVES || curve < 0)
return; return;
x_max_value[curve] = max; x_max_value[curve] = max;
x_min_value[curve] = min; x_min_value[curve] = min;
} }
public void set_xy_range_y( int curve, double min, double max) { public void set_xy_range_y( int curve, double min, double max) {
if ( curve > Glow.TREND_MAX_CURVES) if ( curve > Glow.TREND_MAX_CURVES || curve < 0)
return; return;
y_max_value[curve] = max; y_max_value[curve] = max;
y_min_value[curve] = min; y_min_value[curve] = min;
...@@ -114,7 +114,7 @@ public class GrowXYCurve extends GrowTrend { ...@@ -114,7 +114,7 @@ public class GrowXYCurve extends GrowTrend {
public void set_xy_curve_color( int curve, int curve_color, public void set_xy_curve_color( int curve, int curve_color,
int fill_color) { int fill_color) {
if ( curve > Glow.TREND_MAX_CURVES) if ( curve > Glow.TREND_MAX_CURVES || curve < 0)
return; return;
curve_drawtype[curve] = curve_color; curve_drawtype[curve] = curve_color;
curve_fill_drawtype[curve] = fill_color; curve_fill_drawtype[curve] = fill_color;
...@@ -128,7 +128,7 @@ public class GrowXYCurve extends GrowTrend { ...@@ -128,7 +128,7 @@ public class GrowXYCurve extends GrowTrend {
GlowPoint point_p; GlowPoint point_p;
int i, j, idx; int i, j, idx;
if ( curve_idx > Glow.TREND_MAX_CURVES) if ( curve_idx > Glow.TREND_MAX_CURVES || curve_idx < 0)
return; return;
no_of_points = Math.max( 2, no_of_points); no_of_points = Math.max( 2, no_of_points);
...@@ -138,10 +138,10 @@ public class GrowXYCurve extends GrowTrend { ...@@ -138,10 +138,10 @@ public class GrowXYCurve extends GrowTrend {
curve_width = Math.min( Glow.DRAW_TYPE_SIZE, Math.max( 1, curve_width)); curve_width = Math.min( Glow.DRAW_TYPE_SIZE, Math.max( 1, curve_width));
pointarray = new GlowPoint[points]; pointarray = new GlowPoint[cpoints];
j = curve_idx; j = curve_idx;
for ( i = 0, idx = 0; i < cpoints; i++, idx++) { for ( i = 0, idx = 0; i < cpoints; i++, idx++) {
point_p = pointarray[i]; point_p = pointarray[i] = new GlowPoint();
if ( fill_curve == 0) { if ( fill_curve == 0) {
idx = i; idx = i;
if ( y_max_value[j] != y_min_value[j]) if ( y_max_value[j] != y_min_value[j])
...@@ -155,6 +155,7 @@ public class GrowXYCurve extends GrowTrend { ...@@ -155,6 +155,7 @@ public class GrowXYCurve extends GrowTrend {
(x_max_value[j] - x_min_value[j]) * (ur.x - ll.x); (x_max_value[j] - x_min_value[j]) * (ur.x - ll.x);
point_p.x = Math.max( ll.x, Math.min( point_p.x, ur.x)); point_p.x = Math.max( ll.x, Math.min( point_p.x, ur.x));
} }
else { else {
...@@ -206,6 +207,7 @@ public class GrowXYCurve extends GrowTrend { ...@@ -206,6 +207,7 @@ public class GrowXYCurve extends GrowTrend {
curve_width, curve_width,
0, fill_curve, 1, 0, dt_fill); 0, fill_curve, 1, 0, dt_fill);
cmn.nodraw--; cmn.nodraw--;
draw();
} }
} }
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