本文整理汇总了C++中DBObjTable类的典型用法代码示例。如果您正苦于以下问题:C++ DBObjTable类的具体用法?C++ DBObjTable怎么用?C++ DBObjTable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DBObjTable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: XmListDeleteAllItems
Widget RGISGrpPanel::Load (DBObjData *data)
{
DBObjTable *groupTable = data->Table (DBrNGroups);
XmListDeleteAllItems (GroupListWGT);
if (groupTable != (DBObjTable *) NULL)
{
DBObjTableField *group;
GroupLIST = groupTable->Fields ();
for (group = GroupLIST->First ();group != (DBObjTableField *) NULL;group = GroupLIST->Next ())
Add (group);
XtSetSensitive (DeleteButtonWGT,True);
XtSetSensitive (LoadButtonWGT,True);
XtSetSensitive (SaveButtonWGT,True);
XtVaSetValues (GroupListWGT,XmNuserData, data, NULL);
}
else
{
XtSetSensitive (DeleteButtonWGT,False);
XtSetSensitive (LoadButtonWGT,False);
XtSetSensitive (SaveButtonWGT,False);
}
return (Form ());
}
示例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: _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);
}
示例5: RGISAnNetworkToGridCBK
void RGISAnNetworkToGridCBK (Widget widget,RGISWorkspace *workspace,XmAnyCallbackStruct *callData)
{
char *selection;
DBInt dataType;
DBDataset *dataset = UIDataset ();
DBObjData *netData = dataset->Data ();
DBObjTable *cellTable = netData->Table (DBrNCells);
DBObjTableField *field;
DBObjData *grdData;
static Widget select = NULL;
if (select == NULL) select = UISelectionCreate ((char *) "Field Selection");
selection = UISelectObject (select,(DBObjectLIST<DBObject> *) (cellTable->Fields ()),DBTableFieldIsSimple);
if (selection == (char *) NULL) return;
if ((field = cellTable->Field (selection)) == (DBObjTableField *) NULL)
{ CMmsgPrint (CMmsgAppError,"Corrupt Network Dataset in: %s %d",__FILE__,__LINE__); return; }
if (DBTableFieldIsCategory (field) && DBTableFieldIsNumeric (field))
{
DBObjData *tmpData;
tmpData = new DBObjData ("",DBTypeGrid);
tmpData->Document (DBDocGeoDomain,netData->Document (DBDocGeoDomain));
tmpData->Document (DBDocSubject,field->Name ());
if (UIDataHeaderForm (tmpData))
{
grdData = DBNetworkToGrid (netData,tmpData->Type ());
grdData->Name (tmpData->Name ());
grdData->Document (DBDocGeoDomain,tmpData->Document (DBDocGeoDomain));
grdData->Document (DBDocSubject,tmpData->Document (DBDocSubject));
grdData->Document (DBDocVersion,tmpData->Document (DBDocVersion));
grdData->Document (DBDocCitationRef,tmpData->Document (DBDocCitationRef));
grdData->Document (DBDocCitationInst,tmpData->Document (DBDocCitationInst));
grdData->Document (DBDocSourceInst,tmpData->Document (DBDocSourceInst));
grdData->Document (DBDocSourcePerson,tmpData->Document (DBDocSourcePerson));
grdData->Document (DBDocOwnerPerson,tmpData->Document (DBDocOwnerPerson));
grdData->Document (DBDocComment,tmpData->Document (DBDocComment));
delete tmpData;
}
else { return; }
}
else
{
if (DBTableFieldIsCategory (field)) dataType = DBTypeGridDiscrete;
else if (DBTableFieldIsNumeric (field)) dataType = DBTypeGridContinuous;
else
{
CMmsgPrint (CMmsgAppError,"Invalid field type in: %s %d",__FILE__,__LINE__);
return;
}
grdData = DBNetworkToGrid (netData,dataType);
if (UIDataHeaderForm (grdData) == false) { delete grdData; return; }
}
UIPauseDialogOpen ((char *) "Converting Network to Grid");
if (RGlibNetworkToGrid (netData,field,grdData) == DBSuccess) workspace->CurrentData (grdData);
else delete grdData;
UIPauseDialogClose ();
}
示例6: _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);
}
示例7: 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);
}
示例8: Extent
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);
}
}
示例9: _RGISGridGroupListCBK
static void _RGISGridGroupListCBK (Widget widget,RGISGrpPanel *grpPanel, XmListCallbackStruct *callData)
{
DBObjData *data;
DBObjTable *groupTable;
DBObjectLIST<DBObjTableField> *groups;
DBObjTableField *group = (DBObjTableField *) NULL;
XtVaGetValues (widget,XmNuserData, &data, NULL);
if (data == (DBObjData *) NULL) return;
if ((groupTable = data->Table (DBrNGroups)) != (DBObjTable *) NULL)
{
groups = groupTable->Fields ();
if ((group = groups->Item (callData->item_position - 1)) != (DBObjTableField *) NULL)
grpPanel->Current (group);
}
}
示例10: RGISAnalysePointSubbasinCenterCBK
void RGISAnalysePointSubbasinCenterCBK (Widget widget, RGISWorkspace *workspace,XmAnyCallbackStruct *callData)
{
DBDataset *dataset = UIDataset ();
DBObjData *pntData =dataset->Data ();
DBObjTable *pointTable = pntData->Table (DBrNItems);
DBObjTableField *massCoordXFLD = pointTable->Field (RGlibMassCoordX);
DBObjTableField *massCoordYFLD = pointTable->Field (RGlibMassCoordY);
DBObjData *netData = pntData->LinkedData ();
UITable *tableCLS = (UITable *) pntData->Display (UITableName (pntData,pointTable));
UIPauseDialogOpen ((char *) "Subbasin Centers");
if ((RGlibPointSubbasinCenter (pntData, netData) == DBSuccess) && (tableCLS != (UITable *) NULL))
{
if (massCoordXFLD == NULL) tableCLS->AddField (pointTable->Field (RGlibMassCoordX));
if (massCoordYFLD == NULL) tableCLS->AddField (pointTable->Field (RGlibMassCoordY));
tableCLS->Draw ();
}
UIPauseDialogClose ();
}
示例11: RGISEditNetAddBasinXYCBK
void RGISEditNetAddBasinXYCBK (Widget widget, RGISWorkspace *workspace,XmAnyCallbackStruct *callData)
{
DBInt basinID;
DBDataset *dataset = UIDataset ();
DBObjData *dbData =dataset->Data ();
DBNetworkIF *netIF = new DBNetworkIF (dbData);
DBObjTable *itemTable = dbData->Table (DBrNItems);
DBObjTableField *xCoordFLD = itemTable->Field (RGISNetMouthXCoord);
DBObjTableField *yCoordFLD = itemTable->Field (RGISNetMouthYCoord);
DBCoordinate coord;
DBObjRecord *basinRec;
UITable *tableCLS = (UITable *) dbData->Display (UITableName (dbData,itemTable));
UIPauseDialogOpen ((char *) "Adding XY Coordinates");
if (xCoordFLD == NULL)
{
xCoordFLD = new DBObjTableField (RGISNetMouthXCoord,DBTableFieldFloat,(char *) "%10.3f",sizeof (DBFloat4));
itemTable->AddField (xCoordFLD);
if (tableCLS != (UITable *) NULL) tableCLS->AddField (xCoordFLD);
UIPause (40);
}
if (yCoordFLD == NULL)
{
yCoordFLD = new DBObjTableField (RGISNetMouthYCoord,DBTableFieldFloat,(char *) "%10.3f",sizeof (DBFloat4));
itemTable->AddField (yCoordFLD);
if (tableCLS != (UITable *) NULL) tableCLS->AddField (yCoordFLD);
UIPause (80);
}
for (basinID = 0;basinID < netIF->BasinNum ();++basinID)
{
basinRec = netIF->Basin (basinID);
if (UIPause (80 + basinID * 20 / netIF->BasinNum ())) goto Stop;
coord = netIF->Center (netIF->MouthCell (basinRec));
xCoordFLD->Float (basinRec,coord.X);
yCoordFLD->Float (basinRec,coord.Y);
}
Stop:
UIPauseDialogClose ();
if (tableCLS != (UITable *) NULL) tableCLS->Draw ();
}
示例12: 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);
}
示例13: RGISEditPointAddXYCBK
void RGISEditPointAddXYCBK (Widget widget, RGISWorkspace *workspace,XmAnyCallbackStruct *callData)
{
DBDataset *dataset = UIDataset ();
DBObjData *dbData =dataset->Data ();
DBVPointIF *pntIF = new DBVPointIF (dbData);
DBObjTable *pointTable = dbData->Table (DBrNItems);
DBObjTableField *xCoordFLD = pointTable->Field (RGISEditPointXCoord);
DBObjTableField *yCoordFLD = pointTable->Field (RGISEditPointYCoord);
DBCoordinate coord;
DBObjRecord *pointRec;
UITable *tableCLS = (UITable *) dbData->Display (UITableName (dbData,pointTable));
widget = widget; workspace = workspace; callData = callData;
UIPauseDialogOpen ((char *) "Adding XY Coordinates");
if (xCoordFLD == NULL)
{
xCoordFLD = new DBObjTableField (RGISEditPointXCoord,DBTableFieldFloat,"%10.3f",sizeof (DBFloat4));
pointTable->AddField (xCoordFLD);
if (tableCLS != (UITable *) NULL) tableCLS->AddField (xCoordFLD);
UIPause (40);
}
if (yCoordFLD == NULL)
{
yCoordFLD = new DBObjTableField (RGISEditPointYCoord,DBTableFieldFloat,"%10.3f",sizeof (DBFloat4));
pointTable->AddField (yCoordFLD);
if (tableCLS != (UITable *) NULL) tableCLS->AddField (yCoordFLD);
UIPause (80);
}
for (pointRec = pntIF->FirstItem (); pointRec != (DBObjRecord *) NULL; pointRec = pntIF->NextItem ())
{
if (UIPause (80 + pointRec->RowID () * 20 / pntIF->ItemNum ())) goto Stop;
coord = pntIF->Coordinate (pointRec);
xCoordFLD->Float (pointRec,coord.X);
yCoordFLD->Float (pointRec,coord.Y);
}
Stop:
UIPauseDialogClose ();
if (tableCLS != (UITable *) NULL) tableCLS->Draw ();
}
示例14: _RGISGrpPanelDeleteCBK
static void _RGISGrpPanelDeleteCBK (Widget widget,RGISGrpPanel *grpPanel,XmAnyCallbackStruct *callData)
{
DBDataset *dataset = UIDataset ();
DBObjData *dbData = dataset->Data ();
DBObjTable *groupTable = dbData->Table (DBrNGroups);
DBObjTableField *group = grpPanel->Current ();
static Widget fieldSelect = (Widget) NULL;
if (fieldSelect == (Widget) NULL) fieldSelect = UISelectionCreate ((char *) "Group Selection");
if ((groupTable == (DBObjTable *) NULL) || (group == (DBObjTableField *) NULL)) return;
if (groupTable->FieldNum () == 1) grpPanel->Groups ((DBObjectLIST<DBObjTableField> *) NULL);
grpPanel->Remove (group);
groupTable->DeleteField (group);
if (groupTable->FieldNum () == 0)
{
DBObjectLIST<DBObjTable> *tables = dbData->Tables ();
tables->Remove (groupTable);
delete groupTable;
}
}
示例15: Load
Widget RGISGrdPanel::Load (DBObjData *data)
{
int itemPosition = 0;
DBObjTable *layerTable = data->Table (DBrNLayers);
DBObjRecord *record;
XmString string;
XmListDeleteAllItems (LayerListWGT);
for (record = layerTable->First ();record != (DBObjRecord *) NULL;record = layerTable->Next ())
{
string = XmStringCreate (record->Name (),UICharSetNormal);
XmListAddItem (LayerListWGT, string, ++itemPosition);
XmStringFree (string);
}
XmListDeselectAllItems (LayerListWGT);
record = layerTable->Item ();
string = XmStringCreate (record->Name (),UICharSetNormal);
XmListSelectItem (LayerListWGT,string,False);
XmStringFree (string);
XtVaSetValues (LayerListWGT,XmNuserData, data, NULL);
return (Form ());
}