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