本文整理汇总了C++中DBObjTable::Next方法的典型用法代码示例。如果您正苦于以下问题:C++ DBObjTable::Next方法的具体用法?C++ DBObjTable::Next怎么用?C++ DBObjTable::Next使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBObjTable
的用法示例。
在下文中一共展示了DBObjTable::Next方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _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);
}
示例2: 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();
}
示例3: _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);
}
示例4: 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 ());
}
示例5: RGISAnalyseLineSSampleGridCBK
//.........这里部分代码省略.........
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,
NULL);
XmStringFree (string);
XtAddCallback (UIDialogFormGetOkButton (dShell),XmNactivateCallback,(XtCallbackProc) UIAuxSetBooleanTrueCBK,&sample);
}
sample = false;
UIDialogFormPopup (dShell);
while (UILoop ())
{
allowOk = false;
fText = XmTextFieldGetString (fromNameTextF);
if (strlen (fText) > 0) allowOk = true;
XtFree (fText);
fText = XmTextFieldGetString (toNameTextF);
if (strlen (fText) > 0) allowOk = true;
XtFree (fText);
XtSetSensitive (UIDialogFormGetOkButton (dShell),allowOk);
}
UIDialogFormPopdown (dShell);
if (sample)
{
DBInt ret;
DBFloat value;
DBCoordinate coord;
DBGridIF *gridIF = new DBGridIF (grdData);
DBVLineIF *lineIF = new DBVLineIF (dbData);
DBObjTableField *fromField;
DBObjTableField *toField;
DBObjRecord *record;
fText = XmTextFieldGetString (fromNameTextF);
if (strlen (fText) > 0)
{
if ((fromField = itemTable->Field (fText)) == (DBObjTableField *) NULL)
itemTable->AddField (fromField = new DBObjTableField (fText,DBTableFieldFloat,"%10.3f",sizeof (DBFloat4)));
}
else fromField = (DBObjTableField *) NULL;
XtFree (fText);
fText = XmTextFieldGetString (toNameTextF);
if (strlen (fText) > 0)
{
if ((toField = itemTable->Field (fText)) == (DBObjTableField *) NULL)
itemTable->AddField (toField = new DBObjTableField (fText,DBTableFieldFloat,"%10.3f",sizeof (DBFloat4)));
}
else toField = (DBObjTableField *) NULL;
XtFree (fText);
UIPauseDialogOpen ((char *) "Sampling Grid");
for (record = itemTable->First ();record != (DBObjRecord *) NULL;record = itemTable->Next ())
{
if (UIPause (record->RowID () * 100 / itemTable->ItemNum ())) goto Stop;
if (fromField != (DBObjTableField *) NULL)
{
coord = lineIF->FromCoord (record);
ret = gridIF->Value (coord,&value);
if (fromField->Type () == DBTableFieldFloat)
{
if (ret) fromField->Float (record,value);
else fromField->Float (record,fromField->FloatNoData ());
}
else
{
if (ret) fromField->Int (record,(DBInt) value);
else fromField->Int (record,fromField->IntNoData ());
}
}
if (toField != (DBObjTableField *) NULL)
{
coord = lineIF->ToCoord (record);
ret = gridIF->Value (coord,&value);
if (toField->Type () == DBTableFieldFloat)
{
if (ret) toField->Float (record,value);
else toField->Float (record,toField->FloatNoData ());
}
else
{
if (ret) toField->Int (record,(DBInt) value);
else toField->Int (record,toField->IntNoData ());
}
}
}
Stop:
UIPauseDialogClose ();
delete lineIF;
delete gridIF;
}
}
示例6: DBImportARCLine
int DBImportARCLine (DBObjData *vecData,const char *arcCov)
{
FILE *inFile;
DBInt arcNum, vertex, swap = DBByteOrder (DBByteOrderLITTLE), floatCov;
char fileName [DBDataFileNameLen], objName [DBStringLength];
short infoHeader [50];
DBARCRecord arcRecord;
DBObjTable *lines;
DBObjTable *nodes;
DBObjectLIST<DBObjRecord> *data;
DBObjRecord *lineRec, *nodeRec, *dataRec;
DBRegion dataExtent = vecData->Extent (), itemExtent;
DBObjTableField *fromNodeFLD;
DBObjTableField *toNodeFLD;
DBObjTableField *leftPolyFLD;
DBObjTableField *rightPolyFLD;
DBObjTableField *vertexesFLD;
DBObjTableField *vertexNumFLD;
DBObjTableField *extentFLD;
DBObjTableField *coordFLD;
DBObjTableField *linkNumFLD;
DBCoordinate *vertexes, nodeCoord;
DBFloat4 floatVAR [2];
switch (vecData->Type ())
{
case DBTypeVectorLine: lines = vecData->Table (DBrNItems); break;
case DBTypeVectorPolygon: lines = vecData->Table (DBrNContours); break;
default: CMmsgPrint (CMmsgAppError, "Invalide Vector Data Type in: %s %d",__FILE__,__LINE__); return (DBFault);
}
fromNodeFLD = lines->Field (DBrNFromNode);
toNodeFLD = lines->Field (DBrNToNode);
leftPolyFLD = lines->Field (DBrNLeftPoly);
rightPolyFLD= lines->Field (DBrNRightPoly);
vertexesFLD = lines->Field (DBrNVertexes);
vertexNumFLD= lines->Field (DBrNVertexNum);
extentFLD = lines->Field (DBrNRegion);
nodes = vecData->Table (DBrNNodes);
coordFLD = nodes->Field (DBrNCoord);
linkNumFLD = nodes->Field (DBrNLinkNum);
data = vecData->Arrays ();
sprintf (fileName,"%s/arc",arcCov);
if (access (fileName,R_OK) == DBFault) sprintf (fileName,"%s/arc.adf",arcCov);
if ((inFile = fopen (fileName,"r")) == NULL)
{ CMmsgPrint (CMmsgSysError, "File Opening Error in: %s %d",__FILE__,__LINE__); return (DBFault); }
if (fread (infoHeader,sizeof (short),50,inFile) != 50)
{ CMmsgPrint (CMmsgSysError, "File Reading Error in: %s %d",__FILE__,__LINE__); return (DBFault); }
arcNum = 0;
for (lineRec = lines->First ();arcRecord.Read (inFile,swap) != DBFault;lineRec = lines->Next ())
{
if (lineRec == NULL)
{
sprintf (objName,"Line: %5d",arcRecord.ID () + 1);
if ((lineRec = lines->Add (objName)) == (DBObjRecord *) NULL) return (DBFault);
}
else DBPause ((++arcNum * 100) / lines->ItemNum ());
floatCov = arcRecord.RecordLength () - 12 == arcRecord.NumOfPnts () * (DBInt) sizeof (float) ? true : false;
while (arcRecord.FromNode () > nodes->ItemNum ())
{
sprintf (objName,"Node: %5d",nodes->ItemNum () + 1);
nodes->Add (objName);
if ((nodeRec = nodes->Item ()) == NULL) return (DBFault);
linkNumFLD->Int (nodeRec,0);
}
if ((nodeRec = nodes->Item (arcRecord.FromNode () - 1)) == (DBObjRecord *) NULL)
{ CMmsgPrint (CMmsgAppError, "Node Not Found in: %s %d",__FILE__,__LINE__); return (DBFault); }
if (floatCov)
{
if (fread (floatVAR,sizeof (floatVAR),1,inFile) != 1)
{ CMmsgPrint (CMmsgSysError, "File Reading Error in: %s %d",__FILE__,__LINE__); return (DBFault); }
if (swap) { DBByteOrderSwapWord (floatVAR); DBByteOrderSwapWord (floatVAR + 1); }
nodeCoord.X = (DBFloat) floatVAR [0];
nodeCoord.Y = (DBFloat) floatVAR [1];
}
else
{
if (fread (&nodeCoord,sizeof (DBCoordinate),1,inFile) != 1)
{ CMmsgPrint (CMmsgSysError, "File Reading Error in: %s %d",__FILE__,__LINE__); return (DBFault); }
if (swap) nodeCoord.Swap ();
}
coordFLD->Coordinate (nodeRec,nodeCoord);
fromNodeFLD->Record (lineRec,nodeRec);
if (leftPolyFLD != (DBObjTableField *) NULL) leftPolyFLD->Record (lineRec,arcRecord.LeftPoly ());
if (rightPolyFLD != (DBObjTableField *) NULL) rightPolyFLD->Record (lineRec,arcRecord.RightPoly ());
itemExtent.LowerLeft = nodeCoord;
itemExtent.UpperRight = nodeCoord;
linkNumFLD->Int (nodeRec,linkNumFLD->Int (nodeRec) + 1);
if (arcRecord.NumOfPnts () > 2)
{
if ((dataRec = data->Item (lineRec->RowID ())) == (DBObjRecord *) NULL)
{
//.........这里部分代码省略.........
示例7: DBImportARCPoly
int DBImportARCPoly (DBObjData *vecData,const char *arcCov)
{
DBInt polyNum = 0, line, lineNum, vertexNum, polyDir;
DBObjTable *items = vecData->Table (DBrNItems);
DBObjTable *lines = vecData->Table (DBrNContours);
DBObjTableField *firstLineFLD = items->Field (DBrNFirstLine);
DBObjTableField *lineNumFLD = items->Field (DBrNLineNum);
DBObjTableField *polyVertexNumFLD = items->Field (DBrNVertexNum);
DBObjTableField *polyExtentFLD = items->Field (DBrNRegion);
DBObjTableField *leftPolyFLD = lines->Field (DBrNLeftPoly);
DBObjTableField *rightPolyFLD = lines->Field (DBrNRightPoly);
DBObjTableField *nextLineFLD = lines->Field (DBrNNextLine);
DBObjTableField *prevLineFLD = lines->Field (DBrNPrevLine);
DBObjTableField *fromNodeFLD = lines->Field (DBrNFromNode);
DBObjTableField *toNodeFLD = lines->Field (DBrNToNode);
DBObjTableField *lineVertextNumFLD = lines->Field (DBrNVertexNum);
DBObjTableField *lineExtentFLD = lines->Field (DBrNRegion);
DBObjRecord *polyRec, *lineRec, *firstNodeRec, *nodeRec, **lineRecArray;
DBRegion extent, initRegion;
if (DBImportARCLine (vecData,arcCov) == DBFault) return (DBFault);
items->Delete (0);
for (polyRec = items->First ();polyRec != (DBObjRecord *) NULL;polyRec = items->Next ())
lineNumFLD->Int (polyRec,0);
for (lineRec = lines->First ();lineRec != (DBObjRecord *) NULL;lineRec = lines->Next ())
{
rightPolyFLD->Record (lineRec,items->Item ((DBInt) (rightPolyFLD->Record(lineRec) - (DBObjRecord *) NULL)));
leftPolyFLD->Record (lineRec,items->Item ((DBInt) (leftPolyFLD->Record (lineRec) - (DBObjRecord *) NULL)));
nextLineFLD->Record (lineRec,(DBObjRecord *) NULL);
prevLineFLD->Record (lineRec,(DBObjRecord *) NULL);
}
if ((lineRecArray = (DBObjRecord **) calloc (lines->ItemNum (),sizeof (DBObjRecord *))) == (DBObjRecord **) NULL)
{ CMmsgPrint (CMmsgSysError, "Memory Allocation Error in: %s %d",__FILE__,__LINE__); return (DBFault); }
for (polyRec = items->First ();polyRec != (DBObjRecord *) NULL;polyRec = items->Next ())
{
DBPause ((++polyNum * 100) / items->ItemNum ());
lineNum = vertexNum = 0;
extent = initRegion;
for (lineRec = lines->First ();lineRec != (DBObjRecord *) NULL;lineRec = lines->Next ())
if ((rightPolyFLD->Record (lineRec) == polyRec) || (leftPolyFLD->Record (lineRec) == polyRec))
{
lineRecArray [lineNum++] = lineRec;
vertexNum += lineVertextNumFLD->Int (lineRec);
extent.Expand (lineExtentFLD->Region (lineRec));
}
lineNumFLD->Int (polyRec,lineNum);
polyExtentFLD->Region (polyRec,extent);
firstLineFLD->Record (polyRec,lineRecArray [0]);
firstNodeRec = (rightPolyFLD->Record (lineRecArray [0]) == polyRec) ?
fromNodeFLD->Record (lineRecArray [0]) : toNodeFLD->Record(lineRecArray [0]);
for (lineNum = 1;lineNum < lineNumFLD->Int (polyRec);++lineNum)
{
polyDir = (rightPolyFLD->Record (lineRecArray [lineNum - 1]) == polyRec);
nodeRec = polyDir ? toNodeFLD->Record (lineRecArray [lineNum - 1]) :
fromNodeFLD->Record(lineRecArray [lineNum - 1]);
for (line = lineNum;line < lineNumFLD->Int (polyRec); ++line)
if ((nodeRec == fromNodeFLD->Record (lineRecArray [line])) ||
(nodeRec == toNodeFLD->Record (lineRecArray [line]))) break;
if (line < lineNumFLD->Int (polyRec))
{
lineRec = lineRecArray [lineNum];
lineRecArray [lineNum] = lineRecArray [line];
lineRecArray [line] = lineRec;
}
else
{
vertexNum += 1;
if (nodeRec != firstNodeRec) vertexNum += 1;
}
}
polyDir = (rightPolyFLD->Record (lineRecArray [lineNum - 1]) == polyRec);
nodeRec = polyDir ? toNodeFLD->Record (lineRecArray [lineNum - 1]) :
fromNodeFLD->Record(lineRecArray [lineNum - 1]);
polyVertexNumFLD->Int (polyRec,vertexNum + lineNum + 1 + (nodeRec != firstNodeRec ? 1 : 0));
for (lineNum = 1;lineNum < lineNumFLD->Int (polyRec);++lineNum)
{
if (rightPolyFLD->Record (lineRecArray [lineNum - 1]) == polyRec)
nextLineFLD->Record (lineRecArray [lineNum - 1],lineRecArray [lineNum]);
else prevLineFLD->Record (lineRecArray [lineNum - 1],lineRecArray [lineNum]);
}
if (rightPolyFLD->Record (lineRecArray [lineNum - 1]) == polyRec)
nextLineFLD->Record (lineRecArray [lineNum - 1],lineRecArray [0]);
else prevLineFLD->Record (lineRecArray [lineNum - 1],lineRecArray [0]);
}
free (lineRecArray);
return (DBSuccess);
}
示例8: 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);
}
示例9: RGlibPointSubbasinHist
DBInt RGlibPointSubbasinHist(DBObjData *pntData, DBObjData *netData, DBObjData *grdData, DBObjData *tblData) {
DBInt layerID, layerNum = 0, progress = 0, maxProgress;
DBObjTable *itemTable = grdData->Table(DBrNItems);
DBObjTable *table = tblData->Table(DBrNItems);
DBObjTableField *pointIDFLD;
DBObjTableField *layerIDFLD;
DBObjTableField *layerNameFLD;
DBObjTableField *categoryIDFLD;
DBObjTableField *categoryFLD;
DBObjTableField *percentFLD;
DBObjTableField *areaFLD;
DBObjTableField *cellNumFLD;
DBVPointIF *pntIF;
DBNetworkIF *netIF;
DBObjRecord *pntRec, *itemRec, *tblRec;
DBObjectLIST<DBObjTableField> *fields;
_RGlibPointGrdIF = new DBGridIF(grdData);
for (layerID = 0; layerID < _RGlibPointGrdIF->LayerNum(); ++layerID) {
_RGlibPointGrdLayerRec = _RGlibPointGrdIF->Layer(layerID);
if ((_RGlibPointGrdLayerRec->Flags() & DBObjectFlagIdle) != DBObjectFlagIdle) ++layerNum;
}
if (layerNum < 1) {
CMmsgPrint(CMmsgUsrError, "No Layer to Process!");
delete _RGlibPointGrdIF;
return (DBFault);
}
pntIF = new DBVPointIF(pntData);
netIF = new DBNetworkIF(netData);
table->AddField(pointIDFLD = new DBObjTableField("GHAASPointID", DBTableFieldInt, "%8d", sizeof(DBInt)));
table->AddField(layerIDFLD = new DBObjTableField("LayerID", DBTableFieldInt, "%4d", sizeof(DBShort)));
table->AddField(layerNameFLD = new DBObjTableField("LayerName", DBTableFieldString, "%s", DBStringLength));
table->AddField(categoryIDFLD = new DBObjTableField(DBrNCategoryID, DBTableFieldInt, "%2d", sizeof(DBShort)));
table->AddField(categoryFLD = new DBObjTableField(DBrNCategory, DBTableFieldString, _RGlibPointGrdIF->ValueFormat(),
DBStringLength));
table->AddField(cellNumFLD = new DBObjTableField("CellNum", DBTableFieldInt, "%8d", sizeof(DBInt)));
table->AddField(areaFLD = new DBObjTableField(DBrNArea, DBTableFieldFloat, "%10.1f", sizeof(DBFloat4)));
table->AddField(percentFLD = new DBObjTableField(DBrNPercent, DBTableFieldFloat, "%6.2f", sizeof(DBFloat4)));
_RGlibHistogram = (Histogram *) malloc(itemTable->ItemNum() * sizeof(Histogram));
if (_RGlibHistogram == (Histogram *) NULL) {
CMmsgPrint(CMmsgAppError, "Memory Allocation Error in: %s %d", __FILE__, __LINE__);
return (DBFault);
}
maxProgress = pntIF->ItemNum() * _RGlibPointGrdIF->LayerNum();
for (layerID = 0; layerID < _RGlibPointGrdIF->LayerNum(); ++layerID) {
_RGlibPointGrdLayerRec = _RGlibPointGrdIF->Layer(layerID);
if ((_RGlibPointGrdLayerRec->Flags() & DBObjectFlagIdle) == DBObjectFlagIdle) continue;
for (pntRec = pntIF->FirstItem(); pntRec != (DBObjRecord *) NULL; pntRec = pntIF->NextItem()) {
if (DBPause(progress * 100 / maxProgress)) goto Stop;
progress++;
if ((pntRec->Flags() & DBObjectFlagIdle) == DBObjectFlagIdle) continue;
for (itemRec = itemTable->First(); itemRec != (DBObjRecord *) NULL; itemRec = itemTable->Next())
_RGlibHistogram[itemRec->RowID()].Initialize();
netIF->UpStreamSearch(netIF->Cell(pntIF->Coordinate(pntRec)), (DBNetworkACTION) _RGlibSubbasinCategories);
for (itemRec = itemTable->First(); itemRec != (DBObjRecord *) NULL; itemRec = itemTable->Next())
if (_RGlibHistogram[itemRec->RowID()].cellNum > 0) {
tblRec = table->Add(pntRec->Name());
pointIDFLD->Int(tblRec, pntRec->RowID() + 1);
layerIDFLD->Int(tblRec, _RGlibPointGrdLayerRec->RowID());
layerNameFLD->String(tblRec, _RGlibPointGrdLayerRec->Name());
categoryIDFLD->Int(tblRec, itemRec->RowID() + 1);
categoryFLD->String(tblRec, itemRec->Name());
areaFLD->Float(tblRec, _RGlibHistogram[itemRec->RowID()].area);
percentFLD->Float(tblRec, _RGlibHistogram[itemRec->RowID()].area /
netIF->CellBasinArea(netIF->Cell(pntIF->Coordinate(pntRec))) * 100.0);
cellNumFLD->Int(tblRec, _RGlibHistogram[itemRec->RowID()].cellNum);
}
}
}
Stop:
delete _RGlibPointGrdIF;
delete netIF;
delete pntIF;
free(_RGlibHistogram);
if (progress == maxProgress) {
fields = new DBObjectLIST<DBObjTableField>("Field List");
fields->Add(new DBObjTableField(*pointIDFLD));
fields->Add(new DBObjTableField(*layerIDFLD));
fields->Add(areaFLD = new DBObjTableField(*areaFLD));
areaFLD->Flags(DBObjectFlagSortReversed, DBSet);
table->ListSort(fields);
delete fields;
return (DBSuccess);
}
return (DBFault);
}
示例10: 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;
//.........这里部分代码省略.........
示例11: RGISAnalysePointSTNPointsCBK
//.........这里部分代码省略.........
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];
DBObjData *netData = dbData->LinkedData ();
sprintf (dataName,"%s STN",dbData->Name ());
dbData = new DBObjData (*dbData);
dbData->Name (dataName);
if (UIDataHeaderForm (dbData))
{
char *dstText;
DBObjTable *groups;
DBObjRecord *pointRec;
srcText = XmTextFieldGetString (srcTextF);
dbData->LinkedData (netData);
table = dbData->Table (DBrNItems);
groups = dbData->Table (DBrNGroups);
for (pointRec = table->First ();pointRec != (DBObjRecord *) NULL;pointRec = table->Next ())
if ((pointRec->Flags () & DBObjectFlagIdle) == DBObjectFlagIdle)
{
if (groups != (DBObjTable *) NULL)
groups->Delete (groups->Item (pointRec->RowID ()));
table->Delete (pointRec);
pointRec = table->Next (DBBackward);
}
field = table->Field (srcText);
XtFree (srcText);
RGlibPointSTNCoordinates (dbData,field);
UIPauseDialogOpen ((char *) "Moving Points");
RGlibPointSTNCharacteristics (dbData);
UIPauseDialogClose ();
srcText = XmTextFieldGetString (srcTextF);
if (strlen (dstText = XmTextFieldGetString (dstTextF)) > 0)
{
srcText = XmTextFieldGetString (srcTextF);
RGlibGenFuncTopoSubtract (table,RGlibNextStation,srcText,dstText);
XtFree (dstText);
}
if (strlen (dstText = XmTextFieldGetString (errTextF)) > 0)
{
char *cmpText;
srcText = XmTextFieldGetString (srcTextF);
cmpText = XmTextFieldGetString (cmpTextF);
RGlibGenFuncFieldCompare (table,srcText,cmpText,dstText,diffMethod);
XtFree (dstText);
XtFree (cmpText);
}
XtFree (srcText);
UI2DViewRedrawAll ();
workspace->CurrentData (dbData);
}
else delete dbData;
}
}
示例12: RGISToolsConvertToPointCBK
//.........这里部分代码省略.........
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);
XtAddCallback (UIDialogFormGetOkButton (dShell),XmNactivateCallback,(XtCallbackProc) UIAuxSetBooleanTrueCBK,&convert);
}
convert = false;
UIDialogFormPopup (dShell);
while (UILoop ())
{
xText = XmTextFieldGetString (xCoordTextF);
yText = XmTextFieldGetString (yCoordTextF);
allowOk = (strlen (xText) > 0) && (strlen (yText) > 0);
XtFree (xText); XtFree (yText);
XtSetSensitive (UIDialogFormGetOkButton (dShell),allowOk);
}
UIDialogFormPopdown (dShell);
if (convert)
{
DBObjData *pntData = new DBObjData ("",DBTypeVectorPoint);
pntData->Name (dbData->Name ());
pntData->Document (DBDocSubject,dbData->Document (DBDocSubject));
pntData->Document (DBDocGeoDomain,dbData->Document (DBDocGeoDomain));
if (UIDataHeaderForm (pntData))
{
DBCoordinate coord;
DBObjTableField *nField, *xField, *yField, *tblFLD, *pntFLD;
DBObjRecord *tblRec, *pntRec, *symRec;
DBObjTable *pntTable = pntData->Table (DBrNItems);
DBObjTable *symbols = pntData->Table (DBrNSymbols);
DBObjTableField *symbolIDFLD = symbols->Field (DBrNSymbolID);
DBObjTableField *fgFLD = symbols->Field (DBrNForeground);
DBObjTableField *bgFLD = symbols->Field (DBrNBackground);
DBObjTableField *stFLD = symbols->Field (DBrNStyle);
DBObjTableField *coordFLD = pntTable->Field (DBrNCoord);
DBObjTableField *symbolFLD = pntTable->Field (DBrNSymbol);
DBRegion extent;
symRec = symbols->Add ("Default Symbol");
symbolIDFLD->Int (symRec,0);
fgFLD->Int (symRec,1);
bgFLD->Int (symRec,2);
stFLD->Int (symRec,0);
nText = XmTextFieldGetString (nameTextF);
xText = XmTextFieldGetString (xCoordTextF);
yText = XmTextFieldGetString (yCoordTextF);
nField = _RGISToolsConvertToPointFields->Item (nText);
xField = _RGISToolsConvertToPointFields->Item (xText);
yField = _RGISToolsConvertToPointFields->Item (yText);
XtFree (nText); XtFree (xText); XtFree (yText);
for (tblRec = itemTable->First ();tblRec != (DBObjRecord *) NULL;tblRec = itemTable->Next ())
{
if (CMmathEqualValues (coord.X = xField->Float (tblRec),xField->FloatNoData ())) continue;
if (CMmathEqualValues (coord.Y = yField->Float (tblRec),yField->FloatNoData ())) continue;
if (nField == (DBObjTableField *) NULL) pntRec = pntTable->Add (tblRec->Name ());
else pntRec = pntTable->Add (nField->String (tblRec));
coordFLD->Coordinate (pntRec,coord);
symbolFLD->Record (pntRec,symRec);
extent.Expand (coord);
}
pntData->Extent (extent);
pntData->Projection (DBMathGuessProjection (extent));
pntData->Precision (DBMathGuessPrecision (extent));
for (tblFLD = _RGISToolsConvertToPointFields->First ();tblFLD != (DBObjTableField *) NULL;tblFLD = _RGISToolsConvertToPointFields->Next ())
if ((tblFLD != nField) && (tblFLD != xField) && (tblFLD != yField) && DBTableFieldIsVisible (tblFLD))
{
pntTable->AddField (pntFLD = new DBObjTableField (*tblFLD));
pntFLD->Required (false);
pntRec = pntTable->First ();
for (tblRec = itemTable->First ();tblRec != (DBObjRecord *) NULL;tblRec = itemTable->Next ())
{
if (CMmathEqualValues (coord.X = xField->Float (tblRec),xField->FloatNoData ())) continue;
if (CMmathEqualValues (coord.Y = yField->Float (tblRec),yField->FloatNoData ())) continue;
switch (tblFLD->Type ())
{
case DBTableFieldString: pntFLD->String (pntRec,tblFLD->String (tblRec)); break;
case DBTableFieldInt: pntFLD->Int (pntRec,tblFLD->Int (tblRec)); break;
case DBTableFieldFloat: pntFLD->Float (pntRec,tblFLD->Float (tblRec)); break;
case DBTableFieldDate: pntFLD->Date (pntRec,tblFLD->Date (tblRec)); break;
default: CMmsgPrint (CMmsgAppError, "Invalid Field Type in: %s %d",__FILE__,__LINE__); break;
}
pntRec = pntTable->Next ();
}
}
workspace->CurrentData (pntData);
}
else delete pntData;
}
}