本文整理汇总了C++中DBObjectLIST::First方法的典型用法代码示例。如果您正苦于以下问题:C++ DBObjectLIST::First方法的具体用法?C++ DBObjectLIST::First怎么用?C++ DBObjectLIST::First使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBObjectLIST
的用法示例。
在下文中一共展示了DBObjectLIST::First方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Draw
void UIAttribView::Draw (DBObjRecord *record)
{
DBObjTableField *field;
DBObjectLIST<DBObjTableField> *fields;
UIXYGraphShell *graphCLS;
if (record == (DBObjRecord *) NULL)
{
Cardinal i, numChildren;
WidgetList rowCols;
UIAuxSetLabelString (ItemNameWGT,(char *) "");
XtVaGetValues (FieldsRowCol,XmNchildren, &rowCols, XmNnumChildren, &numChildren,NULL);
for (i = 0;i < numChildren; ++i)
XmTextFieldSetString (XtNameToWidget (rowCols [i],"UIAttribViewTextField"),(char *) "");
return;
}
UIAuxSetLabelString (ItemNameWGT,record->Name ());
switch (DataPTR->Type ())
{
case DBTypeVectorPoint:
case DBTypeVectorLine:
case DBTypeVectorPolygon:
case DBTypeGridDiscrete:
fields = ItemTable->Fields ();
for (field = fields->First ();field != (DBObjTableField *) NULL;field = fields->Next ())
if (DBTableFieldIsVisible (field) == true) DrawField (field->Name (),field->String (record));
break;
case DBTypeGridContinuous:
{
DBCoordinate coord = *((DBCoordinate *) (record->Data ()));
DBGridIF *gridIF = new DBGridIF (DataPTR);
for (record = ItemTable->First ();record != (DBObjRecord *) NULL;record = ItemTable->Next ())
DrawField (record->Name (),gridIF->ValueString (record,coord));
delete gridIF;
} break;
case DBTypeNetwork:
{
DBObjTable *cellTable = DataPTR->Table (DBrNCells);
DBObjTableField *basinFLD = cellTable->Field (DBrNBasin);
DBObjRecord *basinRec;
if ((basinRec = ItemTable->Item (basinFLD->Int (record) - 1)) == (DBObjRecord *) NULL)
{ CMmsgPrint (CMmsgAppError, "BasinID Error in:%s %d",__FILE__,__LINE__); return; }
DrawField ((char *) "Basin Name",basinRec->Name ());
fields = ItemTable->Fields ();
for (field = fields->First ();field != (DBObjTableField *) NULL;field = fields->Next ())
if (DBTableFieldIsVisible (field) == true) DrawField (field->Name (),field->String (basinRec));
fields = cellTable->Fields ();
for (field = fields->First ();field != (DBObjTableField *) NULL;field = fields->Next ())
if (DBTableFieldIsVisible (field) == true) DrawField (field->Name (),field->String (record));
} break;
default: break;
}
if ((graphCLS = (UIXYGraphShell *) DataPTR->Display (UIXYGraphShellStr)) != (UIXYGraphShell *) NULL)
graphCLS->Configure (record);
}
示例2: BuildFields
int DBObjData::BuildFields() {
DBInt ret = DBSuccess;
DBObjTable *table, *refTable;
DBObjRecord *tableRec;
DBObjTableField *field;
DBObjectLIST<DBObjTableField> *tableFLDs;
for (table = TablesPTR->First(); table != (DBObjTable *) NULL; table = TablesPTR->Next()) {
tableFLDs = table->Fields();
for (field = tableFLDs->First(); field != (DBObjTableField *) NULL; field = tableFLDs->Next())
switch (field->Type()) {
case DBTableFieldTableRec:
if ((refTable = TablesPTR->Item(field->RecordProp())) == (DBObjTable *) NULL) {
CMmsgPrint(CMmsgAppError, "Corrupt Dataset in: %s %d", __FILE__, __LINE__);
ret = DBFault;
continue;
}
for (tableRec = table->First(); tableRec != (DBObjRecord *) NULL; tableRec = table->Next())
if ((DBInt) (field->Record(tableRec) - (DBObjRecord *) NULL) != DBFault)
field->Record(tableRec,
refTable->Item((DBInt) ((char *) (field->Record(tableRec)) - (char *) NULL)));
else field->Record(tableRec, (DBObjRecord *) NULL);
break;
case DBTableFieldDataRec:
for (tableRec = table->First(); tableRec != (DBObjRecord *) NULL; tableRec = table->Next())
if ((DBInt) (field->Record(tableRec) - (DBObjRecord *) NULL) != DBFault)
field->Record(tableRec, ArraysPTR->Item(
(DBInt) ((char *) (field->Record(tableRec)) - (char *) NULL)));
else field->Record(tableRec, (DBObjRecord *) NULL);
break;
}
}
return (ret);
}
示例3: DBObject
DBObjData::DBObjData(DBObjData &data) : DBObject(data), DBDataHeader(data._Header()) {
DBObjTable *table;
DBObjRecord *record, *obj;
DBObjTableField *field;
DBObjectLIST<DBObjTableField> *fields;
strcpy(FileNameSTR, "");
TablesPTR = new DBObjectLIST<DBObjTable>(*data.TablesPTR);
DocsPTR = new DBObjectLIST<DBObjRecord>(*data.DocsPTR);
ArraysPTR = new DBObjectLIST<DBObjRecord>(*data.ArraysPTR);
DispPTR = new DBObjectLIST<DBObject>("Data Display");
LinkedDataPTR = (DBObjData *) NULL;
for (table = TablesPTR->First(); table != (DBObjTable *) NULL; table = TablesPTR->Next()) {
fields = table->Fields();
for (record = table->First(); record != (DBObjRecord *) NULL; record = table->Next()) {
for (field = fields->First(); field != (DBObjTableField *) NULL; field = fields->Next())
switch (field->Type()) {
case DBTableFieldTableRec:
case DBTableFieldDataRec:
if ((obj = field->Record(record)) != NULL)
field->Record(record, (DBObjRecord *) ((char *) NULL + obj->RowID()));
else field->Record(record, (DBObjRecord *) DBFault);
break;
}
}
}
BuildFields();
}
示例4: DBPointToGrid
DBInt DBPointToGrid(DBObjData *pntData, DBObjData *netData, DBObjData *grdData) {
DBInt i;
DBPosition pos;
DBObjTable *pntTable = pntData->Table(DBrNItems);
DBObjTable *grdTable = grdData->Table(DBrNItems);
DBObjTable *symTable = grdData->Table(DBrNSymbols);
DBObjectLIST<DBObjTableField> *pntFields = pntTable->Fields();
DBObjTableField *pntFLD;
DBObjTableField *grdAttribFLD;
DBObjTableField *grdFLD = grdTable->Field(DBrNGridValue);
DBObjTableField *symFLD = grdTable->Field(DBrNSymbol);
DBObjRecord *cellRec, *toCell, *pntRec, *itemRec;
DBObjRecord *symRec = symTable->First();
DBVPointIF *pntIF;
DBNetworkIF *netIF;
DBGridIF *grdIF;
pntIF = new DBVPointIF(pntData);
netIF = new DBNetworkIF(netData);
grdIF = new DBGridIF(grdData);
grdIF->RenameLayer(grdIF->Layer((DBInt) 0), (char *) "Subbasins");
for (pos.Row = 0; pos.Row < grdIF->RowNum(); ++pos.Row)
for (pos.Col = 0; pos.Col < grdIF->ColNum(); ++pos.Col) grdIF->Value(pos, DBFault);
for (pntFLD = pntFields->First(); pntFLD != (DBObjTableField *) NULL; pntFLD = pntFields->Next())
if (DBTableFieldIsVisible(pntFLD)) grdTable->AddField(new DBObjTableField(*pntFLD));
for (i = 0; i < pntIF->ItemNum(); ++i) {
DBPause(i * 100 / pntIF->ItemNum());
pntRec = pntIF->Item(i);
if ((pntRec->Flags() & DBObjectFlagIdle) == DBObjectFlagIdle) continue;
if ((cellRec = netIF->Cell(pntIF->Coordinate(pntRec))) == (DBObjRecord *) NULL) continue;
itemRec = grdTable->Add(pntRec->Name());
grdFLD->Int(itemRec, pntRec->RowID() + 1);
symFLD->Record(itemRec, symRec);
for (pntFLD = pntFields->First(); pntFLD != (DBObjTableField *) NULL; pntFLD = pntFields->Next())
if ((grdAttribFLD = grdTable->Field(pntFLD->Name())) != (DBObjTableField *) NULL)
switch (pntFLD->Type()) {
case DBTableFieldString:
grdAttribFLD->String(itemRec, pntFLD->String(pntRec));
break;
case DBTableFieldInt:
grdAttribFLD->Int(itemRec, pntFLD->Int(pntRec));
break;
case DBTableFieldFloat:
grdAttribFLD->Float(itemRec, pntFLD->Float(pntRec));
break;
case DBTableFieldDate:
grdAttribFLD->Date(itemRec, pntFLD->Date(pntRec));
break;
}
grdIF->Value(netIF->CellPosition(cellRec), itemRec->RowID());
}
for (i = 0; i < netIF->CellNum(); ++i) {
if ((cellRec = netIF->Cell(i)) == (DBObjRecord *) NULL) continue;
if ((itemRec = grdIF->GridItem(netIF->CellPosition(cellRec))) != (DBObjRecord *) NULL) continue;
if ((toCell = netIF->ToCell(cellRec)) == (DBObjRecord *) NULL) continue;
if ((itemRec = grdIF->GridItem(netIF->CellPosition(toCell))) != (DBObjRecord *) NULL)
grdIF->Value(netIF->CellPosition(cellRec), itemRec->RowID());
}
grdIF->DiscreteStats();
delete pntIF;
delete netIF;
delete grdIF;
return (DBSuccess);
}
示例5: return
UI2DView *UI2DViewFirst() { return (_UI2DViewLIST.First ()); }
示例6: DBObject
UIAttribView::UIAttribView (DBObjData *data) : DBObject (data->Name (),sizeof (UIAttribView))
{
DBObjTableField *field;
DBObjectLIST<DBObjTableField> *fields;
Widget mainForm, scrolledW, rowCol, label;
XmString string;
Atom deleteWindowAtom = XmInternAtom(XtDisplay(UITopLevel ()),(char *) "WM_DELETE_WINDOW",FALSE);
DataPTR = data;
ItemTable = DataPTR->Table (DBrNItems);
Name (UIAttribViewSTR);
DShellWGT = XtVaCreatePopupShell ("UIAttribView",xmDialogShellWidgetClass,UITopLevel (),
XmNkeyboardFocusPolicy, XmPOINTER,
XmNtitle, data->Name (),
XmNtransient, False,
XmNminWidth, 400,
XmNminHeight, 300,
NULL);
XmAddWMProtocolCallback (DShellWGT,deleteWindowAtom,(XtCallbackProc) _UIAttribViewDeleteCBK,(XtPointer) this);
mainForm = XtVaCreateWidget ("UIAttribViewForm",xmFormWidgetClass,DShellWGT,
XmNshadowThickness, 0,
NULL);
string = XmStringCreate ((char *) "Item:",UICharSetBold);
label = XtVaCreateManagedWidget ("UIAttribViewNameLabel",xmLabelWidgetClass,mainForm,
XmNtopAttachment, XmATTACH_FORM,
XmNtopOffset, 5,
XmNleftAttachment, XmATTACH_FORM,
XmNleftOffset, 10,
XmNlabelString, string,
XmNrecomputeSize, False,
NULL);
XmStringFree (string);
string = XmStringCreate ((char *) "",UICharSetNormal);
ItemNameWGT = XtVaCreateManagedWidget ("UIAttribViewNameText",xmLabelWidgetClass,mainForm,
XmNtopAttachment, XmATTACH_FORM,
XmNtopOffset, 5,
XmNleftAttachment, XmATTACH_WIDGET,
XmNleftWidget, label,
XmNleftOffset, 5,
XmNlabelString, string,
NULL);
XmStringFree (string);
scrolledW = XtVaCreateManagedWidget ("UIAttribViewScrolledW",xmScrolledWindowWidgetClass,mainForm,
XmNtopAttachment, XmATTACH_WIDGET,
XmNtopWidget, label,
XmNtopOffset, 5,
XmNleftAttachment, XmATTACH_FORM,
XmNleftOffset, 5,
XmNrightAttachment, XmATTACH_FORM,
XmNrightOffset, 5,
XmNbottomAttachment, XmATTACH_FORM,
XmNbottomOffset, 5,
XmNheight, 150,
XmNvisualPolicy, XmCONSTANT,
XmNscrollingPolicy, XmAUTOMATIC,
NULL);
rowCol = XtVaCreateManagedWidget ("UIAttribViewRowColumn",xmRowColumnWidgetClass,scrolledW,
XmNnumColumns, 2,
XmNorientation, XmHORIZONTAL,
XmNrowColumnType, XmWORK_AREA,
NULL);
NamesRowCol = XtVaCreateManagedWidget ("UIAttribViewNamesRowColumn",xmRowColumnWidgetClass,rowCol,
XmNorientation, XmVERTICAL,
XmNrowColumnType, XmWORK_AREA,
XmNpacking, XmPACK_COLUMN,
XmNspacing, 0,
NULL);
FieldsRowCol = XtVaCreateManagedWidget ("UIAttribViewNamesRowColumn",xmRowColumnWidgetClass,rowCol,
XmNorientation, XmVERTICAL,
XmNrowColumnType, XmWORK_AREA,
XmNspacing, 0,
NULL);
switch (DataPTR->Type ())
{
case DBTypeVectorPoint:
case DBTypeVectorLine:
case DBTypeVectorPolygon:
case DBTypeGridDiscrete:
fields = ItemTable->Fields ();
for (field = fields->First ();field != (DBObjTableField *) NULL;field = fields->Next ())
if (DBTableFieldIsVisible (field) == true) NewField (field->Name (),field->Format ());
break;
case DBTypeGridContinuous:
{
DBObjRecord *record;
DBGridIF *gridIF = new DBGridIF (DataPTR);
ItemTable = DataPTR->Table (DBrNLayers);
for (record = ItemTable->First ();record != (DBObjRecord *) NULL;record = ItemTable->Next ())
NewField (record->Name (),gridIF->ValueFormat ());
delete gridIF;
} break;
case DBTypeNetwork:
{
DBObjTable *cellTable = DataPTR->Table (DBrNCells);
NewField ((char *) "Basin Name",(char *) "%s");
fields = ItemTable->Fields ();
for (field = fields->First ();field != (DBObjTableField *) NULL;field = fields->Next ())
//.........这里部分代码省略.........
示例7: RGlibPointInterStationTS
DBInt RGlibPointInterStationTS(DBObjData *pntData, DBObjData *tsData, char *relateFldName, char *joinFldName) {
DBInt first = true, tsIndex, tsRowNum = 0;
DBObjTable *pntTBL = pntData->Table(DBrNItems), *tsTBL;
DBObjectLIST<DBObjTableField> *fields;
DBObjTableField *pntNextFLD = pntTBL->Field(RGlibNextStation);
DBObjTableField *pntAreaFLD = pntTBL->Field(RGlibArea);
DBObjTableField *pntInterStnFLD = pntTBL->Field(RGlibInterStation);
DBObjTableField *pntRelateFLD;
DBObjTableField *pntNewNextFLD;
DBObjTableField *pntNewInterStnFLD;
DBObjTableField *tsTimeFLD;
DBObjTableField *tsJoinFLD;
DBObjTableField *tsNextStnFLD, *tsInterStnFLD;
DBObjRecord *pntRec, *nextPntRec, *tsRec, *tsIndexRec;
DBDate curDate, date;
if (pntNextFLD == (DBObjTableField *) NULL) {
CMmsgPrint(CMmsgUsrError, "Missing Next Station Field!");
return (DBFault);
}
if (pntAreaFLD == (DBObjTableField *) NULL) {
CMmsgPrint(CMmsgUsrError, "Missing STN Area Field!");
return (DBFault);
}
if (pntInterStnFLD == (DBObjTableField *) NULL) {
CMmsgPrint(CMmsgUsrError, "Missing Interfluvial Area Field!");
return (DBFault);
}
tsTBL = tsData->Table(DBrNItems);
tsNextStnFLD = new DBObjTableField(RGlibNextStation, DBTableFieldInt, "%8d", sizeof(DBInt));
tsTBL->AddField(tsNextStnFLD);
tsInterStnFLD = new DBObjTableField(RGlibInterStation, DBTableFieldFloat, "%9.1f", sizeof(DBFloat4));
tsTBL->AddField(tsInterStnFLD);
fields = tsTBL->Fields();
for (tsTimeFLD = fields->First(); tsTimeFLD != (DBObjTableField *) NULL; tsTimeFLD = fields->Next())
if (tsTimeFLD->Type() == DBTableFieldDate) break;
if (tsTimeFLD == (DBObjTableField *) NULL) {
CMmsgPrint(CMmsgUsrError, "Missing Date Field!");
return (DBFault);
}
if ((tsJoinFLD = tsTBL->Field(joinFldName)) == (DBObjTableField *) NULL) {
CMmsgPrint(CMmsgUsrError, "Missing Join Field!");
return (DBFault);
}
fields = new DBObjectLIST<DBObjTableField>("Field List");
fields->Add(new DBObjTableField(*tsTimeFLD));
fields->Add(new DBObjTableField(*tsJoinFLD));
tsTBL->ListSort(fields);
delete fields;
pntTBL = new DBObjTable(*pntTBL);
pntNextFLD = pntTBL->Field(RGlibNextStation);
pntAreaFLD = pntTBL->Field(RGlibArea);
pntInterStnFLD = pntTBL->Field(RGlibInterStation);
pntNewNextFLD = new DBObjTableField("NextStnTS", pntNextFLD->Type(), pntNextFLD->Format(), pntNextFLD->Length());
pntNewInterStnFLD = new DBObjTableField("InterFluTS", pntInterStnFLD->Type(), pntInterStnFLD->Format(),
pntInterStnFLD->Length());
pntRelateFLD = pntTBL->Field(relateFldName);
pntTBL->AddField(pntNewNextFLD);
pntTBL->AddField(pntNewInterStnFLD);
pntTBL->ListSort(pntRelateFLD);
tsIndexRec = tsTBL->First(&tsIndex);
for (tsRec = tsTBL->First(); tsRec != (DBObjRecord *) NULL; tsRec = tsTBL->Next()) {
DBPause(tsRowNum++ * 100 / tsTBL->ItemNum());
date = tsTimeFLD->Date(tsRec);
if (date != curDate) {
if (first) first = false;
else {
for (pntRec = pntTBL->First(); pntRec != (DBObjRecord *) NULL; pntRec = pntTBL->Next()) {
if ((pntRec->Flags() & DBObjectFlagLocked) != DBObjectFlagLocked) continue;
for (nextPntRec = pntTBL->Item(pntNextFLD->Int(pntRec) - 1);
(nextPntRec != (DBObjRecord *) NULL) &&
((nextPntRec->Flags() & DBObjectFlagLocked) != DBObjectFlagLocked);
nextPntRec = pntTBL->Item(pntNextFLD->Int(nextPntRec) - 1));
if (nextPntRec != (DBObjRecord *) NULL) {
pntNewNextFLD->Int(pntRec, nextPntRec->RowID() + 1);
pntNewInterStnFLD->Float(nextPntRec,
pntNewInterStnFLD->Float(nextPntRec) - pntAreaFLD->Float(pntRec));
}
}
pntRec = pntTBL->First();
for (; tsIndexRec != (DBObjRecord *) NULL; tsIndexRec = tsTBL->Next(&tsIndex)) {
if (tsRec == tsIndexRec) break;
for (; pntRec != (DBObjRecord *) NULL; pntRec = pntTBL->Next())
if (pntRelateFLD->Int(pntRec) == tsJoinFLD->Int(tsIndexRec)) {
tsNextStnFLD->Int(tsIndexRec, pntNewNextFLD->Int(pntRec));
tsInterStnFLD->Float(tsIndexRec, pntNewInterStnFLD->Float(pntRec));
break;
}
if (pntRec == (DBObjRecord *) NULL) pntRec = pntTBL->First();
}
}
for (pntRec = pntTBL->First(); pntRec != (DBObjRecord *) NULL; pntRec = pntTBL->Next()) {
pntNewNextFLD->Int(pntRec, 0);
pntNewInterStnFLD->Float(pntRec, pntAreaFLD->Float(pntRec));
pntRec->Flags(DBObjectFlagLocked, DBClear);
}
curDate = date;
//.........这里部分代码省略.........