本文整理汇总了C++中DBObjTable::Fields方法的典型用法代码示例。如果您正苦于以下问题:C++ DBObjTable::Fields方法的具体用法?C++ DBObjTable::Fields怎么用?C++ DBObjTable::Fields使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBObjTable
的用法示例。
在下文中一共展示了DBObjTable::Fields方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Load
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 ());
}
示例2: _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);
}
示例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: 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);
}
示例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: _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);
}
}
示例7: RGISEditPointSTNCoordsCBK
void RGISEditPointSTNCoordsCBK (Widget widget,void *data,XmAnyCallbackStruct *callData)
{
char *text;
static DBInt cont;
DBDataset *dataset;
DBObjData *dbData;
DBObjTable *table;
DBObjTableField *field = (DBObjTableField *) NULL;
static Widget dShell = NULL, mainForm, button, textF;
widget = widget; data = data; callData = callData;
if (dShell == (Widget) NULL)
{
XmString string;
dShell = UIDialogForm ((char *) "Area Field",false);
mainForm = UIDialogFormGetMainForm (dShell);
string = XmStringCreate ((char *) "Select",UICharSetBold);
button = XtVaCreateManagedWidget ("RGISEditPointSTNBestCoordsButton",xmPushButtonWidgetClass,mainForm,
XmNtopAttachment, XmATTACH_FORM,
XmNtopOffset, 10,
XmNrightAttachment, XmATTACH_FORM,
XmNrightOffset, 10,
XmNmarginHeight, 5,
XmNtraversalOn, False,
XmNlabelString, string,
XmNuserData, DBTableFieldIsCategory,
NULL);
XmStringFree (string);
textF = XtVaCreateManagedWidget ("RGISEditPointSTNBestCoordsTextF",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) _RGISEditPointSTNCoordsSelectCBK,textF);
string = XmStringCreate ((char *) "Area Field:",UICharSetBold);
XtVaCreateManagedWidget ("RGISEditJoinTableNameLabel",xmLabelWidgetClass,mainForm,
XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
XmNtopWidget, button,
XmNleftAttachment, XmATTACH_FORM,
XmNleftOffset, 10,
XmNrightAttachment, XmATTACH_WIDGET,
XmNrightWidget, textF,
XmNrightOffset, 10,
XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
XmNbottomWidget, button,
XmNlabelString, string,
NULL);
XmStringFree (string);
XtAddCallback (UIDialogFormGetOkButton (dShell),XmNactivateCallback,(XtCallbackProc) UIAuxSetBooleanTrueCBK,&cont);
XtSetSensitive (UIDialogFormGetOkButton (dShell),true);
}
dataset = UIDataset ();
dbData = dataset->Data ();
table = dbData->Table (DBrNItems);
XtVaSetValues (textF,XmNuserData,table->Fields (),NULL);
UIDialogFormPopup (dShell);
cont = false;
while (UILoop ());
{
if (strlen (text = XmTextFieldGetString (textF)) > 0)
field = table->Field (text);
/* if ((strlen (text = XmTextFieldGetString (textF)) > 0) &&
((field = table->Field (text)) != (DBObjTableField *) NULL))
XtSetSensitive (UIDialogFormGetOkButton (dShell),True);
else XtSetSensitive (UIDialogFormGetOkButton (dShell),False);
*/ XtFree (text);
}
UIDialogFormPopdown (dShell);
if (cont)
{
UIPauseDialogOpen ((char *) "Moving Points");
RGlibPointSTNCoordinates (dbData,field);
UIPauseDialogClose ();
UI2DViewRedrawAll ();
}
}
示例8: RGISToolsConvertToPointCBK
void RGISToolsConvertToPointCBK (Widget widget,RGISWorkspace *workspace,XmAnyCallbackStruct *callData)
{
char *nText, *xText, *yText, *selection;
int allowOk;
static int convert;
DBDataset *dataset = UIDataset ();
DBObjData *dbData = dataset->Data ();
DBObjTable *itemTable;
static Widget tableSelect = (Widget) NULL;
static Widget dShell = (Widget) NULL, mainForm;
static Widget nameTextF, xCoordTextF, yCoordTextF;
XmString string;
if (tableSelect == (Widget) NULL) tableSelect = UISelectionCreate ((char *) "Table Selection");
selection = UISelectObject (tableSelect,(DBObjectLIST<DBObject> *) dbData->Tables ());
if (selection == (char *) NULL) return;
if ((itemTable = dbData->Table (selection)) == (DBObjTable *) NULL)
{ CMmsgPrint (CMmsgAppError, "Invalid Table in: %s %d",__FILE__,__LINE__); return; }
_RGISToolsConvertToPointFields = itemTable->Fields ();
if (dShell == (Widget) NULL)
{
Widget button;
dShell = UIDialogForm ((char *) "Convert Table To Point",false);
mainForm = UIDialogFormGetMainForm (dShell);
string = XmStringCreate ((char *) "Select",UICharSetBold);
button = XtVaCreateManagedWidget ("RGISToolsConvertToPointNameButton",xmPushButtonWidgetClass,mainForm,
XmNtopAttachment, XmATTACH_FORM,
XmNtopOffset, 10,
XmNrightAttachment, XmATTACH_FORM,
XmNrightOffset, 10,
XmNmarginHeight, 5,
XmNtraversalOn, False,
XmNlabelString, string,
XmNuserData, DBTableFieldIsString,
NULL);
XmStringFree (string);
nameTextF = XtVaCreateManagedWidget ("RGISToolsConvertToPointNameTextF",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) _RGISToolsConvertToPointSelectCBK,nameTextF);
string = XmStringCreate ((char *) "Name Field:",UICharSetBold);
XtVaCreateManagedWidget ("RGISToolsConvertToPointNameLabel",xmLabelWidgetClass,mainForm,
XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
XmNtopWidget, button,
XmNleftAttachment, XmATTACH_FORM,
XmNleftOffset, 10,
XmNrightAttachment, XmATTACH_WIDGET,
XmNrightWidget, nameTextF,
XmNrightOffset, 10,
XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
XmNbottomWidget, button,
XmNlabelString, string,
NULL);
XmStringFree (string);
string = XmStringCreate ((char *) "Select",UICharSetBold);
button = XtVaCreateManagedWidget ("RGISToolsConvertToPointXCoordButton",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);
xCoordTextF = XtVaCreateManagedWidget ("RGISToolsConvertToPointXCoordTextF",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) _RGISToolsConvertToPointSelectCBK,xCoordTextF);
string = XmStringCreate ((char *) "X Coordinate:",UICharSetBold);
XtVaCreateManagedWidget ("RGISToolsConvertToPointXCoordLabel",xmLabelWidgetClass,mainForm,
XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
XmNtopWidget, button,
XmNleftAttachment, XmATTACH_FORM,
XmNleftOffset, 10,
XmNrightAttachment, XmATTACH_WIDGET,
XmNrightWidget, nameTextF,
//.........这里部分代码省略.........
示例9: 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 ())
//.........这里部分代码省略.........
示例10: 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,
//.........这里部分代码省略.........
示例11: RGISAnalysePointSTNPointsCBK
//.........这里部分代码省略.........
XmNlabelString, string,
XmNuserData, &diffMethod,
NULL);
XmStringFree (string);
XtAddCallback (mButton,XmNactivateCallback,(XtCallbackProc) UIAuxSetIntegerCBK,(XtPointer) 1);
string = XmStringCreate ((char *) "Symmetric %",UICharSetNormal);
mButton = XtVaCreateManagedWidget ("RGISAnalysePointSTNPointsMenuButton",xmPushButtonWidgetClass,menu,
XmNlabelString, string,
XmNuserData, &diffMethod,
NULL);
XmStringFree (string);
XtAddCallback (mButton,XmNactivateCallback,(XtCallbackProc) UIAuxSetIntegerCBK,(XtPointer) 2);
string = XmStringCreate ((char *) "Difference Method:",UICharSetBold);
menu = XtVaCreateManagedWidget ("RGISAnalysePointSTNPointsMenu",xmRowColumnWidgetClass,mainForm,
XmNtopAttachment, XmATTACH_WIDGET,
XmNtopWidget, button,
XmNtopOffset, 10,
XmNrightAttachment, XmATTACH_FORM,
XmNrightOffset, 10,
XmNbottomAttachment, XmATTACH_FORM,
XmNbottomOffset, 10,
XmNrowColumnType, XmMENU_OPTION,
XmNlabelString, string,
XmNsubMenuId, menu,
NULL);
XmStringFree (string);
XtAddCallback (UIDialogFormGetOkButton (dShell),XmNactivateCallback,(XtCallbackProc) UIAuxSetBooleanTrueCBK,&cont);
XtSetSensitive (UIDialogFormGetOkButton (dShell),true);
}
dataset = UIDataset ();
dbData = dataset->Data ();
table = dbData->Table (DBrNItems);
XtVaSetValues (srcTextF,XmNuserData,table->Fields (),NULL);
XtVaSetValues (dstTextF,XmNuserData,table->Fields (),NULL);
XtVaSetValues (cmpTextF,XmNuserData,table->Fields (),NULL);
XtVaSetValues (errTextF,XmNuserData,table->Fields (),NULL);
UIDialogFormPopup (dShell);
cont = false;
while (UILoop ())
{
if ((strlen (srcText = XmTextFieldGetString (srcTextF)) > 0) &&
((field = table->Field (srcText)) != (DBObjTableField *) NULL))
XtSetSensitive (UIDialogFormGetOkButton (dShell),True);
else XtSetSensitive (UIDialogFormGetOkButton (dShell),False);
XtFree (srcText);
if ((strlen (srcText = XmTextFieldGetString (cmpTextF)) > 0) &&
((field = table->Field (srcText)) != (DBObjTableField *) NULL))
{
XtSetSensitive (button,True);
XtSetSensitive (errTextF,True);
XtSetSensitive (menu,True);
}
else
{
XmTextFieldSetString (errTextF,(char *) "");
XtSetSensitive (button,False);
XtSetSensitive (errTextF,False);
XtSetSensitive (menu,False);
}
XtFree (srcText);
}
UIDialogFormPopdown (dShell);
if (cont)
{
char dataName [DBDataNameLen + 5];
示例12: RGISAnNetworkStreamLinesCBK
void RGISAnNetworkStreamLinesCBK (Widget widget,RGISWorkspace *workspace,XmAnyCallbackStruct *callData)
{
char *selection;
DBDataset *dataset = UIDataset ();
DBObjData *netData = dataset->Data ();
DBObjTable *cellTable = netData->Table (DBrNCells);
DBObjData *arcData = new DBObjData ("",DBTypeVectorLine);
DBNetworkIF *netIF = new DBNetworkIF (netData);
static Widget fieldSelect = (Widget) NULL;
widget = widget; callData = callData;
if (fieldSelect == (Widget) NULL) fieldSelect = UISelectionCreate ((char *) "Select Field");
if ((selection = UISelectObject (fieldSelect,(DBObjectLIST<DBObject> *) cellTable->Fields (),DBTableFieldIsInteger)) == (char *) NULL)
return;
if ((_RGISAnNetOrderField = cellTable->Field (selection)) == (DBObjTableField *) NULL)
{ CMmsgPrint (CMmsgAppError, "Field Selection Error in: %s %d",__FILE__,__LINE__); return; }
arcData->Document (DBDocGeoDomain,netData->Document (DBDocGeoDomain));
arcData->Document (DBDocSubject,"Stream Lines");
if (UIDataHeaderForm (arcData))
{
DBInt cellID;
char objName [DBStringLength];
DBVLineIF *lineIF = new DBVLineIF (arcData);
DBObjTable *cellTable = netData->Table (DBrNCells);
DBObjTable *lineTable = arcData->Table (DBrNItems);
DBObjTableField *basinFLD = new DBObjTableField (DBrNBasin,DBTableFieldInt,"%8d",sizeof (DBInt));
DBObjTableField *fieldFLD = new DBObjTableField (_RGISAnNetOrderField->Name (),
_RGISAnNetOrderField->Type (),
_RGISAnNetOrderField->Format (),
_RGISAnNetOrderField->Length ());
DBObjTableField *lengthFLD = new DBObjTableField (RGISNetStreamLength,DBTableFieldFloat,"%10.1f",sizeof (DBFloat4));
DBObjTableField *areaFLD = new DBObjTableField (RGISNetStreamArea,DBTableFieldFloat,"%10.1f",sizeof (DBFloat4));
DBObjTableField *basinAreaFLD = new DBObjTableField (RGISNetBasinArea,DBTableFieldFloat,"%10.1f",sizeof (DBFloat4));
DBObjTableField *nextFLD = new DBObjTableField (RGISNetStreamNext,DBTableFieldInt,"%6d",sizeof (DBInt));
DBObjRecord *cellRec, *toCellRec, *lineRec;
arcData->Projection (netData->Projection ());
arcData->Precision (netData->Precision ());
arcData->MaxScale (netData->MaxScale ());
arcData->MinScale (netData->MinScale ());
lineTable->AddField (basinFLD);
lineTable->AddField (fieldFLD);
lineTable->AddField (lengthFLD);
lineTable->AddField (areaFLD);
lineTable->AddField (basinAreaFLD);
lineTable->AddField (nextFLD);
cellTable->AddField (_RGISAnNetStreamIDFLD = new DBObjTableField ("StreamID",DBTableFieldInt,"%8d",sizeof (DBInt)));
_RGISAnNetStreamID = 0;
UIPauseDialogOpen ((char *) "Creating Stream Lines");
cellID = netIF->CellNum () - 1;
cellRec = netIF->Cell (cellID);
if (lineIF->NewSymbol ("Default Symbol") == (DBObjRecord *) NULL)
{ CMmsgPrint (CMmsgAppError, "Symbol Creation Error in: %s %d",__FILE__,__LINE__); return; }
for (;cellID >= 0;--cellID)
{
cellRec = netIF->Cell (cellID);
if (((toCellRec = netIF->ToCell (cellRec)) == (DBObjRecord *) NULL) ||
(_RGISAnNetOrderField->Int (cellRec) != _RGISAnNetOrderField->Int (toCellRec)) ||
(netIF->CellOrder (cellRec) != netIF->CellOrder (toCellRec)))
{
if (UIPause ((netIF->CellNum () - cellRec->RowID ()) * 100 / netIF->CellNum ())) goto Stop;
sprintf (objName,"Line: %5d",_RGISAnNetStreamID + 1);
if ((lineRec = lineIF->NewItem (objName)) == (DBObjRecord *) NULL)
{ CMmsgPrint (CMmsgAppError, "Line Insertion Error in: %s %d",__FILE__,__LINE__); return; }
nextFLD->Int (lineRec,toCellRec == (DBObjRecord *) NULL ? 0 : _RGISAnNetStreamIDFLD->Int (toCellRec) + 1);
basinFLD->Int (lineRec,netIF->CellBasinID (cellRec));
fieldFLD->Int (lineRec,_RGISAnNetOrderField->Int (cellRec));
_RGISAnNetVertex = 0;
netIF->UpStreamSearch (_RGISAnNetworkCellRec = cellRec,(DBNetworkACTION) _RGISAnNetworkUpStreamAction);
lineIF->FromNode (lineRec,lineIF->Node (netIF->Center (_RGISAnNetworkCellRec),true));
lineIF->ToNode (lineRec,lineIF->Node (netIF->Center (cellRec) + netIF->Delta (cellRec),true));
_RGISAnNetArea = netIF->CellArea (_RGISAnNetworkCellRec);
if (_RGISAnNetVertex > 1)
{
if (_RGISAnNetVertexNum < _RGISAnNetVertex - 1)
{
_RGISAnNetCoord = (DBCoordinate *) realloc (_RGISAnNetCoord,(_RGISAnNetVertex - 1) * sizeof (DBCoordinate));
if (_RGISAnNetCoord == (DBCoordinate *) NULL)
{ CMmsgPrint (CMmsgSysError, "Memory Allocation Error in: %s %d",__FILE__,__LINE__); return; }
}
_RGISAnNetVertex = 0;
netIF->DownStreamSearch (netIF->ToCell (_RGISAnNetworkCellRec),(DBNetworkACTION) _RGISAnNetworkDownStreamAction);
}
else _RGISAnNetVertex = 0;
lineIF->Vertexes (lineRec,_RGISAnNetCoord,_RGISAnNetVertex);
lineIF->ItemSymbol (lineRec,lineIF->Symbol (0));
lengthFLD->Float (lineRec,netIF->CellBasinLength (cellRec));
areaFLD->Float (lineRec,_RGISAnNetArea);
basinAreaFLD->Float (lineRec,netIF->CellBasinArea (cellRec));
_RGISAnNetStreamID += 1;
}
}
//.........这里部分代码省略.........
示例13: RGISAnalyseLineSSampleGridCBK
void RGISAnalyseLineSSampleGridCBK (Widget widget, RGISWorkspace *workspace,XmAnyCallbackStruct *callData)
{
char *fText;
int allowOk;
static int sample;
DBDataset *dataset = UIDataset ();
DBObjData *dbData = dataset->Data (), *grdData = dbData->LinkedData ();
DBObjTable *itemTable = dbData->Table (DBrNItems);
static Widget dShell = (Widget) NULL, mainForm;
static Widget fromNameTextF, toNameTextF;
XmString string;
widget = widget; workspace = workspace; callData = callData;
_RGISAnLineSampleGridFields = itemTable->Fields ();
if (dShell == (Widget) NULL)
{
Widget button;
dShell = UIDialogForm ((char *) "Single Layer Grid Sampling",false);
mainForm = UIDialogFormGetMainForm (dShell);
string = XmStringCreate ((char *) "Select",UICharSetBold);
button = XtVaCreateManagedWidget ("RGISAnalyseLineSSampleNameButton",xmPushButtonWidgetClass,mainForm,
XmNtopAttachment, XmATTACH_FORM,
XmNtopOffset, 10,
XmNrightAttachment, XmATTACH_FORM,
XmNrightOffset, 10,
XmNmarginHeight, 5,
XmNtraversalOn, False,
XmNlabelString, string,
XmNuserData, grdData->Type () == DBTypeGridContinuous ? DBTableFieldIsNumeric : DBTableFieldIsCategory,
NULL);
XmStringFree (string);
fromNameTextF = XtVaCreateManagedWidget ("RGISAnalyseLineSSampleNameTextF",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) _RGIAnalyseLineSSampleGridSSelectCBK,fromNameTextF);
string = XmStringCreate ((char *) "From Field:",UICharSetBold);
XtVaCreateManagedWidget ("RGISAnalyseLineSSampleNameLabel",xmLabelWidgetClass,mainForm,
XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
XmNtopWidget, button,
XmNleftAttachment, XmATTACH_FORM,
XmNleftOffset, 10,
XmNrightAttachment, XmATTACH_WIDGET,
XmNrightWidget, fromNameTextF,
XmNrightOffset, 10,
XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
XmNbottomWidget, button,
XmNlabelString, string,
NULL);
XmStringFree (string);
string = XmStringCreate ((char *) "Select",UICharSetBold);
button = XtVaCreateManagedWidget ("RGISAnalyseLineSSampleNameButton",xmPushButtonWidgetClass,mainForm,
XmNtopAttachment, XmATTACH_WIDGET,
XmNtopWidget, button,
XmNtopOffset, 10,
XmNrightAttachment, XmATTACH_FORM,
XmNrightOffset, 10,
XmNbottomAttachment, XmATTACH_FORM,
XmNbottomOffset, 10,
XmNmarginHeight, 5,
XmNtraversalOn, False,
XmNlabelString, string,
XmNuserData, grdData->Type () == DBTypeGridContinuous ? DBTableFieldIsNumeric : DBTableFieldIsCategory,
NULL);
XmStringFree (string);
toNameTextF = XtVaCreateManagedWidget ("RGISAnalyseLineSSampleNameTextF",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) _RGIAnalyseLineSSampleGridSSelectCBK,toNameTextF);
string = XmStringCreate ((char *) "To Field:",UICharSetBold);
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,
//.........这里部分代码省略.........