本文整理汇总了C++中DBObjRecord::Name方法的典型用法代码示例。如果您正苦于以下问题:C++ DBObjRecord::Name方法的具体用法?C++ DBObjRecord::Name怎么用?C++ DBObjRecord::Name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBObjRecord
的用法示例。
在下文中一共展示了DBObjRecord::Name方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Update
void Update ()
{
ForegroundFLD->Int (OrigREC,Foreground ());
BackgroundFLD->Int (OrigREC,Background ());
StyleFLD->Int (OrigREC,Style ());
OrigREC->Name (Name ());
}
示例2: 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);
}
示例3: 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);
}
}
示例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: 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 ());
}
示例6: _RGISToolsGridExportARCInfo
int _RGISToolsGridExportARCInfo (DBObjData *data,char *selection)
{
DBInt layerID, i;
FILE *file;
char coverName [11], command [256];
char asciiGrid [FILENAME_MAX];
char attribDef [FILENAME_MAX];
char attribData [FILENAME_MAX];
char amlFile [FILENAME_MAX];
DBGridIF *gridIF = new DBGridIF (data);
DBObjRecord *layerRec;
for (layerID = 0;layerID < gridIF->LayerNum ();++layerID)
{
layerRec = gridIF->Layer (layerID);
sprintf (asciiGrid,"%s/asciigrid%d.tmp",selection,layerID);
if (DBExportARCGridLayer (data,layerRec,asciiGrid) == DBFault) return (DBFault);
}
if (data->Type () == DBTypeGridDiscrete)
{
sprintf (attribDef,"%s/attrib.def",selection);
if (DBExportARCTableDef (data,DBrNItems,attribDef) == DBFault)
{ unlink (asciiGrid); return (DBFault); }
sprintf (attribData,"%s/attrib.dat",selection);
if (DBExportARCTableData (data,DBrNItems,attribData) == DBFault)
{ unlink (asciiGrid); unlink (attribDef); return (DBFault); }
}
sprintf (amlFile,"%s/grdcreate.aml",selection);
if ((file = fopen (amlFile,"w")) == NULL)
{
for (layerID = 0;layerID < gridIF->LayerNum ();++layerID)
{
layerRec = gridIF->Layer (layerID);
sprintf (asciiGrid,"%s/asciigrid%d.tmp",selection,layerID);
unlink (asciiGrid);
}
if (data->Type () == DBTypeGridDiscrete) { unlink (attribDef); unlink (attribData); }
CMmsgPrint (CMmsgAppError, "Aml File Creation Error in: %s %d",__FILE__,__LINE__);
return (DBFault);
}
fprintf (file,"&workspace %s\n",selection);
for (layerID = 0;layerID < gridIF->LayerNum ();++layerID)
{
layerRec = gridIF->Layer (layerID);
strncpy (coverName,layerRec->Name (),sizeof (coverName) - 1);
coverName [sizeof (coverName) - 1] = '\0';
for (i = 0;i < (DBInt) strlen (coverName);++i) if (coverName [i] == '.') coverName [i] = '\0';
for (i = 0;i < (DBInt) strlen (coverName);++i) coverName [i] = tolower (coverName [i]);
sprintf (asciiGrid,"%s/asciigrid%d.tmp",selection,layerID);
if (data->Type () == DBTypeGridContinuous)
fprintf (file,"asciigrid %s g_%s float\n",asciiGrid,coverName);
else
fprintf (file,"asciigrid %s g_%s int\n",asciiGrid,coverName);
if (data->Type () == DBTypeGridDiscrete)
{
fprintf (file,"tables\n");
fprintf (file,"define g_%s.vattr\n",coverName);
fprintf (file,"&r %s\n",attribDef);
fprintf (file,"~\n");
fprintf (file,"alter GridValue\n");
fprintf (file,"value,,,,\n");
fprintf (file,"add\n");
fprintf (file,"&r %s\n",attribData);
fprintf (file,"~\n");
fprintf (file,"q stop\n");
fprintf (file,"joinitem g_%s.vat g_%s.vattr g_%s.vat value count\n",coverName,coverName,coverName);
fprintf (file,"tables\n");
fprintf (file,"select g_%s.vattr\n",coverName);
fprintf (file,"erase g_%s.vattr\ny\n",coverName);
fprintf (file,"q stop\n");
}
}
fclose (file);
if (getenv ("GHAAS_ARC") != NULL)
{
sprintf (command,getenv ("GHAAS_ARC"),amlFile);
system (command);
for (layerID = 0;layerID < gridIF->LayerNum ();++layerID)
{
layerRec = gridIF->Layer (layerID);
sprintf (asciiGrid,"%s/asciigrid%d.tmp",selection,layerID);
unlink (asciiGrid);
}
if (data->Type () == DBTypeGridDiscrete) { unlink (attribDef); unlink (attribData); }
unlink (amlFile);
}
return (DBSuccess);
}
示例7: DBImportARCVector
int DBImportARCVector (DBObjData *vecData,const char *arcCov,const char *nameFieldStr,const char *symbolFieldStr)
{
char symbolName [DBStringLength + 1];
DBObjTable *items = vecData->Table (DBrNItems);
DBObjTable *symbols = vecData->Table (DBrNSymbols);
DBObjTableField *nameFLD = NULL, *symbolResFLD, *symbolFLD = NULL;
DBObjTableField *symbolIDFLD = symbols->Field (DBrNSymbolID);
DBObjTableField *foregroundFLD = symbols->Field (DBrNForeground);
DBObjTableField *backgroundFLD = symbols->Field (DBrNBackground);
DBObjTableField *styleFLD = symbols->Field (DBrNStyle);
DBObjRecord *record;
DBObjRecord *symbolRec;
if (DBInfoGetFields (items,DBInfoFileName (arcCov,vecData->Type ())) == DBSuccess)
if (DBInfoGetTable (items,DBInfoFileName (arcCov,vecData->Type ())) == DBFault) return (DBFault);
switch (vecData->Type ())
{
case DBTypeVectorPoint:
if (DBImportARCPoint (vecData,arcCov) == DBFault) return (DBFault); else break;
case DBTypeVectorLine:
if (DBImportARCLine (vecData,arcCov) == DBFault) return (DBFault); else break;
case DBTypeVectorPolygon:
if (DBImportARCPoly (vecData,arcCov) == DBFault) return (DBFault); else break;
default: return (DBFault);
}
nameFLD = nameFieldStr != NULL ? items->Field (nameFieldStr) : (DBObjTableField *) NULL;
symbolFLD = symbolFieldStr != NULL ? items->Field (symbolFieldStr) : (DBObjTableField *) NULL;
symbolResFLD = items->Field (DBrNSymbol);
if (symbolFLD != NULL)
{
for (record = items->First ();record != (DBObjRecord *) NULL;record = items->Next ())
{
switch (symbolFLD->Type ())
{
case DBTableFieldString:
if ((symbolRec = (DBObjRecord *) symbols->Item (symbolFLD->String (record))) == NULL)
{
if ((symbolRec = symbols->Add (symbolFLD->String (record))) == NULL)
{ CMmsgPrint (CMmsgAppError,"Symbol Object Creation Error in: %s %d",__FILE__,__LINE__); return (DBFault); }
symbolIDFLD->Int (symbolRec,symbolRec->RowID ());
foregroundFLD->Int (symbolRec,1);
backgroundFLD->Int (symbolRec,0);
styleFLD->Int (symbolRec,0);
}
break;
case DBTableFieldInt:
sprintf (symbolName,"Symbol:%5d",symbolFLD->Int (record));
if ((symbolRec = (DBObjRecord *) symbols->Item (symbolName)) == NULL)
{
if ((symbolRec = symbols->Add (symbolName)) == NULL)
{ CMmsgPrint (CMmsgAppError, "Symbol Object Creation Error in: %s %d",__FILE__,__LINE__); return (DBFault); }
symbolIDFLD->Int (symbolRec,symbolFLD->Int (record));
foregroundFLD->Int (symbolRec,1);
backgroundFLD->Int (symbolRec,0);
styleFLD->Int (symbolRec,0);
}
break;
default:
CMmsgPrint (CMmsgAppError, "Invalid Field Type in: %s %d",__FILE__,__LINE__);
break;
}
symbolResFLD->Record (record,symbolRec);
}
}
else
{
symbols->Add ("Default Symbol");
if ((symbolRec = (DBObjRecord *) symbols->Item ()) == (DBObjRecord *) NULL)
{ CMmsgPrint (CMmsgAppError, "Symbol Object Creation Error in: %s %d",__FILE__,__LINE__); return (DBFault); }
symbolIDFLD->Int (symbolRec,0);
foregroundFLD->Int (symbolRec,1);
backgroundFLD->Int (symbolRec,0);
styleFLD->Int (symbolRec,0);
for (record = items->First ();record != (DBObjRecord *) NULL;record = items->Next ())
symbolResFLD->Record (record,symbolRec);
}
if (nameFLD != NULL)
for (record = items->First ();record != (DBObjRecord *) NULL;record = items->Next ())
record->Name (nameFLD->String (record));
return (DBSuccess);
}
示例8: Write
DBInt Write (FILE *file,DBObjData *data)
{
char *dmRecord;
DBInt layerID, docLen, dbType, intVal;
DBFloat floatVal;
DBPosition pos;
DBObjRecord *layerRec;
DBGridIF *gridIF = new DBGridIF (data);
DMLayerHeader dmLayerHeader;
dbType = gridIF->ValueType ();
switch (dbType)
{
case DBTableFieldFloat: DataType (DMFloat); break;
case DBTableFieldInt:
DataType (gridIF->ValueSize () > 1 ? DMInt : DMByte); break;
}
CellWidth (gridIF->CellWidth ());
CellHeight (gridIF->CellHeight ());
Extent (data->Extent ());
LayerNum (gridIF->LayerNum ());
RowNum (gridIF->RowNum ());
ColNum (gridIF->ColNum ());
dmRecord = (char *) calloc (RowNum () * ColNum (),DataType () != DMByte ? sizeof (int) : sizeof (char));
if (dmRecord == (char *) NULL)
{ CMmsgPrint (CMmsgSysError, "Memory Allocation Error in: %s %d",__FILE__,__LINE__); return (DBFault); }
DMFileHeader::Write (file);
for (layerID = 0;layerID < gridIF->LayerNum ();++layerID)
{
layerRec = gridIF->Layer (layerID);
dmLayerHeader.Description (layerRec->Name ());
dmLayerHeader.Write (file);
}
docLen = strlen (data->Document (DBDocComment));
if (fwrite (&docLen,sizeof (int),1,file) != 1)
{ CMmsgPrint (CMmsgSysError, "File Writing Error in: %s %d",__FILE__,__LINE__); return (DBFault); }
if (docLen > 0)
{
if (fwrite (data->Document (DBDocComment),docLen,1,file) != 1)
{ CMmsgPrint (CMmsgSysError, "File Writing Error in: %s %d",__FILE__,__LINE__); return (DBFault); }
}
for (layerID = 0;layerID < gridIF->LayerNum ();++layerID)
{
layerRec = gridIF->Layer (layerID);
switch (data->Type ())
{
case DBTypeGridContinuous:
layerRec = gridIF->Layer (layerID);
if (dbType == DBTableFieldFloat)
{
for (pos.Row = 0;pos.Row < RowNum ();pos.Row++)
for (pos.Col = 0;pos.Col < ColNum ();pos.Col++)
if (gridIF->Value (layerRec,pos,&floatVal))
((float *) dmRecord) [(RowNum () - pos.Row - 1) * ColNum () + pos.Col] = (float) floatVal;
else
((float *) dmRecord) [(RowNum () - pos.Row - 1) * ColNum () + pos.Col] = MissingValue ();
}
else
{
for (pos.Row = 0;pos.Row < RowNum ();pos.Row++)
for (pos.Col = 0;pos.Col < ColNum ();pos.Col++)
if (gridIF->Value (layerRec,pos,&intVal))
{
if (DataType () == DMInt)
((int *) dmRecord) [(RowNum () - pos.Row - 1) * ColNum () + pos.Col] = (int) intVal;
else
dmRecord [(RowNum () - pos.Row - 1) * ColNum () + pos.Col] = intVal;
}
else
{
if (DataType () == DMInt)
((int *) dmRecord) [(RowNum () - pos.Row - 1) * ColNum () + pos.Col] = (int) MissingValue ();
else
dmRecord [(RowNum () - pos.Row - 1) * ColNum () + pos.Col] = -99;
}
}
break;
case DBTypeGridDiscrete:
for (pos.Row = 0;pos.Row < RowNum ();pos.Row++)
for (pos.Col = 0;pos.Col < ColNum ();pos.Col++)
{
intVal = gridIF->GridValue (layerRec,pos);
if (DataType () == DMInt)
((int *) dmRecord) [(RowNum () - pos.Row - 1) * ColNum () + pos.Col] = intVal;
else
dmRecord [(RowNum () - pos.Row - 1) * ColNum () + pos.Col] = -99;
}
break;
default:
CMmsgPrint (CMmsgAppError, "Invalid Data Type in: %s %d",__FILE__,__LINE__);
free (dmRecord);
delete gridIF;
return (DBFault);
}
if ((DBInt) fwrite (dmRecord,DataType () == DMByte ? sizeof (char) : sizeof (int),DataPointNum (),file) != DataPointNum ())
{ CMmsgPrint (CMmsgSysError, "File Writing Error in: %s %d",__FILE__,__LINE__); return (DBFault); }
}
//.........这里部分代码省略.........
示例9: RGISAnGNUXYPlotCBK
void RGISAnGNUXYPlotCBK (Widget widget,RGISWorkspace *workspace,XmAnyCallbackStruct *callData)
{
FILE *file;
char command [DBDataFileNameLen * 2 + DBStringLength];
const char *ghaasDir;
char *f0Text, *f1Text, fileName [12];
int allowOk, fd;
static int plot = false, logScale = false;
DBDataset *dataset = UIDataset ();
DBObjData *dbData = dataset->Data ();
DBObjTable *itemTable = dbData->Table (DBrNItems);
static Widget dShell = (Widget) NULL, mainForm;
static Widget field0TextF, field1TextF;
Widget toggle;
XmString string;
if (dShell == (Widget) NULL)
{
Widget button;
dShell = UIDialogForm ((char *) "Compare Fields",false);
mainForm = UIDialogFormGetMainForm (dShell);
string = XmStringCreate ((char *) "Select",UICharSetBold);
button = XtVaCreateManagedWidget ("RGISEdiCompFieldsButton",xmPushButtonWidgetClass,mainForm,
XmNtopAttachment, XmATTACH_FORM,
XmNtopOffset, 10,
XmNrightAttachment, XmATTACH_FORM,
XmNrightOffset, 10,
XmNmarginHeight, 5,
XmNtraversalOn, False,
XmNlabelString, string,
XmNuserData, DBTableFieldIsNumeric,
NULL);
XmStringFree (string);
field0TextF = XtVaCreateManagedWidget ("RGISEditCompField0TextF",xmTextFieldWidgetClass,mainForm,
XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
XmNtopWidget, button,
XmNrightAttachment, XmATTACH_WIDGET,
XmNrightWidget, button,
XmNrightOffset, 10,
XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
XmNbottomWidget, button,
XmNmaxLength, DBStringLength,
XmNcolumns, DBStringLength / 2,
NULL);
XtAddCallback (button,XmNactivateCallback,(XtCallbackProc) UIAuxObjectSelectCBK,field0TextF);
string = XmStringCreate ((char *) "X Field:",UICharSetBold);
XtVaCreateManagedWidget ("RGISEditCompFieldNameLabel",xmLabelWidgetClass,mainForm,
XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
XmNtopWidget, button,
XmNleftAttachment, XmATTACH_FORM,
XmNleftOffset, 10,
XmNrightAttachment, XmATTACH_WIDGET,
XmNrightWidget, field0TextF,
XmNrightOffset, 10,
XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
XmNbottomWidget, button,
XmNlabelString, string,
NULL);
XmStringFree (string);
string = XmStringCreate ((char *) "Select",UICharSetBold);
button = XtVaCreateManagedWidget ("RGISEditCompField0Button",xmPushButtonWidgetClass,mainForm,
XmNtopAttachment, XmATTACH_WIDGET,
XmNtopWidget, button,
XmNtopOffset, 10,
XmNrightAttachment, XmATTACH_FORM,
XmNrightOffset, 10,
XmNmarginHeight, 5,
XmNtraversalOn, False,
XmNlabelString, string,
XmNuserData, DBTableFieldIsNumeric,
NULL);
XmStringFree (string);
field1TextF = XtVaCreateManagedWidget ("RGISEditCompField1TextF",xmTextFieldWidgetClass,mainForm,
XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
XmNtopWidget, button,
XmNrightAttachment, XmATTACH_WIDGET,
XmNrightWidget, button,
XmNrightOffset, 10,
XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
XmNbottomWidget, button,
XmNmaxLength, DBStringLength,
XmNcolumns, DBStringLength / 2,
NULL);
XtAddCallback (button,XmNactivateCallback,(XtCallbackProc) UIAuxObjectSelectCBK,field1TextF);
string = XmStringCreate ((char *) "Y Field:",UICharSetBold);
XtVaCreateManagedWidget ("RGISEditCompField1Label",xmLabelWidgetClass,mainForm,
XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
XmNtopWidget, button,
XmNleftAttachment, XmATTACH_FORM,
XmNleftOffset, 10,
XmNrightAttachment, XmATTACH_WIDGET,
XmNrightWidget, field1TextF,
XmNrightOffset, 10,
XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
XmNbottomWidget, button,
XmNlabelString, string,
//.........这里部分代码省略.........
示例10: _RGISUserFuncionQuery
void _RGISUserFuncionQuery (DBObjData *dbData,UI2DView *view,XEvent *event)
{
DBInt sX, sY;
DBCoordinate coord;
DBObjData *data = dbData;
UIAttribView *attribView;
if (event->type != ButtonPress) return;
sX = event->xbutton.x;
sY = event->xbutton.y;
view->Window2Map (sX,sY, &(coord.X), &(coord.Y));
for (data = dbData;
(data != (DBObjData *) NULL) && ((data->Flags () & DBObjectFlagProcessed) != DBObjectFlagProcessed);
data = data->LinkedData ())
{
data->Flags (DBObjectFlagProcessed,DBSet);
if ((data->Flags () & DBDataFlagUserModeFlags) == DBDataFlagUserModeQuery)
{
if ((attribView = (UIAttribView *) data->Display (UIAttribViewSTR)) == (UIAttribView *) NULL)
data->DispAdd (attribView = new UIAttribView (data));
switch (data->Type ())
{
case DBTypeVectorPoint:
case DBTypeVectorLine:
case DBTypeVectorPolygon:
{
DBVectorIF *vectorIF = new DBVectorIF (data);
attribView->Draw (vectorIF->Item (coord));
} break;
case DBTypeGridDiscrete:
{
DBGridIF *gridIF = new DBGridIF (data);
attribView->Draw (gridIF->GridItem (coord));
delete gridIF;
} break;
case DBTypeGridContinuous:
{
DBPosition pos;
DBGridIF *gridIF = new DBGridIF (data);
char nameString [DBStringLength * 2];
DBObjRecord *record = new DBObjRecord ("Noname",sizeof (DBCoordinate));
gridIF->Coord2Pos (coord,pos);
gridIF->Pos2Coord (pos,coord);
sprintf (nameString,"CellCoordinate %10.2f%10.2f",coord.X,coord.Y);
record->Name (nameString);
memcpy (record->Data (),(void *) &coord,sizeof (coord));
attribView->Draw (record);
delete record;
delete gridIF;
} break;
case DBTypeNetwork:
{
DBNetworkIF *netIF = new DBNetworkIF (data);
attribView->Draw (netIF->Cell (coord));
delete netIF;
} break;
default:
CMmsgPrint (CMmsgAppError, "Invalid Data Type in: %s %d",__FILE__,__LINE__); break;
}
}
}
for (data = dbData;
(data != (DBObjData *) NULL) && ((data->Flags () & DBObjectFlagProcessed) == DBObjectFlagProcessed);
data = data->LinkedData ())
data->Flags (DBObjectFlagProcessed,DBClear);
}
示例11: 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 ())
//.........这里部分代码省略.........