本文整理汇总了C++中DBObjTableField::FloatNoData方法的典型用法代码示例。如果您正苦于以下问题:C++ DBObjTableField::FloatNoData方法的具体用法?C++ DBObjTableField::FloatNoData怎么用?C++ DBObjTableField::FloatNoData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBObjTableField
的用法示例。
在下文中一共展示了DBObjTableField::FloatNoData方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RGlibPointSubbasinCenter
DBInt RGlibPointSubbasinCenter(DBObjData *pntData, DBObjData *netData) {
DBCoordinate massCoord;
DBVPointIF *pntIF = new DBVPointIF(pntData);
DBObjTable *pointTable = pntData->Table(DBrNItems);
DBObjTableField *massCoordXFLD = pointTable->Field(RGlibMassCoordX);
DBObjTableField *massCoordYFLD = pointTable->Field(RGlibMassCoordY);
DBNetworkIF *netIF = new DBNetworkIF(netData);
DBObjRecord *pointRec, *cellRec;
if (massCoordXFLD == NULL) {
massCoordXFLD = new DBObjTableField(RGlibMassCoordX, DBTableFieldFloat, "%10.3f", sizeof(DBFloat4));
pointTable->AddField(massCoordXFLD);
}
if (massCoordYFLD == NULL) {
massCoordYFLD = new DBObjTableField(RGlibMassCoordY, DBTableFieldFloat, "%10.3f", sizeof(DBFloat4));
pointTable->AddField(massCoordYFLD);
}
for (pointRec = pntIF->FirstItem(); pointRec != (DBObjRecord *) NULL; pointRec = pntIF->NextItem()) {
if ((pointRec->Flags() & DBObjectFlagIdle) == DBObjectFlagIdle) {
massCoordXFLD->Float(pointRec, massCoordXFLD->FloatNoData());
massCoordYFLD->Float(pointRec, massCoordYFLD->FloatNoData());
continue;
}
if (DBPause(pointRec->RowID() * 100 / pntIF->ItemNum())) goto Stop;
if ((cellRec = netIF->Cell(pntIF->Coordinate(pointRec))) == (DBObjRecord *) NULL)
massCoord = pntIF->Coordinate(pointRec);
else {
if (netIF->CellBasinCells(cellRec) > 1) {
massCoord.X = 0.0;
massCoord.Y = 0.0;
netIF->UpStreamSearch(cellRec, (DBNetworkACTION) _RGlibSubbasinCenterAction, &massCoord);
massCoord.X = massCoord.X / (DBFloat) netIF->CellBasinCells(cellRec);
massCoord.Y = massCoord.Y / (DBFloat) netIF->CellBasinCells(cellRec);
}
else massCoord = netIF->Center(cellRec);
}
massCoordXFLD->Float(pointRec, massCoord.X);
massCoordYFLD->Float(pointRec, massCoord.Y);
}
Stop:
if (pointRec != (DBObjRecord *) NULL) {
pointTable->DeleteField(massCoordXFLD);
pointTable->DeleteField(massCoordYFLD);
return (DBFault);
}
return (DBSuccess);
}
示例2: RGISAnalyseLineSSampleGridCBK
//.........这里部分代码省略.........
XtVaCreateManagedWidget ("RGISAnalyseLineSSampleNameLabel",xmLabelWidgetClass,mainForm,
XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
XmNtopWidget, button,
XmNleftAttachment, XmATTACH_FORM,
XmNleftOffset, 10,
XmNrightAttachment, XmATTACH_WIDGET,
XmNrightWidget, toNameTextF,
XmNrightOffset, 10,
XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
XmNbottomWidget, button,
XmNlabelString, string,
NULL);
XmStringFree (string);
XtAddCallback (UIDialogFormGetOkButton (dShell),XmNactivateCallback,(XtCallbackProc) UIAuxSetBooleanTrueCBK,&sample);
}
sample = false;
UIDialogFormPopup (dShell);
while (UILoop ())
{
allowOk = false;
fText = XmTextFieldGetString (fromNameTextF);
if (strlen (fText) > 0) allowOk = true;
XtFree (fText);
fText = XmTextFieldGetString (toNameTextF);
if (strlen (fText) > 0) allowOk = true;
XtFree (fText);
XtSetSensitive (UIDialogFormGetOkButton (dShell),allowOk);
}
UIDialogFormPopdown (dShell);
if (sample)
{
DBInt ret;
DBFloat value;
DBCoordinate coord;
DBGridIF *gridIF = new DBGridIF (grdData);
DBVLineIF *lineIF = new DBVLineIF (dbData);
DBObjTableField *fromField;
DBObjTableField *toField;
DBObjRecord *record;
fText = XmTextFieldGetString (fromNameTextF);
if (strlen (fText) > 0)
{
if ((fromField = itemTable->Field (fText)) == (DBObjTableField *) NULL)
itemTable->AddField (fromField = new DBObjTableField (fText,DBTableFieldFloat,"%10.3f",sizeof (DBFloat4)));
}
else fromField = (DBObjTableField *) NULL;
XtFree (fText);
fText = XmTextFieldGetString (toNameTextF);
if (strlen (fText) > 0)
{
if ((toField = itemTable->Field (fText)) == (DBObjTableField *) NULL)
itemTable->AddField (toField = new DBObjTableField (fText,DBTableFieldFloat,"%10.3f",sizeof (DBFloat4)));
}
else toField = (DBObjTableField *) NULL;
XtFree (fText);
UIPauseDialogOpen ((char *) "Sampling Grid");
for (record = itemTable->First ();record != (DBObjRecord *) NULL;record = itemTable->Next ())
{
if (UIPause (record->RowID () * 100 / itemTable->ItemNum ())) goto Stop;
if (fromField != (DBObjTableField *) NULL)
{
coord = lineIF->FromCoord (record);
ret = gridIF->Value (coord,&value);
if (fromField->Type () == DBTableFieldFloat)
{
if (ret) fromField->Float (record,value);
else fromField->Float (record,fromField->FloatNoData ());
}
else
{
if (ret) fromField->Int (record,(DBInt) value);
else fromField->Int (record,fromField->IntNoData ());
}
}
if (toField != (DBObjTableField *) NULL)
{
coord = lineIF->ToCoord (record);
ret = gridIF->Value (coord,&value);
if (toField->Type () == DBTableFieldFloat)
{
if (ret) toField->Float (record,value);
else toField->Float (record,toField->FloatNoData ());
}
else
{
if (ret) toField->Int (record,(DBInt) value);
else toField->Int (record,toField->IntNoData ());
}
}
}
Stop:
UIPauseDialogClose ();
delete lineIF;
delete gridIF;
}
}
示例3: RGlibGenFuncFieldCalculate
DBInt RGlibGenFuncFieldCalculate (DBObjTable *table,char *f0Text,char *f1Text,char *rText,DBInt oper)
{
DBInt intVal, ret = false, i, rowID;
DBFloat val [2];
DBObjTableField *field [2];
DBObjTableField *result;
DBObjRecord *record;
field [0] = table->Field (f0Text);
field [1] = table->Field (f1Text);
result = table->Field (rText);
if ((field [0] == (DBObjTableField *) NULL) && (sscanf (f0Text,"%lf",val) != 1)) return (DBFault);
if ((field [1] == (DBObjTableField *) NULL) && (sscanf (f1Text,"%lf",val + 1) != 1)) return (DBFault);
if (result == (DBObjTableField *) NULL)
table->AddField (result = new DBObjTableField (rText,DBTableFieldFloat,"%10.3f",sizeof (DBFloat4)));
if (field [0] != (DBObjTableField *) NULL)
result->Format (field [0]->Format ());
else if (field [1] != (DBObjTableField *) NULL)
result->Format (field [1]->Format ());
for (rowID = 0;rowID < table->ItemNum ();++rowID)
{
record = table->Item (rowID);
if ((record->Flags () & DBObjectFlagIdle) == DBObjectFlagIdle)
result->Float (record,result->FloatNoData ());
else
{
for (i = 0;i < 2;++i)
if (field [i] != (DBObjTableField *) NULL)
{
ret = false;
if (field [i]->Type () == DBTableFieldInt)
{
intVal = field [i]->Int (record);
val [i] = (DBFloat) intVal;
ret = intVal == field [i]->IntNoData ();
}
else
{
val [i] = field [i]->Float (record);
ret = CMmathEqualValues (val [i],field [i]->FloatNoData ());
}
if (ret)
{
result->Float (record,result->FloatNoData ());
goto Continue;
}
}
if ((oper == DBMathOperatorDiv) && (val [1] == 0))
result->Float (record,result->FloatNoData ());
else
switch (oper)
{
case DBMathOperatorAdd: result->Float (record, val [0] + val [1]); break;
case DBMathOperatorSub: result->Float (record, val [0] - val [1]); break;
case DBMathOperatorMul: result->Float (record, val [0] * val [1]); break;
case DBMathOperatorDiv: result->Float (record, val [0] / val [1]); break;
default: CMmsgPrint (CMmsgAppError, "Invalid Operand in: %s %d",__FILE__,__LINE__); break;
}
Continue:
continue;
}
}
return (DBSuccess);
}
示例4: RGlibPointSTNCharacteristics
DBInt RGlibPointSTNCharacteristics(DBObjData *dbData) {
DBInt i, pointID, dPointID, cellID, mouthID, basinID, color, ret = DBFault, dir;
DBVPointIF *pntIF;
DBObjTable *pointTable, *cellTable;
DBObjTableField *cellIDFLD;
DBObjTableField *basinFLD;
DBObjTableField *basinNameFLD;
DBObjTableField *orderFLD;
DBObjTableField *colorFLD;
DBObjTableField *basinCellsFLD;
DBObjTableField *basinLengthFLD;
DBObjTableField *basinAreaFLD;
DBObjTableField *interAreaFLD;
DBObjTableField *nextStationFLD;
DBObjData *netData;
DBNetworkIF *netIF;
DBObjRecord *pointRec, *dPointRec, *cellRec, *fromCell, *basinRec;
if ((netData = dbData->LinkedData()) == (DBObjData *) NULL) return (DBFault);
pointTable = dbData->Table(DBrNItems);
pntIF = new DBVPointIF(dbData);
netIF = new DBNetworkIF(netData);
cellTable = netData->Table(DBrNCells);
if ((cellIDFLD = pointTable->Field(RGlibCellID)) == NULL) {
cellIDFLD = new DBObjTableField(RGlibCellID, DBTableFieldInt, "%8d", sizeof(DBInt));
pointTable->AddField(cellIDFLD);
DBPause(1);
}
if ((basinFLD = pointTable->Field(DBrNBasin)) == NULL) {
basinFLD = new DBObjTableField(DBrNBasin, DBTableFieldInt, "%8d", sizeof(DBInt));
pointTable->AddField(basinFLD);
DBPause(2);
}
if ((basinNameFLD = pointTable->Field(RGlibBasinName)) == NULL) {
basinNameFLD = new DBObjTableField(RGlibBasinName, DBTableFieldString, "%32s", DBStringLength);
pointTable->AddField(basinNameFLD);
DBPause(3);
}
if ((orderFLD = pointTable->Field(DBrNOrder)) == NULL) {
orderFLD = new DBObjTableField(DBrNOrder, DBTableFieldInt, "%3d", sizeof(DBByte));
pointTable->AddField(orderFLD);
DBPause(4);
}
if ((colorFLD = pointTable->Field(RGlibColor)) == NULL) {
colorFLD = new DBObjTableField(RGlibColor, DBTableFieldInt, "%2d", sizeof(DBShort));
pointTable->AddField(colorFLD);
DBPause(5);
}
if ((basinCellsFLD = pointTable->Field(RGlibCellNum)) == NULL) {
basinCellsFLD = new DBObjTableField(RGlibCellNum, DBTableFieldInt, "%8d", sizeof(DBInt));
pointTable->AddField(basinCellsFLD);
DBPause(6);
}
if ((basinLengthFLD = pointTable->Field(RGlibLength)) == NULL) {
basinLengthFLD = new DBObjTableField(RGlibLength, DBTableFieldFloat, "%10.1f", sizeof(DBFloat4));
pointTable->AddField(basinLengthFLD);
DBPause(7);
}
if ((basinAreaFLD = pointTable->Field(RGlibArea)) == NULL) {
basinAreaFLD = new DBObjTableField(RGlibArea, DBTableFieldFloat, "%10.1f", sizeof(DBFloat4));
pointTable->AddField(basinAreaFLD);
DBPause(8);
}
if ((interAreaFLD = pointTable->Field(RGlibInterStation)) == NULL) {
interAreaFLD = new DBObjTableField(RGlibInterStation, DBTableFieldFloat, "%10.1f", sizeof(DBFloat4));
pointTable->AddField(interAreaFLD);
DBPause(9);
}
if ((nextStationFLD = pointTable->Field(RGlibNextStation)) == NULL) {
nextStationFLD = new DBObjTableField(RGlibNextStation, DBTableFieldInt, "%8d", sizeof(DBInt));
pointTable->AddField(nextStationFLD);
DBPause(10);
}
if ((_RGlibTEMPPointIDFLD = cellTable->Field(RGlibTEMPPointID)) == NULL) {
_RGlibTEMPPointIDFLD = new DBObjTableField(RGlibTEMPPointID, DBTableFieldInt, "%8d", sizeof(DBInt));
cellTable->AddField(_RGlibTEMPPointIDFLD);
}
for (pointID = 0; pointID < pointTable->ItemNum(); pointID++) {
pointRec = pointTable->Item(pointID);
if (DBPause(10 + pointID * 10 / pointTable->ItemNum())) goto Stop;
if ((pointRec->Flags() & DBObjectFlagIdle) == DBObjectFlagIdle) {
cellIDFLD->Int(pointRec, cellIDFLD->IntNoData());
basinFLD->Int(pointRec, basinFLD->IntNoData());
basinNameFLD->String(pointRec, "");
orderFLD->Int(pointRec, orderFLD->IntNoData());
colorFLD->Int(pointRec, colorFLD->IntNoData());
basinCellsFLD->Int(pointRec, basinCellsFLD->IntNoData());
basinAreaFLD->Float(pointRec, basinAreaFLD->FloatNoData());
interAreaFLD->Float(pointRec, interAreaFLD->FloatNoData());
continue;
}
if ((cellRec = netIF->Cell(pntIF->Coordinate(pointRec))) == (DBObjRecord *) NULL) {
cellIDFLD->Int(pointRec, 0);
basinFLD->Int(pointRec, 0);
basinNameFLD->String(pointRec, "Water");
orderFLD->Int(pointRec, colorFLD->IntNoData());
colorFLD->Int(pointRec, colorFLD->IntNoData());
basinCellsFLD->Int(pointRec, 0);
basinAreaFLD->Float(pointRec, 0.0);
interAreaFLD->Float(pointRec, 0.0);
//.........这里部分代码省略.........
示例5: main
//.........这里部分代码省略.........
{
CMmsgPrint (CMmsgUsrError, "Field is not Numeric: %s",p->getOldName());
return(DBFault);
}
}
outTable->AddField(p->field);
p = p->next;
}
// MAKE SURE TO TEST FOR SPEED BY DECLARING INTS OUTSIDE OF FOR LOOPS!!!
for (int inRecID = 0;inRecID < inTable->ItemNum();++inRecID)
{
inRecord = inTable->Item(inRecID);
if ((outRecord = FindMatch(inRecord, outTable,(const Groups**) groups, numGrpNames)) != (DBObjRecord *) NULL)
{
p = head->next;
while(p)
{
field = fields->Item (p->getOldName());
switch(p->getFunc())
{
default:
break;
case NUM:
p->field->Int(outRecord,p->field->Int(outRecord) + 1);
break;
case NONNULL:
if (p->isInt())
{
if (field->Int(inRecord) != field->IntNoData()) p->field->Int(outRecord,p->field->Int(outRecord) + 1);
}
else
{
if (!CMmathEqualValues(field->Float(inRecord),field->FloatNoData()))
p->field->Int(outRecord,p->field->Int(outRecord) + 1);
}
break;
case MIN:
if (p->isInt())
{
if(field->Int(inRecord) != field->IntNoData())
{
if (p->field->Int(outRecord) != p->field->IntNoData())
{ if (field->Int(inRecord) < p->field->Int(outRecord)) p->field->Int(outRecord,field->Int(inRecord)); }
else { p->field->Int(outRecord,field->Int(inRecord)); }
}
}
else
{
if (!CMmathEqualValues(field->Float(inRecord),field->FloatNoData()))
{
if (!CMmathEqualValues(p->field->Float(inRecord),p->field->FloatNoData()))
{ if (field->Float(inRecord) < p->field->Float(outRecord)) p->field->Float(outRecord,field->Float(inRecord)); }
else { p->field->Float(outRecord,field->Float(inRecord)); }
}
}
break;
case MAX:
if (p->isInt())
{
if(field->Int(inRecord) != field->IntNoData())
{
if (p->field->Int(outRecord) != p->field->IntNoData())
{ if (field->Int(inRecord) > p->field->Int(outRecord)) p->field->Int(outRecord,field->Int(inRecord)); }
else { p->field->Int(outRecord,field->Int(inRecord)); }
}