Commit 5edb94e2 authored by claes's avatar claes

*** empty log message ***

parent 7a61f589
/* /*
* Proview $Id: GeDynXYCurve.java,v 1.1 2007-09-17 15:35:28 claes Exp $ * Proview $Id: GeDynXYCurve.java,v 1.2 2007-09-19 15:08:35 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -45,6 +45,8 @@ public class GeDynXYCurve extends GeDynElem { ...@@ -45,6 +45,8 @@ public class GeDynXYCurve extends GeDynElem {
int noofpoints; int noofpoints;
int noOfPoints; int noOfPoints;
int xAttrType;
int yAttrType;
public float[] curveX; public float[] curveX;
public float[] curveY; public float[] curveY;
boolean updateAttrFound; boolean updateAttrFound;
...@@ -96,6 +98,13 @@ public class GeDynXYCurve extends GeDynElem { ...@@ -96,6 +98,13 @@ public class GeDynXYCurve extends GeDynElem {
this.fill_curve = fill_curve; this.fill_curve = fill_curve;
} }
public void connect() { public void connect() {
xAttrType = GeDyn.getTypeId( x_attr);
switch ( datatype) {
case GeDyn.eCurveDataType_XYArrays:
yAttrType = GeDyn.getTypeId( y_attr);
break;
}
String attrName = dyn.getAttrName( update_attr); String attrName = dyn.getAttrName( update_attr);
if ( attrName.compareTo("") != 0) { if ( attrName.compareTo("") != 0) {
GdhrRefObjectInfo ret = dyn.en.gdh.refObjectInfo( attrName); GdhrRefObjectInfo ret = dyn.en.gdh.refObjectInfo( attrName);
...@@ -261,39 +270,73 @@ public class GeDynXYCurve extends GeDynElem { ...@@ -261,39 +270,73 @@ public class GeDynXYCurve extends GeDynElem {
break; break;
} }
CdhrFloatArray rx = dyn.en.gdh.getObjectInfoFloatArray( attrName, size); // Read x-array
if ( rx.evenSts()) CdhrFloatArray rxf;
CdhrIntArray rxi;
switch ( xAttrType) {
case Pwr.eType_Float32:
rxf = dyn.en.gdh.getObjectInfoFloatArray( attrName, size);
if ( rxf.evenSts())
return; return;
switch ( datatype) { switch ( datatype) {
case GeDyn.eCurveDataType_XYArrays: case GeDyn.eCurveDataType_XYArrays:
attrName = dyn.getAttrName( y_attr); curveX = new float[noOfPoints];
attrSize = GeDyn.getAttrSize( y_attr); for ( int i = 0; i < noOfPoints; i++)
curveX[i] = (rxf.value[i] - x_min_value) / ( x_max_value - x_min_value);
break;
case GeDyn.eCurveDataType_PointArray:
curveX = new float[noOfPoints];
curveY = new float[noOfPoints];
for ( int i = 0; i < noOfPoints; i++) {
curveX[i] = (rxf.value[2*i] - x_min_value) / ( x_max_value - x_min_value);
curveY[i] = (rxf.value[2*i+1] - y_min_value) / ( y_max_value - y_min_value);
}
dyn.repaintNow = true;
break;
case GeDyn.eCurveDataType_TableObject:
noOfPoints = (int)rxf.value[0];
if ( noOfPoints > noofpoints)
noOfPoints = noofpoints;
if ( attrSize < noOfPoints) if ( attrSize < noOfPoints)
noOfPoints = attrSize; noOfPoints = attrSize;
CdhrFloatArray ry = dyn.en.gdh.getObjectInfoFloatArray( attrName, noOfPoints);
if ( ry.evenSts())
return;
curveY = new float[noOfPoints]; curveY = new float[noOfPoints];
curveX = new float[noOfPoints]; curveX = new float[noOfPoints];
for ( int i = 0; i < noOfPoints; i++) { for ( int i = 0; i < noOfPoints; i++) {
curveY[i] = (ry.value[i] - y_min_value) / ( y_max_value - y_min_value); curveX[i] = (rxf.value[2*i+1] - x_min_value) / ( x_max_value - x_min_value);
curveX[i] = (rx.value[i] - x_min_value) / ( x_max_value - x_min_value); curveY[i] = (rxf.value[2*i+2] - y_min_value) / ( y_max_value - y_min_value);
} }
dyn.repaintNow = true; dyn.repaintNow = true;
break; break;
}
break;
case Pwr.eType_Int32:
case Pwr.eType_Int16:
case Pwr.eType_Int8:
case Pwr.eType_UInt32:
case Pwr.eType_UInt16:
case Pwr.eType_UInt8:
rxi = dyn.en.gdh.getObjectInfoIntArray( attrName, size);
if ( rxi.evenSts())
return;
switch ( datatype) {
case GeDyn.eCurveDataType_XYArrays:
curveX = new float[noOfPoints];
for ( int i = 0; i < noOfPoints; i++)
curveX[i] = ((float)rxi.value[i] - x_min_value) / ( x_max_value - x_min_value);
break;
case GeDyn.eCurveDataType_PointArray: case GeDyn.eCurveDataType_PointArray:
curveY = new float[noOfPoints];
curveX = new float[noOfPoints]; curveX = new float[noOfPoints];
curveY = new float[noOfPoints];
for ( int i = 0; i < noOfPoints; i++) { for ( int i = 0; i < noOfPoints; i++) {
curveX[i] = (rx.value[2*i] - x_min_value) / ( x_max_value - x_min_value); curveX[i] = ((float)rxi.value[2*i] - x_min_value) / ( x_max_value - x_min_value);
curveY[i] = (rx.value[2*i+1] - y_min_value) / ( y_max_value - y_min_value); curveY[i] = ((float)rxi.value[2*i+1] - y_min_value) / ( y_max_value - y_min_value);
} }
dyn.repaintNow = true; dyn.repaintNow = true;
break; break;
case GeDyn.eCurveDataType_TableObject: case GeDyn.eCurveDataType_TableObject:
noOfPoints = (int)rx.value[0]; noOfPoints = (int)rxi.value[0];
if ( noOfPoints > noofpoints) if ( noOfPoints > noofpoints)
noOfPoints = noofpoints; noOfPoints = noofpoints;
if ( attrSize < noOfPoints) if ( attrSize < noOfPoints)
...@@ -301,12 +344,60 @@ public class GeDynXYCurve extends GeDynElem { ...@@ -301,12 +344,60 @@ public class GeDynXYCurve extends GeDynElem {
curveY = new float[noOfPoints]; curveY = new float[noOfPoints];
curveX = new float[noOfPoints]; curveX = new float[noOfPoints];
for ( int i = 0; i < noOfPoints; i++) { for ( int i = 0; i < noOfPoints; i++) {
curveX[i] = (rx.value[2*i+1] - x_min_value) / ( x_max_value - x_min_value); curveX[i] = ((float)rxi.value[2*i+1] - x_min_value) / ( x_max_value - x_min_value);
curveY[i] = (rx.value[2*i+2] - y_min_value) / ( y_max_value - y_min_value); curveY[i] = ((float)rxi.value[2*i+2] - y_min_value) / ( y_max_value - y_min_value);
} }
dyn.repaintNow = true; dyn.repaintNow = true;
break; break;
} }
break;
default:
return;
}
// Read y-array
switch ( datatype) {
case GeDyn.eCurveDataType_XYArrays:
attrName = dyn.getAttrName( y_attr);
attrSize = GeDyn.getAttrSize( y_attr);
if ( attrSize < noOfPoints)
noOfPoints = attrSize;
curveY = new float[noOfPoints];
CdhrFloatArray ryf;
CdhrIntArray ryi;
switch ( yAttrType) {
case Pwr.eType_Float32:
ryf = dyn.en.gdh.getObjectInfoFloatArray( attrName, noOfPoints);
if ( ryf.evenSts())
return;
for ( int i = 0; i < noOfPoints; i++)
curveY[i] = (ryf.value[i] - y_min_value) / ( y_max_value - y_min_value);
dyn.repaintNow = true;
break;
case Pwr.eType_Int32:
case Pwr.eType_Int16:
case Pwr.eType_Int8:
case Pwr.eType_UInt32:
case Pwr.eType_UInt16:
case Pwr.eType_UInt8:
ryi = dyn.en.gdh.getObjectInfoIntArray( attrName, noOfPoints);
if ( ryi.evenSts())
return;
for ( int i = 0; i < noOfPoints; i++)
curveY[i] = ((float)ryi.value[i] - y_min_value) / ( y_max_value - y_min_value);
dyn.repaintNow = true;
break;
default:
return;
}
break;
}
} }
firstScan = false; firstScan = false;
......
...@@ -44,3 +44,5 @@ ...@@ -44,3 +44,5 @@
070821 cs convert Template with includes inserted at structfile generation. 070821 cs convert Template with includes inserted at structfile generation.
070905 cs doc New Guide to I/O Systems. 070905 cs doc New Guide to I/O Systems.
070906 cs statussrv Functionality to view userstatus added. 070906 cs statussrv Functionality to view userstatus added.
070918 cs wbl New systemclass $ClassLost to replace lost classes.
070919 cs wbl New class XyCurve to view a curve of points with x,y coordiantes.
\ No newline at end of file
This diff is collapsed.
...@@ -71,3 +71,6 @@ ...@@ -71,3 +71,6 @@
070827 cs wtt Objects in the navigator beneath a MountObject are viewed with classes from their dbs-file. 070827 cs wtt Objects in the navigator beneath a MountObject are viewed with classes from their dbs-file.
070905 cs utl Bugfix in listdescriptor. Superclass attributes where not printed. 070905 cs utl Bugfix in listdescriptor. Superclass attributes where not printed.
070905 cs wb Bugfix in ldh_GetClassListAttrRef, success status was returned though list was empty. 070905 cs wb Bugfix in ldh_GetClassListAttrRef, success status was returned though list was empty.
070917 cs plc Bugfix, reference connections could not be set in gtk.
070918 cs wb Lost classes replaced with $ClassLost when reading wb_load file.
070919 cs wb Defaultvalues inserted into template objects when new attribute objects are added to a class.
\ No newline at end of file
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