📄 curve.h
字号:
Returns TRUE on successful exit and FALSE on error.
SeeAlso:
Data_sort
*/
BOOL Sort(DWORD dwFlags = 0); // Use a Curve object to sort a Y data set according to an X data set.
/**
Checks whether or not this Curve object has an associated X data set.
Example:
// Assumes Data1_B exists and contains data
Curve crv("Data1_B");
BOOL bHasX = crv.HasX();
Parameters:
strXdatasetName = optional string to receive the X dataset name
Return:
Returns TRUE if this Curve object has an associated X data set.
SeeAlso:
Curve::Attach, Curve::Curve
*/
BOOL HasX(string& strXdatasetName = NULL); // Checks whether or not this Curve object has an associated X data set.
/**
Attach an Origin C Dataset object to the X data set associated with this Curve object (if there is
one) and optionally set the upper and lower bounds of the X data set to the upper and lower bounds
of the Curve object's Y data set.
Example:
// Assumes Data1_A(X) and Data2_B(Y) exist with the following data:
// Data1_B={1,2,3,4,5,6,7}
// Data1_A={1,2,3,4,5,6,7,-10,10};
Curve crv("Data1_B");
Dataset dsX;
BOOL bRet = crv.AttachX(dsX);
double xMin = min( dsX );
double xMax = max( dsX );
printf( "Due to upper bound restriction of Y Dataset the Minimum X in dsX is %g not -10\n", xMin );
printf( "Due to upper bound restriction of Y Dataset the Maximum X in dsX is %g not 10\n", xMax );
Parameters:
dsX=A Dataset object which is attached to the X data set of this Curve object (if any)
SetXRangeToYRange=TRUE (default) sets the upper and lower bounds of the X data set to the upper
and lower bounds of the Curve object's Y data set. This setting is temporary and may be over-
ridden when using multiple Curve objects linked to the same X data set.
Return:
Returns TRUE if the Curve object has an associated X data set and the attachment is successful and FALSE
if there is no X data set or the attachment fails.
SeeAlso:
Dataset::Attach, Curve::Attach, Curve::Detach
*/
BOOL AttachX(Dataset& dsX, BOOL SetXRangeToYRange = TRUE); // Attach an Origin C Dataset object to the X data set associated with this Curve object.
/**
Set the upper display index of the Dataset range. Index values are 0 based
offsets so use SetUpperBound(-1) to dispaly no rows. SetUpperBound is supported
only for Datasets (not vectors) while GetUpperBound is supported for all
vectorbase derived objects. This allows for creation of more general purpose
functions that can take vectorbase objects as arguments in place of Dataset
objects. Essentially, the upper bound can be read but not written for vectors.
SetUpperIndex is a synonym for SetUpperBound.
Example:
// Worksheet column Data1_A must exist prior to execution
Dataset dsA("Data1_A");
dsA.SetSize(10);
for(int ii = 0; ii < 10; ii++)
dsA[ii] = ii;
dsA.SetLowerBound(2);
dsA.SetUpperBound(7);
BasicStats bsStatVal;
Data_sum(&dsA, &bsStatVal);
ASSERT( bsStatVal.min == 2 );
ASSERT( bsStatVal.max == 7 );
dsA.SetLowerBound(0);
dsA.SetUpperBound(9);
Data_sum(&dsA, &bsStatVal);
ASSERT( bsStatVal.min == 0 );
ASSERT( bsStatVal.max == 9 );
Parameters:
nUpper=New upper display index of the Dataset
Return:
Returns TRUE on successful exit and FALSE on failure.
SeeAlso:
vectorbase::GetUpperBound, vectorbase::GetSize, vectorbase::SetSize, vectorbase::GetLowerBound, Dataset::SetLowerBound
*/
BOOL SetUpperBound(int nUpper); // Set the upper display index of the Dataset.
/**
Set the lower display index of the Dataset range. Index values are 0 based
offsets. SetLowerBound is supported only for Datasets (not vectors) while
GetLowerBound is supported for all vectorbase derived objects. This allows
for creation of more general purpose functions that can take vectorbase
objects as arguments in place of Dataset objects. Essentially, the lower
bound can be read but not written for vectors. SetLowerIndex is a synonym
for SetLowerBound.
Example:
// Worksheet column Data1_A must exist prior to execution
Dataset dsA("Data1_A");
dsA.SetSize(10);
for(int ii = 0; ii < 10; ii++)
dsA[ii] = ii;
dsA.SetLowerBound(2);
dsA.SetUpperBound(7);
BasicStats bsStatVal;
Data_sum(&dsA, &bsStatVal);
ASSERT( bsStatVal.min == 2 );
ASSERT( bsStatVal.max == 7 );
dsA.SetLowerBound(0);
dsA.SetUpperBound(9);
Data_sum(&dsA, &bsStatVal);
ASSERT( bsStatVal.min == 0 );
ASSERT( bsStatVal.max == 9 );
Parameters:
nLower=New lower display index of the Dataset
Return:
Returns TRUE on successful exit and FALSE on failure.
SeeAlso:
vectorbase::GetLowerBound, vectorbase::GetSize, vectorbase::SetSize, vectorbase::GetUpperBound, Dataset::SetUpperBound
*/
BOOL SetLowerBound(int nLower); // Set the lower display index of the Dataset.
/**
Find all the points in a Curve which fall on or within a specified rectangle. The rectangle is specified by
its top-left and bottom-right corners.
Example:
// Assumes Data1_A(X) and Data1_B(Y) exist with the following data:
// Data1_B={1,2,3,4,5,6,7,8,9,10}
// Data1_A={1,2,3,4,5,6,7,8,9,10};
Dataset ds1("Data1_A"), ds2("Data1_B");
Curve crv(ds1, ds2);
fpoint fptTL(3,8);
fpoint fptBR(7,2);
vector<double> vX, vY;
vector<int> vIndex;
int num = crv.GetRectPoints( fptTL, fptBR, vX, vY, vIndex );
Parameters:
fptTopLeft=Input fpoint identifying the top-left corner of the rectangle
fptBottomRight=Input fpoint identifying the bottom-right corner of the rectangle
vX=Output vector containing the X coordinates of all points in the rectangele, paired with vY and vIndex
vY=Output vector containing the Y coordinates of all points in the rectangele, paired with vX and vIndex
vIndex=Output vector containing the row index (0 based) into the Curve's X and Y data sets, paired with vX and vY
Return:
Returns the number of data points found within the rectangle (0,1,2,3...) on success and returns a
negative integer on failure. Also returns the coordinates and index of all points within the rectangle.
*/
int GetRectPoints( fpoint& fptTopLeft, fpoint& fptBottomRight, vector<double>& vX, vector<double>& vY, vector<int>& vIndex ); // Find all the points in a Curve which fall on or within a specified rectangle.
/**
Example:
void run_GetSourceRange()
{
// Assumes Data1_A(X) and Data1_B(Y) exist with the following data:
// Data1_B={1,2,3,4,5,6,7,8,9,10}
// Data1_A={1,2,3,4,5,6,7,8,9,10};
Curve crv("Data1_B");
int nLow, nUp;
crv.SetLowerBound(1);
crv.SetUpperBound(8);
bool bOK = crv.GetSourceRange(nLow, nUp);
out_int("bOK = ", bOK);
}
*/
bool GetSourceRange(int &nLower, int &nUpper);
/**
It copies x values from cbSource.
Example:
// The example assumes that the worksheet "Data1" exists with four columns
// A, B, C, D, and some values in them.
Curve crvData("data1_a", "data1_b");
Curve crvBaseline("data1_c", "data1_d");
BOOL bOK = crvBaseline.CopyX(crvData);
out_int("OK = ", bOK);
Parameters:
cbSource=the source curve
Return:
TRUE for success, otherwise FALSE.
*/
bool CopyX(curvebase &cbSource);
/**
Example:
void run_CopyData()
{
// Assumes Data1_A(X) and Data1_B(Y) with the following data:
// Data1_B={1,2,3,4,5,6,7,8,9,10}
// Data1_A={1,2,3,4,5,6,7,8,9,10};
Curve crv("Data1_A", "Data1_B");
vector vDatax;
vector vDatay;
bool bOK = crv.CopyData(vDatax, vDatay);
out_int("bOK = ", bOK);
}
*/
bool CopyData(vector& vx, vector& vy, vector& yWeight = NULL, vector& xWeight = NULL);
};
/** >Composite Data Types
An Origin C Curve is comprised of a Y Dataset and typically (but not necessarily)
an associated X Dataset. For example, a data set plotted against row numbers
will not have an associated X data set. An Origin C Curve object can easily be
plotted using methods of the GraphLayer class. The Curve class is derived from
the curvebase, and vectorbase classes from which it inherits methods and
properties.
Example:
// Assumes Data1_A and Data1_B exist and contain data
Dataset ds1("Data1_A"), ds2("Data1_B");
Curve crvCopy( ds1, ds2 );
crvCopy.Sort(); // Does not effect ds1, ds2
*/
class Curve : public curvebase
{
public:
/**
Default constructor for Curve class.
Example:
// Assumes Data1_A and Data1_B exist and contain data
Curve crv; // Use default constructor to create unattached Origin C Curve object
crv.Attach( "Data1_A", "Data1_B" ); // Attach Origin C Curve object to internal Origin data sets
crv.Sort(); // Does effect Data1_A and Data1_B
SeeAlso:
Curve::Attach, Curve::Detach
*/
Curve(); // Default constructor for Curve class.
/**
Copy constructor for Curve class. The original Y data set is copied into a new Curve object and
is then associated with a copy of the original X data set. The Datasets of the original Curve
object are not effected by operations on the copy Curve.
Example:
// Assumes Data1_A and Data1_B exist and contain data
Dataset ds1("Data1_A"), ds2("Data1_B");
Curve crv1( ds1, ds2 );
Curve crv2( crv1 );
crv2.Sort(); // Does not effect ds1, ds2
Parameters:
crvOriginal=Curve object which is copied
SeeAlso:
Curve::Attach, Curve::Detach
*/
Curve(Curve crvOriginal); // Copy constructor for Curve class.
/**
Constructor for Curve class. The Y data set is specified by name and, if it exists, the Y data
set's internally associated X data set is automatically used for the X data set. Otherwise, row numbers
are used for the X data set. Operations on the Curve object do effect the X and/or the specified Y data
set(s).
Example:
// Assumes Data1_B exists and contains data
Curve crv( "Data1_B" );
crv.Sort(); // Does effect Data1_B
Parameters:
lpcszYData=Name of Y Dataset
SeeAlso:
Curve::Attach, Curve::Detach
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -