本文整理汇总了C++中DBObjRecord类的典型用法代码示例。如果您正苦于以下问题:C++ DBObjRecord类的具体用法?C++ DBObjRecord怎么用?C++ DBObjRecord使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DBObjRecord类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _Write
int DBObjData::_Write (FILE *file)
{
DBInt id, userFlags;
DBObjRecord *docRec;
userFlags = Flags () & DBDataFlagUserModeFlags;
Flags (DBDataFlagUserModeFlags,DBClear);
if (DBObject::Write (file) == DBFault) return (DBFault);
Flags (userFlags,DBSet);
if (DocsPTR->Write (file) == DBFault) return (DBFault);
for (id = 0;id < DocsPTR->ItemNum ();++id)
{
if (DocsPTR->WriteItem (file,id) == DBFault) return (DBFault);
docRec = DocsPTR->Item (id);
if (((DBVarString *) docRec->Data ())->Write (file) == DBFault) return (DBFault);
}
if (ArraysPTR->Write (file) == DBFault) return (DBFault);
for (id = 0;id < ArraysPTR->ItemNum ();++id)
if (ArraysPTR->WriteItem (file,id) == DBFault) return (DBFault);
TablesPTR->Write (file);
for (id = 0;id < TablesPTR->ItemNum ();++id)
if (TablesPTR->WriteItem (file,id) == DBFault) return (DBFault);
return (BuildFields ());
}
示例2: UIAuxSetLabelString
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);
}
示例3: AddField
void DBObjTable::AddField(DBObjTableField *field) {
DBInt recID;
DBObjRecord *record;
field->StartByte(RecordLengthVAR);
FieldPTR->Add(field);
RecordLengthVAR += field->Length();
for (recID = 0; recID < ItemNum(); recID++) {
record = Item(recID);
record->Realloc(RecordLengthVAR);
switch (field->Type()) {
case DBTableFieldString:
field->String(record, "");
break;
case DBTableFieldInt:
field->Int(record, field->IntNoData());
break;
case DBTableFieldFloat:
field->Float(record, field->FloatNoData());
break;
case DBTableFieldDate:
field->Date(record, field->DateNoData());
break;
}
}
}
示例4: Value
DBInt DBGridIF::Value (DBObjRecord *layerRec,DBPosition pos,DBFloat *value) const
{
DBInt j;
DBObjRecord *dataRec = LayerFLD->Record (layerRec);
DBFloat missingValue = MissingValueFLD->Float (ItemTable->Item (layerRec->RowID ()));
// if (pos.Col < 0) return (false); No longer possible
// if (pos.Row < 0) return (false);
if (pos.Col >= DimensionVAR.Col) return (false);
if (pos.Row >= DimensionVAR.Row) return (false);
j = DimensionVAR.Col * (DimensionVAR.Row - pos.Row - 1) + pos.Col;
switch (ValueTypeVAR)
{
case DBTableFieldFloat:
switch (ValueSizeVAR)
{
case sizeof (DBFloat4): *value = (DBFloat) ((DBFloat4 *) (dataRec->Data ())) [j]; break;
case sizeof (DBFloat): *value = (DBFloat) ((DBFloat *) (dataRec->Data ())) [j]; break;
}
break;
case DBTableFieldInt:
switch (ValueSizeVAR)
{
case sizeof (DBByte): *value = (DBFloat) ((DBByte *) (dataRec->Data ())) [j]; break;
case sizeof (DBShort): *value = (DBFloat) ((DBShort *) (dataRec->Data ())) [j]; break;
case sizeof (DBInt): *value = (DBFloat) ((DBInt *) (dataRec->Data ())) [j]; break;
}
break;
}
return (CMmathEqualValues (*value,missingValue) ? false : true);
}
示例5: _RGISGrpPanelNewCBK
static void _RGISGrpPanelNewCBK (Widget widget,RGISGrpPanel *grpPanel,XmAnyCallbackStruct *callData)
{
char *groupName;
DBDataset *dataset = UIDataset ();
DBObjData *dbData = dataset->Data ();
DBObjTable *groupTable = dbData->Table (DBrNGroups);
DBObjTableField *group;
DBObjRecord *record;
if ((groupName = UIGetString ((char *) "Group Name",16)) == (char *) NULL) return;
if (groupTable == (DBObjTable *) NULL)
{
DBObjTable *items = dbData->Table (DBrNItems);
DBObjectLIST<DBObjTable> *tables = dbData->Tables ();
DBTableFieldDefinition fieldDefs [] = {
DBTableFieldDefinition (groupName, DBTableFieldInt,(char *) "%1d",sizeof (DBByte)),
DBTableFieldDefinition () };
tables->Add (groupTable = new DBObjTable (DBrNGroups,fieldDefs));
grpPanel->Groups (groupTable->Fields ());
group = groupTable->Field (groupName);
for (record = items->First ();record != (DBObjRecord *) NULL;record = items->Next ())
group->Int (groupTable->Add (record->Name ()),true);
}
else
{
groupTable->AddField (group = new DBObjTableField (groupName,DBTableFieldInt,"%1d",sizeof (DBByte)));
for (record = groupTable->First ();record != (DBObjRecord *) NULL;record = groupTable->Next ())
group->Int (record,true);
}
grpPanel->Add (group);
}
示例6: Trim
int DBNetworkIF::Trim ()
{
DBInt i, row, col;
DBPosition pos, min, max;
DBRegion extent = DataPTR->Extent ();
DBObjRecord *cellRec;
DBCoordinate coord;
min.Row = RowNum ();
min.Col = ColNum ();
max.Row = max.Col = 0;
for (i = 0;i < CellNum ();++i)
{
DBPause (33 * i / CellNum ());
cellRec = CellTable->Item (i);
pos = CellPosition (cellRec);
min.Row = min.Row < pos.Row ? min.Row : pos.Row;
min.Col = min.Col < pos.Col ? min.Col : pos.Col;
max.Row = max.Row > pos.Row ? max.Row : pos.Row;
max.Col = max.Col > pos.Col ? max.Col : pos.Col;
}
for (i = 0;i < CellNum ();++i)
{
DBPause (33 + 33 * i / CellNum ());
cellRec = CellTable->Item (i);
pos = CellPosition (cellRec);
pos.Row = pos.Row - min.Row;
pos.Col = pos.Col - min.Col;
PositionFLD->Position (cellRec,pos);
}
coord.X = min.Col * CellWidth ();
coord.Y = min.Row * CellHeight ();
extent.LowerLeft = extent.LowerLeft + coord;
coord.X = (ColNum () - max.Col - 1) * CellWidth ();
coord.Y = (RowNum () - max.Row - 1) * CellHeight ();
extent.UpperRight = extent.UpperRight - coord;
DataPTR->Extent (extent);
row = max.Row - min.Row + 1;
col = max.Col - min.Col + 1;
RowNumFLD->Int (LayerRecord,row);
ColNumFLD->Int (LayerRecord,col);
DataRec->Realloc (row * col * sizeof (int));
for (row = 0;row < RowNum ();row++) for (col = 0;col < ColNum ();col++)
((DBInt *) DataRec->Data ()) [row * ColNum () + col] = DBFault;
for (i = 0;i < CellNum ();++i)
{
DBPause (67 + 33 * i / CellNum ());
pos = CellPosition (CellTable->Item (i));
((DBInt *) DataRec->Data ()) [pos.Row * ColNum () + pos.Col] = cellRec->RowID ();
}
return (DBSuccess);
}
示例7: switch
char *DBObjTableField::String(const DBObjRecord *record) const {
static char retString[DBStringLength];
if (record == (DBObjRecord *) NULL) return ((char *) NULL);
switch (Type()) {
case DBTableFieldString:
return ((char *) record->Data() + StartByte());
case DBTableFieldInt: {
DBInt ret = Int(record);
if (ret == IntNoData()) return ((char *) "");
sprintf(retString, Format(), ret);
return (retString);
}
case DBTableFieldFloat: {
DBFloat ret = Float(record);
if (CMmathEqualValues(ret, FloatNoData())) return ((char *) "");
sprintf(retString, Format(), ret);
return (retString);
}
case DBTableFieldDate: {
DBDate date = Date(record);
strncpy(retString, date.Get(), sizeof(retString));
}
return (retString);
case DBTableFieldTableRec:
case DBTableFieldDataRec: {
DBObjRecord *refRecord = Record(record);
return (refRecord->Name());
}
default:
return (NULL);
}
}
示例8: DeleteAllFields
void DBObjTable::DeleteAllFields() {
DBObjRecord *record;
FieldPTR->DeleteAll();
RecordLengthVAR = 0;
for (record = First(); record != (DBObjRecord *) NULL; record = Next())
record->Realloc(RecordLengthVAR);
}
示例9: DBObjRecord
void DBObjData::Document(const char *docName, const char *string) {
DBObjRecord *obj = DocsPTR->Item(docName);
if (obj == (DBObjRecord *) NULL) {
DocsPTR->Add(obj = new DBObjRecord(docName, sizeof(DBVarString)));
memset(obj->Data(), 0, sizeof(DBVarString));
((DBVarString *) obj->Data())->VString(string);
}
else ((DBVarString *) obj->Data())->VString(string);
}
示例10: _RGlibSubbasinCategories
static DBInt _RGlibSubbasinCategories(void *io, DBObjRecord *cellRec) {
DBObjRecord *grdRec;
DBNetworkIF *netIF = (DBNetworkIF *) io;
if (cellRec == (DBObjRecord *) NULL) return (false);
grdRec = _RGlibPointGrdIF->GridItem(_RGlibPointGrdLayerRec, netIF->Center(cellRec));
if (grdRec == (DBObjRecord *) NULL) return (true);
_RGlibHistogram[grdRec->RowID()].cellNum++;
_RGlibHistogram[grdRec->RowID()].area += netIF->CellArea(cellRec);
return (true);
}
示例11: return
char *DBObjData::Document(const char *docName) {
DBObjRecord *obj = DocsPTR->Item(docName);
if (obj == (DBObjRecord *) NULL) {
if ((strcmp(docName, DBDocSubject) == 0) || (strcmp(docName, DBDocGeoDomain) == 0)) {
Document(docName, (char *) "unspecified");
return ((char *) "unspecified");
}
else return ((char *) "");
}
return (((DBVarString *) obj->Data())->VString());
}
示例12: _RGISGridLayerListCBK
static void _RGISGridLayerListCBK (Widget widget,void *dummy, XmListCallbackStruct *callData)
{
int item = 0;
DBObjData *data;
DBObjTable *layerTable;
DBObjRecord *record;
XtVaGetValues (widget,XmNuserData, &data, NULL);
layerTable = data->Table (DBrNLayers);
for (record = layerTable->First ();record != (DBObjRecord *) NULL;record = layerTable->Next ())
if (++item == callData->item_position) layerTable->Item (record->RowID (),true);
}
示例13: switch
DBRegion DBObjData::Extent(DBObjRecord *record) {
DBRegion extent;
DBCoordinate coord;
DBFloat delta;
DBObjTable *items;
DBObjTableField *field;
if (record == (DBObjRecord *) NULL) return (Extent());
switch (Type()) {
case DBTypeVectorPoint:
delta = pow((double) 10.0, (double) Precision());
items = TablesPTR->Item(DBrNItems);
field = items->Field(DBrNCoord);
coord = field->Coordinate(record);
extent.Expand(coord + delta);
extent.Expand(coord - delta);
return (extent);
case DBTypeVectorLine:
case DBTypeVectorPolygon:
items = TablesPTR->Item(DBrNItems);
field = items->Field(DBrNRegion);
return (field->Region(record));
case DBTypeGridDiscrete:
case DBTypeGridContinuous:
return (Extent());
case DBTypeNetwork: {
DBInt cellID, cellNum;
DBObjRecord *cellRec;
DBNetworkIF *netIF = new DBNetworkIF(this);
cellRec = netIF->MouthCell(record);
cellNum = netIF->CellBasinCells(cellRec) + cellRec->RowID();
for (cellID = cellRec->RowID(); cellID < cellNum; ++cellID) {
cellRec = netIF->Cell(cellID);
extent.Expand(netIF->Center(cellRec) + (netIF->CellSize() / 2.0));
extent.Expand(netIF->Center(cellRec) - (netIF->CellSize() / 2.0));
}
delete netIF;
}
return (extent);
case DBTypeTable:
default:
return (extent);
}
}
示例14: ColNum
DBObjRecord *DBNetworkIF::CellAdd (DBPosition pos)
{
char nameSTR [DBStringLength];
DBInt dir, fromDir;
DBPosition fromPos;
DBObjRecord *cellRec;
if (pos.Col < 0) return ((DBObjRecord *) NULL);
if (pos.Row < 0) return ((DBObjRecord *) NULL);
if (pos.Col >= ColNum ()) return ((DBObjRecord *) NULL);
if (pos.Row >= RowNum ()) return ((DBObjRecord *) NULL);
if (((DBInt *) DataRec->Data ()) [pos.Row * ColNum () + pos.Col] != DBFault) return ((DBObjRecord *) NULL);
sprintf (nameSTR,"Cell:%6d",CellNum ());
cellRec = CellTable->Add (nameSTR);
((DBInt *) DataRec->Data ()) [pos.Row * ColNum () + pos.Col] = cellRec->RowID ();
PositionFLD->Position (cellRec,pos);
ToCellFLD->Int (cellRec,DBNetDirN);
fromDir = DBNull;
for (dir = 0;dir < 8;++dir)
{
fromPos = pos;
if ((dir == DBNetDirNW) || (dir == DBNetDirN) || (dir == DBNetDirNE)) fromPos.Row++;
if ((dir == DBNetDirSE) || (dir == DBNetDirS) || (dir == DBNetDirSW)) fromPos.Row--;
if ((dir == DBNetDirNE) || (dir == DBNetDirE) || (dir == DBNetDirSE)) fromPos.Col++;
if ((dir == DBNetDirNW) || (dir == DBNetDirW) || (dir == DBNetDirSW)) fromPos.Col--;
if (((DBInt *) DataRec->Data ()) [fromPos.Row * ColNum () + fromPos.Col ] != DBFault) fromDir |= dir;
}
FromCellFLD->Int (cellRec,fromDir);
OrderFLD->Int (cellRec,1);
BasinFLD->Int (cellRec,1);
BasinCellsFLD->Int (cellRec,1);
TravelFLD->Int (cellRec,1);
UpCellPosFLD->Position (cellRec,pos);
CellAreaFLD->Float (cellRec,0.0);
SubbasinLengthFLD->Float (cellRec,0.0);
SubbasinAreaFLD->Float (cellRec,0.0);
return (cellRec);
}
示例15: SelectObject
DBInt DBObjData::SelectObject(DBObjRecord *record, DBInt select) {
DBObjTable *items = TablesPTR->Item(DBrNItems);
if (record == (DBObjRecord *) NULL) return (false);
if (items->Item(record->RowID()) != record) return (false);
record->Flags(DBObjectFlagSelected, select);
if (Type() == DBTypeNetwork) {
DBInt cellID;
DBObjRecord *cellRec;
DBNetworkIF *netIF = new DBNetworkIF(this);
for (cellID = 0; cellID < netIF->CellNum(); ++cellID) {
cellRec = netIF->Cell(cellID);
if (netIF->CellBasinID(cellRec) == record->RowID() + 1)
cellRec->Flags(DBObjectFlagSelected, select);
}
delete netIF;
}
return (DBSuccess);
}