当前位置: 首页>>代码示例>>C++>>正文


C++ DBObjTable::Item方法代码示例

本文整理汇总了C++中DBObjTable::Item方法的典型用法代码示例。如果您正苦于以下问题:C++ DBObjTable::Item方法的具体用法?C++ DBObjTable::Item怎么用?C++ DBObjTable::Item使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DBObjTable的用法示例。


在下文中一共展示了DBObjTable::Item方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: RGlibGenFuncSymbolField

int RGlibGenFuncSymbolField (DBObjData *data, const char *fieldName)
	{
	DBInt recID;
	char symbolName [DBStringLength + 1];
	DBObjTable *table = data->Table (DBrNItems);
	DBObjTable *symbols = data->Table (DBrNSymbols);
	DBObjRecord *record, *symbolRec;
	DBObjTableField *field;
	DBObjTableField *symbolFLD;
	DBObjTableField *symbolIDFLD;
	DBObjTableField *foregroundFLD;
	DBObjTableField *backgroundFLD;
	DBObjTableField *styleFLD;

	if (table == (DBObjTable *) NULL) return (DBFault);
	if ((field = table->Field (fieldName)) == (DBObjTableField *) NULL)
	{ CMmsgPrint (CMmsgAppError,  "Invalid field name in: %s %d",__FILE__,__LINE__);       return (DBFault); }
	if ((symbolFLD = table->Field (DBrNSymbol)) == (DBObjTableField *) NULL)
	{ CMmsgPrint (CMmsgAppError,  "Missing symbol field in: %s %d",__FILE__,__LINE__);     return (DBFault); }
	if (symbols == (DBObjTable *) NULL)
	{ CMmsgPrint (CMmsgAppError,  "Missing symbol table in: %s %d",__FILE__,__LINE__);     return (DBFault); }
	if ((symbolIDFLD   = symbols->Field (DBrNSymbolID))   == (DBObjTableField *) NULL)
	{ CMmsgPrint (CMmsgAppError,  "Missing symbolID field in: %s %d",__FILE__,__LINE__);   return (DBFault); }
	if ((foregroundFLD = symbols->Field (DBrNForeground)) == (DBObjTableField *) NULL)
	{ CMmsgPrint (CMmsgAppError,  "Missing foreground field in: %s %d",__FILE__,__LINE__); return (DBFault); }
	if ((backgroundFLD = symbols->Field (DBrNBackground)) == (DBObjTableField *) NULL)
	{ CMmsgPrint (CMmsgAppError,  "Missing background field in: %s %d",__FILE__,__LINE__); return (DBFault); }
	if ((styleFLD      = symbols->Field (DBrNStyle))      == (DBObjTableField *) NULL)
	{ CMmsgPrint (CMmsgAppError,  "Missing style field in: %s %d",__FILE__,__LINE__);      return (DBFault); }

	symbols->DeleteAll ();
	for (recID = 0;recID < table->ItemNum (); ++recID)
		{
		record = table->Item (recID);
		DBPause (record->RowID () * 100 / table->ItemNum ());
		
		if (field->Type () == DBTableFieldString) sprintf (symbolName,"%s",field->String (record));
		else	sprintf (symbolName,"Symbol:%03d",field->Int (record));
		if ((symbolRec = (DBObjRecord *) symbols->Item (symbolName)) == (DBObjRecord *) NULL)
			{
			if ((symbolRec = symbols->Add (symbolName)) == NULL)
				{ CMmsgPrint (CMmsgAppError, "Symbol Object Creation Error in: %s %d",__FILE__,__LINE__); return (DBFault); }
			symbolIDFLD->Int (symbolRec,field->Type () == DBTableFieldString ? symbolRec->RowID () : field->Int (record));
			foregroundFLD->Int (symbolRec,1);
			backgroundFLD->Int (symbolRec,0);
			styleFLD->Int (symbolRec,0);
			}
		symbolFLD->Record (record,symbolRec);
		}
	return (DBSuccess);
	}
开发者ID:bandi13,项目名称:RGIS,代码行数:51,代码来源:RGlibGenFuncs.C

示例2: _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);
	}
开发者ID:gyelnats,项目名称:RGIS,代码行数:13,代码来源:RGISPanels.C

示例3: _RGISGrpPanelSaveCBK

static void _RGISGrpPanelSaveCBK (Widget widget,RGISGrpPanel *grpPanel,XmAnyCallbackStruct *callData)

	{
	DBInt rowID;
	DBDataset  *dataset= UIDataset ();
	DBObjData  *dbData = dataset->Data ();
	DBObjTable *itemTable  = dbData->Table (DBrNItems);
	DBObjTable *groupTable = dbData->Table (DBrNGroups);
	DBObjTableField *group;
	DBObjRecord *itemRec, *groupRec;
	UITable *tableCLS;

	if (groupTable == (DBObjTable *) NULL) return;
	group = grpPanel->Current ();
	for (rowID = 0;rowID < groupTable->ItemNum ();++rowID)
		{
		groupRec = groupTable->Item (rowID);
		itemRec = itemTable->Item (rowID);
		group->Int (groupRec,(itemRec->Flags () & DBObjectFlagSelected) == DBObjectFlagSelected ? true : false);
		}
	if ((tableCLS = (UITable *) dbData->Display (UITableName (dbData,groupTable))) != (UITable *) NULL)
		tableCLS->Draw ();
	}
开发者ID:gyelnats,项目名称:RGIS,代码行数:23,代码来源:RGISPanels.C

示例4: 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);
}
开发者ID:bmfekete,项目名称:RGIS,代码行数:21,代码来源:DBObjData.C

示例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 ());
	}
开发者ID:gyelnats,项目名称:RGIS,代码行数:23,代码来源:RGISPanels.C

示例6: RGISAnalysePointInterStationTSCBK

void RGISAnalysePointInterStationTSCBK (Widget widget, RGISWorkspace *workspace,XmAnyCallbackStruct *callData)

	{
	char *selection;
	DBDataset *dataset = UIDataset ();
	DBObjMetaEntry *metaEntry;
	DBObjData *pntData = dataset->Data (), *tsData;
	DBObjTable *relateTBL = pntData->Table (DBrNRelations);
	DBObjRecord *relateRec;
	DBObjTableField *relDataFLD;
	DBObjTableField *relateFLD;
	DBObjTableField *joinFLD;
	static Widget selectWidget = (Widget) NULL;

	if (selectWidget == (Widget) NULL) selectWidget = UISelectionCreate ((char *) "Select Time Series");

	if ((selection = UISelectObject (selectWidget,(DBObjectLIST<DBObject> *) relateTBL)) == (char *) NULL) return;
	if ((relateRec = relateTBL->Item (selection)) == (DBObjRecord *) NULL)
		{ CMmsgPrint (CMmsgAppError, "Relate Record Error in: %s %d",__FILE__,__LINE__); return; }

	relDataFLD = relateTBL->Field (DBrNRelateData);
	relateFLD = relateTBL->Field (DBrNRelateField);
	joinFLD	= relateTBL->Field (DBrNRelateJoinField);

	if ((tsData = dataset->Data (relDataFLD->String (relateRec))) == (DBObjData *) NULL)
		{
		if ((metaEntry = dataset->Meta (relDataFLD->String (relateRec))) == (DBObjMetaEntry *) NULL)
			{ CMmsgPrint (CMmsgAppError, "Meta Enrty Finding Error in: %s %d",__FILE__,__LINE__); return; }
		tsData = new DBObjData ();
		if (tsData->Read (metaEntry->FileName ()) != DBSuccess) return;
		}
	workspace->CurrentData (tsData);

	UIPauseDialogOpen ((char *) "Calculating");
	RGlibPointInterStationTS (pntData,tsData,relateFLD->String (relateRec),joinFLD->String (relateRec));
	UIPauseDialogClose ();
	}
开发者ID:gyelnats,项目名称:RGIS,代码行数:37,代码来源:RGISAnPoint.C

示例7: 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)
				{
//.........这里部分代码省略.........
开发者ID:rjs80,项目名称:RGIS,代码行数:101,代码来源:DBImpARCLine.C

示例8: 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);
	}
开发者ID:amiara,项目名称:RGIS,代码行数:93,代码来源:DBImpARCPoly.C

示例9: 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);
	}
开发者ID:gyelnats,项目名称:RGIS,代码行数:83,代码来源:DBImpARC.C

示例10: RGISAnalysePointSTNPointsCBK


//.........这里部分代码省略.........
		mButton = XtVaCreateManagedWidget ("RGISAnalysePointSTNPointsMenuButton",xmPushButtonWidgetClass,menu,
								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)
		{
开发者ID:gyelnats,项目名称:RGIS,代码行数:67,代码来源:RGISAnPoint.C

示例11: Read

		DBInt Read (FILE *file,DBObjData *data)
			{
			DBInt i, layer, swap, valueType, valueSize, docLength;
			DMLayerHeader dmLayerHeader;
			DBObjRecord *layerRec, *dataRec;
			DBObjTable *layerTable = data->Table (DBrNLayers);
			DBObjTable *itemTable	 = data->Table (DBrNItems);
			DBObjTableField *rowNumFLD = layerTable->Field (DBrNRowNum);
			DBObjTableField *colNumFLD = layerTable->Field (DBrNColNum);
			DBObjTableField *cellWidthFLD = layerTable->Field (DBrNCellWidth);
			DBObjTableField *cellHeightFLD = layerTable->Field (DBrNCellHeight);
			DBObjTableField *valueTypeFLD = layerTable->Field (DBrNValueType);
			DBObjTableField *valueSizeFLD = layerTable->Field (DBrNValueSize);
			DBObjTableField *layerFLD = layerTable->Field (DBrNLayer);
			DBGridIF *gridIF;

			if ((swap = DMFileHeader::Read (file)) == DBFault) return (DBFault);
         data->Extent (Extent ());
         data->Projection (DBMathGuessProjection (data->Extent ()));
         data->Precision  (DBMathGuessPrecision  (data->Extent ()));
			if (FileType () != DMMatrix)
				{ CMmsgPrint (CMmsgAppError, "Wrong File Type in: %s %d",__FILE__,__LINE__); return (DBFault); }
			switch (DataType ())
				{
				case DMFloat:	valueType = DBTableFieldFloat;	valueSize = sizeof (DBFloat4);break;
				case DMInt:		valueType = DBTableFieldInt;		valueSize = sizeof (DBInt);	break;
				case DMByte:	valueType = DBTableFieldInt;		valueSize = sizeof (DBByte);	break;
				default: CMmsgPrint (CMmsgAppError, "Wrong Data Value Type in: %s %d",__FILE__,__LINE__); return (DBFault);
				}
			for (layer = 0;layer < LayerNum ();++layer)
				{
				if (dmLayerHeader.Read (file,swap) == DBFault) return (DBFault);
				if (strlen (dmLayerHeader.Description ()) > 0) layerName = dmLayerHeader.Description ();
				else { sprintf (layerNameSTR,"GHAASLayer%4d",layer + 1); layerName = layerNameSTR; }
				layerTable->Add (layerName);
				if ((layerRec = layerTable->Item ()) == (DBObjRecord *) NULL) return (DBFault);
				rowNumFLD->Int (layerRec,RowNum ());
				colNumFLD->Int (layerRec,ColNum ());
				cellWidthFLD->Float (layerRec,CellWidth ());
				cellHeightFLD->Float (layerRec,CellHeight ());
				valueTypeFLD->Int (layerRec,((DBInt) DBTypeGridDiscrete) == data->Type () ? DBTableFieldInt : valueType);
				valueSizeFLD->Int (layerRec,valueSize);
				if ((dataRec = new DBObjRecord (layerName,((size_t) ColNum ()) * RowNum () * valueSize,valueSize)) == (DBObjRecord *) NULL)
					return (DBFault);
				(data->Arrays ())->Add (dataRec);
				layerFLD->Record (layerRec,dataRec);
				}
			if (fread (&docLength,sizeof (int),1,file) != 1)
				{ CMmsgPrint (CMmsgSysError, "File Reading Error in: %s %d",__FILE__,__LINE__); return (DBFault); }
			if (swap) DBByteOrderSwapWord (&docLength);
			if (docLength > 0)
				{
				char *docString;
				if ((docString = (char *) calloc (docLength,sizeof (char))) == (char *) NULL)
					{ CMmsgPrint (CMmsgSysError, "Memory Allocation Error in: %s %d",__FILE__,__LINE__); return (DBFault); }
				if (fread (docString,docLength,1,file) != 1)
					{ CMmsgPrint (CMmsgSysError, "File Reading Error in: %s %d",__FILE__,__LINE__); return (DBFault); }
				data->Document (DBDocComment,docString);
				free (docString);
				}
			for (dataRec = (data->Arrays ())->First ();dataRec != (DBObjRecord *) NULL;dataRec = (data->Arrays ())->Next ())
				if (fread (dataRec->Data (),ColNum () * valueSize * RowNum (),1,file) != 1)
					{ CMmsgPrint (CMmsgSysError, "File Reading Error in: %s %d",__FILE__,__LINE__); return (DBFault); }
			if (swap && valueSize > 1)
				{
				int i;
				void (*swapFunc) (void *);
				switch (valueSize)
					{
					case 2: swapFunc = DBByteOrderSwapHalfWord; break;
					case 4: swapFunc = DBByteOrderSwapWord; break;
					case 8: swapFunc = DBByteOrderSwapLongWord; break;
					default: CMmsgPrint (CMmsgAppError, "Wrong Data Value Size in: %s %d",__FILE__,__LINE__); return (DBFault);
					}
				for (dataRec = (data->Arrays ())->First ();dataRec != (DBObjRecord *) NULL;dataRec = (data->Arrays ())->Next ())
					for (i = 0;i < ColNum () * RowNum ();++i) (*swapFunc) ((char *) dataRec->Data () + i * valueSize);
				}
			switch (data->Type ())
				{
				case DBTypeGridDiscrete:
					{
					DBInt value;
					char nameStr [DBStringLength];
					DBObjRecord *symRec = (data->Table (DBrNSymbols))->Add ("Default Symbol");
					DBObjRecord *itemRec;
					DBObjTableField *gridValueFLD  = itemTable->Field (DBrNGridValue);
					DBObjTableField *gridSymbolFLD = itemTable->Field (DBrNSymbol);
					DBObjTableField *symbolIDFLD	 = (data->Table (DBrNSymbols))->Field (DBrNSymbolID);
					DBObjTableField *foregroundFLD = (data->Table (DBrNSymbols))->Field (DBrNForeground);
					DBObjTableField *backgroundFLD = (data->Table (DBrNSymbols))->Field (DBrNBackground);
					DBObjTableField *styleFLD = (data->Table (DBrNSymbols))->Field (DBrNStyle);

					symbolIDFLD->Int (symRec,0);
					foregroundFLD->Int (symRec,1);
					backgroundFLD->Int (symRec,0);
					styleFLD->Int (symRec,0);
					for (dataRec = (data->Arrays ())->First ();dataRec != (DBObjRecord *) NULL;dataRec = (data->Arrays ())->Next ())
						{
						for (i = 0;i < ColNum () * RowNum ();++i)
							{
//.........这里部分代码省略.........
开发者ID:rjs80,项目名称:RGIS,代码行数:101,代码来源:DBImpExpDMGrd.C

示例12: 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,
//.........这里部分代码省略.........
开发者ID:bandi13,项目名称:RGIS,代码行数:101,代码来源:RGISAnGNUXYPlot.C

示例13: main

int main(int argc, char *argv[]) {
    int argPos, argNum = argc, ret, idleMode, verbose = false;
    char *tableName = (char *) NULL;
    DBInt recID;
    DBObjData *data;
    DBObjTable *table;
    DBObjRecord *record;

    for (argPos = 1; argPos < argNum;) {
        if (CMargTest (argv[argPos], "-a", "--table")) {
            if ((argNum = CMargShiftLeft(argPos, argv, argNum)) <= argPos) {
                CMmsgPrint(CMmsgUsrError, "Missing table name!");
                return (CMfailed);
            }
            tableName = argv[argPos];
            if ((argNum = CMargShiftLeft(argPos, argv, argNum)) <= argPos) break;
            continue;
        }
        if (CMargTest (argv[argPos], "-m", "--mode")) {
            int modeCodes[] = {true, false};
            const char *modes[] = {"set", "clear"};

            if ((argNum = CMargShiftLeft(argPos, argv, argNum)) <= argPos) {
                CMmsgPrint(CMmsgUsrError, "Missing selection mode!");
                return (CMfailed);
            }
            if ((idleMode = CMoptLookup(modes, argv[argPos], true)) == DBFault) {
                CMmsgPrint(CMmsgUsrError, "Invalid selection mode!");
                return (CMfailed);
            }
            idleMode = modeCodes[idleMode];
            if ((argNum = CMargShiftLeft(argPos, argv, argNum)) <= argPos) break;
            continue;
        }
        if (CMargTest (argv[argPos], "-V", "--verbose")) {
            verbose = true;
            if ((argNum = CMargShiftLeft(argPos, argv, argNum)) <= argPos) break;
            continue;
        }
        if (CMargTest (argv[argPos], "-h", "--help")) {
            CMmsgPrint(CMmsgInfo, "%s [options] <input file> <output file>", CMfileName(argv[0]));
            CMmsgPrint(CMmsgInfo, "     -a,--table     [table name]");
            CMmsgPrint(CMmsgInfo, "     -m,--mode      [set|clear]");
            CMmsgPrint(CMmsgInfo, "     -V,--verbose");
            CMmsgPrint(CMmsgInfo, "     -h,--help");
            return (DBSuccess);
        }
        if ((argv[argPos][0] == '-') && (strlen(argv[argPos]) > 1)) {
            CMmsgPrint(CMmsgUsrError, "Unknown option: %s!", argv[argPos]);
            return (CMfailed);
        }
        argPos++;
    }

    if (argNum > 3) {
        CMmsgPrint(CMmsgUsrError, "Extra arguments!");
        return (CMfailed);
    }
    if (verbose) RGlibPauseOpen(argv[0]);

    data = new DBObjData();
    if (((argNum > 1) && (strcmp(argv[1], "-") != 0) ? data->Read(argv[1]) : data->Read(stdin)) == DBFault) {
        delete data;
        return (CMfailed);
    }

    if (tableName == (char *) NULL) tableName = DBrNItems;

    if ((table = data->Table(tableName)) == (DBObjTable *) NULL) {
        CMmsgPrint(CMmsgUsrError, "Invalid table!");
        delete data;
        return (CMfailed);
    }

    if (idleMode)
        for (recID = 0; recID < table->ItemNum(); ++recID) {
            record = table->Item(recID);
            if ((record->Flags() & DBObjectFlagSelected) == DBObjectFlagSelected)
                record->Flags(DBObjectFlagIdle, DBSet);
            else
                record->Flags(DBObjectFlagIdle, DBClear);
        }
    else
        for (recID = 0; recID < table->ItemNum(); ++recID) {
            record = table->Item(recID);
            record->Flags(DBObjectFlagIdle, DBClear);
        }

    ret = (argNum > 2) && (strcmp(argv[2], "-") != 0) ? data->Write(argv[2]) : data->Write(stdout);

    delete data;
    if (verbose) RGlibPauseClose();
    return (ret);
}
开发者ID:bmfekete,项目名称:RGIS,代码行数:94,代码来源:CMDtblIdleRec.C

示例14: _RGISToolsNetBasinMouthCBK

static void _RGISToolsNetBasinMouthCBK (Widget widget,RGISWorkspace *workspace,XmAnyCallbackStruct *callData)

	{
	DBDataset *dataset = UIDataset ();
	DBObjData *netData = dataset->Data (), *pntData;
	DBNetworkIF *netIF;

	widget = widget; callData = callData;

	if (netData == (DBObjData *) NULL)
		{ CMmsgPrint (CMmsgAppError, "Null Data in: %s %d",__FILE__,__LINE__); return; }
	netIF = new DBNetworkIF (netData);

	if (UIDataHeaderForm (pntData = new DBObjData ("",DBTypeVectorPoint)))
		{
		char symName [DBStringLength];
		DBInt basinID, order;
		DBCoordinate coord;
		DBObjTable *items 	= pntData->Table (DBrNItems);
		DBObjTable *symbols	= pntData->Table (DBrNSymbols);
		DBObjTableField *coordField = items->Field (DBrNCoord);
		DBObjTableField *symbolFLD	 = items->Field (DBrNSymbol);
		DBObjTableField *orderFLD 	= new DBObjTableField (DBrNOrder,DBTableFieldInt,"%3d",sizeof (DBByte));
		DBObjTableField *subbasinLengthFLD = new DBObjTableField (DBrNSubbasinLength,DBTableFieldFloat,"%10.1f",sizeof (float));
		DBObjTableField *subbasinAreaFLD = new DBObjTableField (DBrNSubbasinArea,DBTableFieldFloat,"%10.1f",sizeof (float));
		DBObjTableField *foregroundFLD = symbols->Field (DBrNForeground);
		DBObjTableField *backgroundFLD = symbols->Field (DBrNBackground);
		DBObjTableField *styleFLD = symbols->Field (DBrNStyle);
		DBObjRecord *pntRec, *symRec, *cellRec, *basinRec;
		DBRegion dataExtent;

		items->AddField (orderFLD);
		items->AddField (subbasinLengthFLD);
		items->AddField (subbasinAreaFLD);

		cellRec = netIF->Cell ((DBInt) 0);
		for (order = 0;order <= netIF->CellOrder (cellRec);++order)
			{
			sprintf (symName,"Strahler Order:%2d",order);
			symRec = symbols->Add (symName);
			styleFLD->Int (symRec,0);
			foregroundFLD->Int (symRec,1);
			backgroundFLD->Int (symRec,0);
			}

		UIPauseDialogOpen ((char *) "Creating Basin Mouth");
		for (basinID = 0;basinID < netIF->BasinNum ();++basinID)
			{
			basinRec = netIF->Basin (basinID);
			if (UIPause (basinID * 100 / netIF->BasinNum ())) goto Stop;

			symRec = symbols->Item (netIF->CellOrder (cellRec));
			cellRec = netIF->MouthCell (basinRec);
			pntRec = items->Add (basinRec->Name ());
			coord = netIF->Center (cellRec);
			coordField->Coordinate (pntRec,coord);
			symbolFLD->Record (pntRec,symRec);
			orderFLD->Int (pntRec,netIF->CellOrder (cellRec));
			subbasinLengthFLD->Float (pntRec,netIF->CellBasinLength (cellRec));
			subbasinAreaFLD->Float (pntRec,netIF->CellBasinArea (cellRec));
			dataExtent.Expand (coord);
			}
Stop:
		UIPauseDialogClose ();
		pntData->Extent (dataExtent);
		workspace->CurrentData  (pntData);
		}
	else	delete pntData;
	delete netIF;
	}
开发者ID:rjs80,项目名称:RGIS,代码行数:70,代码来源:RGISTools.C

示例15: 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;
//.........这里部分代码省略.........
开发者ID:bmfekete,项目名称:RGIS,代码行数:101,代码来源:RGlibPoint.C


注:本文中的DBObjTable::Item方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。