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


C++ DBObjectLIST类代码示例

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


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

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

示例2: BuildFields

int DBObjData::BuildFields() {
    DBInt ret = DBSuccess;
    DBObjTable *table, *refTable;
    DBObjRecord *tableRec;
    DBObjTableField *field;
    DBObjectLIST<DBObjTableField> *tableFLDs;

    for (table = TablesPTR->First(); table != (DBObjTable *) NULL; table = TablesPTR->Next()) {
        tableFLDs = table->Fields();
        for (field = tableFLDs->First(); field != (DBObjTableField *) NULL; field = tableFLDs->Next())
            switch (field->Type()) {
                case DBTableFieldTableRec:
                    if ((refTable = TablesPTR->Item(field->RecordProp())) == (DBObjTable *) NULL) {
                        CMmsgPrint(CMmsgAppError, "Corrupt Dataset in: %s %d", __FILE__, __LINE__);
                        ret = DBFault;
                        continue;
                    }
                    for (tableRec = table->First(); tableRec != (DBObjRecord *) NULL; tableRec = table->Next())
                        if ((DBInt) (field->Record(tableRec) - (DBObjRecord *) NULL) != DBFault)
                            field->Record(tableRec,
                                          refTable->Item((DBInt) ((char *) (field->Record(tableRec)) - (char *) NULL)));
                        else field->Record(tableRec, (DBObjRecord *) NULL);
                    break;
                case DBTableFieldDataRec:
                    for (tableRec = table->First(); tableRec != (DBObjRecord *) NULL; tableRec = table->Next())
                        if ((DBInt) (field->Record(tableRec) - (DBObjRecord *) NULL) != DBFault)
                            field->Record(tableRec, ArraysPTR->Item(
                                    (DBInt) ((char *) (field->Record(tableRec)) - (char *) NULL)));
                        else field->Record(tableRec, (DBObjRecord *) NULL);
                    break;
            }
    }
    return (ret);
}
开发者ID:,项目名称:,代码行数:34,代码来源:

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

示例4: main

int main(int argc, char *argv[]) {
    int i, verbose = false;
    char *ghaasMetaDB = (char *) NULL, metaFileName[DBDataFileNameLen];
    DBObjData *dbData;
    DBDataset *dbDataset;
    DBObjectLIST<DBObjMetaEntry> *metaList;
    DBObjMetaEntry *metaEntry;

    if (argc < 2) {
        Usage(argv[0]);
        return (0);
    }

    for (i = 1; i < argc; ++i) {
        if ((strcmp(argv[i], "-h") == 0) || (strcmp(argv[i], "--help") == 0)) {
            Usage(argv[0]);
            return (0);
        }
        else if ((strcmp(argv[i], "-V") == 0) || (strcmp(argv[i], "--verbose") == 0)) verbose = true;
        else if (((strcmp(argv[i], "-m") == 0) || (strcmp(argv[i], "--MetaDB") == 0)) && (argc > i + 1)) {
            if (++i < argc) {
                ghaasMetaDB = argv[i];
                break;
            } else {
                Usage(argv[0]);
                return (0);
            }
        }
    }
    if (i == argc) i = 0;
    if (verbose) RGlibPauseOpen(argv[0]);

    if (ghaasMetaDB == (char *) NULL) {
        sprintf(metaFileName, "%s/GHAASMetadb", getenv("GHAAS_DIR") == NULL ? getenv("HOME") : getenv("GHAAS_DIR"));
        ghaasMetaDB = metaFileName;
    }
    dbDataset = new DBDataset((char *) "GHAASmetadb", ghaasMetaDB);
    metaList = dbDataset->MetaList();

    for (; i < argc - 1; ++i) {
        dbData = new DBObjData();
        if (dbData->Read(argv[i + 1]) == DBSuccess) {
            dbData->FileName(argv[i + 1]);
            dbDataset->Data(dbData);
            printf("%s\n", dbData->Name());
            metaEntry = metaList->Item(dbData->Name());
            metaEntry->FileName(dbData->FileName());
            dbDataset->RemoveData(dbData);
        }
        delete dbData;
    }
    delete dbDataset;
    if (verbose) RGlibPauseClose();
    return (0);
}
开发者ID:,项目名称:,代码行数:55,代码来源:

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

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

示例7: Data

void DBVLineIF::Vertexes (DBObjRecord *lineRec,DBCoordinate *coord,DBInt vertexNum)

	{
	DBInt vertex;
	DBFloat length = 0;
	DBCoordinate *vertexes, prevCoord;
	DBObjRecord *dataRec = (DBObjRecord *) NULL;
	DBObjectLIST<DBObjRecord> *dataArrays = Data ()->Arrays ();
	DBRegion lineExtent, dataExtent = Data ()->Extent ();
	DBMathDistanceFunction distFunc = DBMathGetDistanceFunction (Data ());

	prevCoord = NodeCoordFLD->Coordinate (FromNodeFLD->Record (lineRec));
	lineExtent.Expand (prevCoord);
	if (vertexNum > 0)
		{
		if ((dataRec = dataArrays->Item (lineRec->RowID ())) == (DBObjRecord *) NULL)
			{
			if ((dataRec = new DBObjRecord (lineRec->Name (),((size_t) vertexNum) * sizeof (DBCoordinate),sizeof (DBFloat))) == (DBObjRecord *) NULL) return;
			dataArrays->Add (dataRec);
			}
		else	dataRec->Realloc (vertexNum * sizeof (DBCoordinate));
		if ((vertexes = (DBCoordinate *) dataRec->Data ()) == NULL)
			{ CMmsgPrint (CMmsgSysError, "Memory Allocation Error in: %s %d",__FILE__,__LINE__); return; }
		for (vertex = 0;vertex < vertexNum;vertex++)
			{
			lineExtent.Expand (vertexes [vertex] = coord [vertex]);
			length += DBMathCoordinateDistance (distFunc,prevCoord,coord [vertex]);
			prevCoord = coord [vertex];
			}
		}
	VertexesFLD->Record (lineRec,dataRec);
	VertexNumFLD->Int (lineRec,vertexNum);
	length += DBMathCoordinateDistance (distFunc,prevCoord,NodeCoordFLD->Coordinate (ToNodeFLD->Record (lineRec)));
	PerimeterFLD->Float (lineRec,length);
	lineExtent.Expand (NodeCoordFLD->Coordinate (ToNodeFLD->Record (lineRec)));
	ExtentFLD->Region (lineRec,lineExtent);
	dataExtent.Expand (lineExtent);
	Data ()->Extent (dataExtent);
	}
开发者ID:bandi13,项目名称:RGIS,代码行数:39,代码来源:DBVLineMisc.C

示例8: _RGISGrpPanelDeleteCBK

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

	{
	DBDataset *dataset = UIDataset ();
	DBObjData *dbData  = dataset->Data ();
	DBObjTable *groupTable = dbData->Table (DBrNGroups);
	DBObjTableField *group = grpPanel->Current ();
	static Widget fieldSelect = (Widget) NULL;

	if (fieldSelect == (Widget) NULL) fieldSelect = UISelectionCreate ((char *) "Group Selection");

	if ((groupTable == (DBObjTable *) NULL) || (group == (DBObjTableField *) NULL)) return;
	if (groupTable->FieldNum () == 1) grpPanel->Groups ((DBObjectLIST<DBObjTableField> *) NULL);
	grpPanel->Remove (group);
	groupTable->DeleteField (group);
	if (groupTable->FieldNum () == 0)
		{
		DBObjectLIST<DBObjTable> *tables  = dbData->Tables ();
		tables->Remove (groupTable);
		delete groupTable;
		}
	}
开发者ID:gyelnats,项目名称:RGIS,代码行数:22,代码来源:RGISPanels.C

示例9: RGISAnalyseLineMSampleGridCBK

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

	{
	DBInt layerID, layerNum;
	DBCoordinate coord;
	DBFloat realValue;
	DBDataset *dataset  = UIDataset ();
	DBObjData *dbData  = dataset->Data ();
	DBObjData *grdData  = dbData->LinkedData ();
	DBObjData *tblData;
	DBObjTable *table, *itemTable = dbData->Table (DBrNItems);
	DBObjTableField *lineIDFLD;
	DBObjTableField *layerIDFLD;
	DBObjTableField *layerNameFLD;
	DBObjTableField *fromValueFLD = (DBObjTableField *) NULL;
	DBObjTableField *toValueFLD = (DBObjTableField *) NULL;
	DBVLineIF	*lineIF = (DBVLineIF *)	 NULL;
	DBGridIF *gridIF;
	DBObjRecord *record, *layerRec, *tblRec;
	DBObjectLIST<DBObjTableField> *fields;

	widget = widget; callData = callData;

	gridIF = new DBGridIF (grdData);
	for (layerID = 0;layerID < gridIF->LayerNum ();++layerID)
		{
		layerRec = gridIF->Layer (layerID);
		if ((layerRec->Flags () & DBObjectFlagIdle) != DBObjectFlagIdle) ++layerNum;
		}
	if (layerNum < 1)
		{ CMmsgPrint (CMmsgAppError, "No Layer to Process in: %s %d",__FILE__,__LINE__); delete gridIF; return; }


	tblData  = new DBObjData ("",DBTypeTable);
	tblData->Document (DBDocGeoDomain,dbData->Document (DBDocGeoDomain));
	tblData->Document (DBDocSubject,grdData->Document (DBDocSubject));

	if (UIDataHeaderForm (tblData) == false) { delete gridIF; delete tblData; return; }
	table = tblData->Table (DBrNItems);

	lineIF = new DBVLineIF (dbData);

	table->AddField (lineIDFLD =		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 (fromValueFLD =	new DBObjTableField (RGISLineFromNodeValue,DBTableFieldFloat,gridIF->ValueFormat (),sizeof (DBFloat4)));
	table->AddField (toValueFLD =		new DBObjTableField (RGISLineToNodeValue,DBTableFieldFloat,gridIF->ValueFormat (),sizeof (DBFloat4)));

	grdData->Flags (DBObjectFlagProcessed,DBSet);
	UIPauseDialogOpen ((char *) "Sampling Grid(s)");
	for (layerID = 0;layerID < gridIF->LayerNum ();++layerID)
		{
		layerRec = gridIF->Layer (layerID);
		if ((layerRec->Flags () & DBObjectFlagIdle) == DBObjectFlagIdle) continue;
		for (record = itemTable->First ();record != (DBObjRecord *) NULL;record = itemTable->Next ())
			{
			if (UIPause ((layerRec->RowID () * itemTable->ItemNum () + record->RowID ()) * 100 / (itemTable->ItemNum () * gridIF->LayerNum ()))) goto Stop;
			if ((record->Flags () & DBObjectFlagIdle) == DBObjectFlagIdle) continue;
			tblRec = table->Add (record->Name ());
			lineIDFLD->Int (tblRec,record->RowID () + 1);
			layerIDFLD->Int (tblRec,layerRec->RowID ());
			layerNameFLD->String (tblRec,layerRec->Name ());
			coord = lineIF->FromCoord (record);
			if (gridIF->Value (layerRec,coord,&realValue))
				fromValueFLD->Float (tblRec,realValue);
			coord = lineIF->ToCoord (record);
			if (gridIF->Value (layerRec,coord,&realValue))
				toValueFLD->Float (tblRec,realValue);
			}
		}
Stop:
	UIPauseDialogClose ();
	delete gridIF;
	delete lineIF;

	fields = new DBObjectLIST<DBObjTableField> ("Field List");
	fields->Add (new DBObjTableField (*lineIDFLD));
	fields->Add (new DBObjTableField (*layerIDFLD));
	table->ListSort (fields);
	workspace->CurrentData  (tblData);
	delete fields;
	}
开发者ID:amiara,项目名称:RGIS,代码行数:82,代码来源:RGISAnLine.C

示例10: DBPointToGrid

DBInt DBPointToGrid(DBObjData *pntData, DBObjData *netData, DBObjData *grdData) {
    DBInt i;
    DBPosition pos;
    DBObjTable *pntTable = pntData->Table(DBrNItems);
    DBObjTable *grdTable = grdData->Table(DBrNItems);
    DBObjTable *symTable = grdData->Table(DBrNSymbols);
    DBObjectLIST<DBObjTableField> *pntFields = pntTable->Fields();
    DBObjTableField *pntFLD;
    DBObjTableField *grdAttribFLD;
    DBObjTableField *grdFLD = grdTable->Field(DBrNGridValue);
    DBObjTableField *symFLD = grdTable->Field(DBrNSymbol);
    DBObjRecord *cellRec, *toCell, *pntRec, *itemRec;
    DBObjRecord *symRec = symTable->First();
    DBVPointIF *pntIF;
    DBNetworkIF *netIF;
    DBGridIF *grdIF;

    pntIF = new DBVPointIF(pntData);
    netIF = new DBNetworkIF(netData);
    grdIF = new DBGridIF(grdData);

    grdIF->RenameLayer(grdIF->Layer((DBInt) 0), (char *) "Subbasins");

    for (pos.Row = 0; pos.Row < grdIF->RowNum(); ++pos.Row)
        for (pos.Col = 0; pos.Col < grdIF->ColNum(); ++pos.Col) grdIF->Value(pos, DBFault);

    for (pntFLD = pntFields->First(); pntFLD != (DBObjTableField *) NULL; pntFLD = pntFields->Next())
        if (DBTableFieldIsVisible(pntFLD)) grdTable->AddField(new DBObjTableField(*pntFLD));

    for (i = 0; i < pntIF->ItemNum(); ++i) {
        DBPause(i * 100 / pntIF->ItemNum());
        pntRec = pntIF->Item(i);
        if ((pntRec->Flags() & DBObjectFlagIdle) == DBObjectFlagIdle) continue;
        if ((cellRec = netIF->Cell(pntIF->Coordinate(pntRec))) == (DBObjRecord *) NULL) continue;

        itemRec = grdTable->Add(pntRec->Name());
        grdFLD->Int(itemRec, pntRec->RowID() + 1);
        symFLD->Record(itemRec, symRec);

        for (pntFLD = pntFields->First(); pntFLD != (DBObjTableField *) NULL; pntFLD = pntFields->Next())
            if ((grdAttribFLD = grdTable->Field(pntFLD->Name())) != (DBObjTableField *) NULL)
                switch (pntFLD->Type()) {
                    case DBTableFieldString:
                        grdAttribFLD->String(itemRec, pntFLD->String(pntRec));
                        break;
                    case DBTableFieldInt:
                        grdAttribFLD->Int(itemRec, pntFLD->Int(pntRec));
                        break;
                    case DBTableFieldFloat:
                        grdAttribFLD->Float(itemRec, pntFLD->Float(pntRec));
                        break;
                    case DBTableFieldDate:
                        grdAttribFLD->Date(itemRec, pntFLD->Date(pntRec));
                        break;
                }
        grdIF->Value(netIF->CellPosition(cellRec), itemRec->RowID());
    }

    for (i = 0; i < netIF->CellNum(); ++i) {
        if ((cellRec = netIF->Cell(i)) == (DBObjRecord *) NULL) continue;
        if ((itemRec = grdIF->GridItem(netIF->CellPosition(cellRec))) != (DBObjRecord *) NULL) continue;
        if ((toCell = netIF->ToCell(cellRec)) == (DBObjRecord *) NULL) continue;
        if ((itemRec = grdIF->GridItem(netIF->CellPosition(toCell))) != (DBObjRecord *) NULL)
            grdIF->Value(netIF->CellPosition(cellRec), itemRec->RowID());
    }
    grdIF->DiscreteStats();
    delete pntIF;
    delete netIF;
    delete grdIF;
    return (DBSuccess);
}
开发者ID:,项目名称:,代码行数:71,代码来源:

示例11: RGlibPointSubbasinStats

DBInt RGlibPointSubbasinStats(DBObjData *pntData, DBObjData *netData, DBObjData *grdData, DBObjData *tblData) {
    DBInt layerID, layerNum = 0, progress = 0, maxProgress;
    DBObjTable *table;
    DBObjTableField *pointIDFLD;
    DBObjTableField *layerIDFLD;
    DBObjTableField *layerNameFLD;
    DBObjTableField *minimumFLD;
    DBObjTableField *maximumFLD;
    DBObjTableField *averageFLD;
    DBObjTableField *stdDevFLD;
    DBObjTableField *areaFLD;
    DBVPointIF *pntIF;
    DBNetworkIF *netIF;
    DBObjRecord *pntRec, *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);
    }

    table = tblData->Table(DBrNItems);
    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(averageFLD = new DBObjTableField(RGlibPointMean, DBTableFieldFloat, _RGlibPointGrdIF->ValueFormat(),
                                                     sizeof(DBFloat4)));
    table->AddField(minimumFLD = new DBObjTableField(RGlibPointMin, DBTableFieldFloat, _RGlibPointGrdIF->ValueFormat(),
                                                     sizeof(DBFloat4)));
    table->AddField(maximumFLD = new DBObjTableField(RGlibPointMax, DBTableFieldFloat, _RGlibPointGrdIF->ValueFormat(),
                                                     sizeof(DBFloat4)));
    table->AddField(
            stdDevFLD = new DBObjTableField(RGlibPointStdDev, DBTableFieldFloat, _RGlibPointGrdIF->ValueFormat(),
                                            sizeof(DBFloat4)));
    table->AddField(areaFLD = new DBObjTableField(RGlibPointArea, DBTableFieldFloat, _RGlibPointGrdIF->ValueFormat(),
                                                  sizeof(DBFloat4)));

    grdData->Flags(DBObjectFlagProcessed, DBSet);
    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;
            tblRec = table->Add(pntRec->Name());
            pointIDFLD->Int(tblRec, pntRec->RowID() + 1);
            layerIDFLD->Int(tblRec, _RGlibPointGrdLayerRec->RowID());
            layerNameFLD->String(tblRec, _RGlibPointGrdLayerRec->Name());
            _RGlibSubbasinArea = 0.0;
            _RGlibSubbasinMin = DBHugeVal;
            _RGlibSubbasinMax = -DBHugeVal;
            _RGlibSubbasinMean = 0.0;
            _RGlibSubbasinStdDev = 0.0;
            netIF->UpStreamSearch(netIF->Cell(pntIF->Coordinate(pntRec)), (DBNetworkACTION) _RGlibSubbasinStatistics);
            _RGlibSubbasinMean = _RGlibSubbasinMean / _RGlibSubbasinArea;
            _RGlibSubbasinStdDev = _RGlibSubbasinStdDev / _RGlibSubbasinArea;
            _RGlibSubbasinStdDev = _RGlibSubbasinStdDev - _RGlibSubbasinMean * _RGlibSubbasinMean;
            _RGlibSubbasinStdDev = sqrt(_RGlibSubbasinStdDev);
            minimumFLD->Float(tblRec, _RGlibSubbasinMin);
            maximumFLD->Float(tblRec, _RGlibSubbasinMax);
            averageFLD->Float(tblRec, _RGlibSubbasinMean);
            stdDevFLD->Float(tblRec, _RGlibSubbasinStdDev);
            areaFLD->Float(tblRec, _RGlibSubbasinArea);
        }
    }
    Stop:
    delete _RGlibPointGrdIF;
    delete netIF;
    delete pntIF;

    if (progress == maxProgress) {
        fields = new DBObjectLIST<DBObjTableField>("Field List");
        fields->Add(new DBObjTableField(*pointIDFLD));
        fields->Add(new DBObjTableField(*layerIDFLD));
        table->ListSort(fields);
        delete fields;
        return (DBSuccess);
    }
    return (DBFault);
}
开发者ID:bmfekete,项目名称:RGIS,代码行数:91,代码来源:RGlibPoint.C

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

示例13: 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

示例14: main

int main (int argc,char **argv)

	{
	int argPos, argNum = argc;
	char *metaDB = (char *) NULL;
	int spin = true, progress = true;
	const char *modes [] = { (char *) "yes", (char *) "no", NULL };
	int codes [] = { true, false };
	Widget mainForm;
	RGISWorkspace *workspace;

	for (argPos = 1;argPos < argNum; )
		{
		if (CMargTest (argv [argPos],"-m","--metadb"))
			{
			if ((argNum = CMargShiftLeft (argPos,argv,argc)) <= argPos)
				{ CMmsgPrint (CMmsgUsrError, "Missing metadb argument!"); return (CMfailed); }
			metaDB = argv [argPos];
			if ((argNum = CMargShiftLeft (argPos,argv,argc)) <= argPos) break;
			continue;
			}
		if (CMargTest (argv [argPos],"-p","--progress"))
			{
			if ((argNum = CMargShiftLeft (argPos,argv,argc)) <= argPos)
				{ CMmsgPrint (CMmsgUsrError,"Missing progress mode!");   return (CMfailed); }
			if ((progress = CMoptLookup (modes,argv [argPos],true)) == DBFault)
				{ CMmsgPrint (CMmsgUsrError,"Invalid progress mode!");   return (CMfailed); }
			progress = codes [progress];
			if ((argNum = CMargShiftLeft (argPos,argv,argc)) <= argPos) break;
			continue;
			}
		if (CMargTest (argv [argPos],"-s","--spin"))
			{
			if ((argNum = CMargShiftLeft (argPos,argv,argc)) <= argPos)
				{ CMmsgPrint (CMmsgUsrError,"Missing spin mode!");       return (CMfailed); }
			if ((spin = CMoptLookup (modes,argv [argPos],true)) == DBFault)
				{ CMmsgPrint (CMmsgUsrError,"Invalid spin mode!");	     return (CMfailed); }
			spin = codes [spin];
			if ((argNum = CMargShiftLeft (argPos,argv,argc)) <= argPos) break;
			continue;
			}
		if (CMargTest (argv [argPos],"-P","--planet"))
			{
			int planet;
			const char *planets [] = { "Earth", "Mars", "Venus", NULL };
			DBFloat radius [] = { 6371.2213, 6371.2213 * 0.53264, 6371.2213 * 0.94886 };

			if ((argNum = CMargShiftLeft (argPos,argv,argc)) <= argPos)
				{ CMmsgPrint (CMmsgUsrError,"Missing planet!");	       return (CMfailed); }
			if ((planet = CMoptLookup (planets,argv [argPos],true)) == DBFault)
				{
				if (sscanf (argv [argPos],"%lf",radius) != 1)
					{ CMmsgPrint (CMmsgUsrError,"Invalid planet!");      return (CMfailed); }
				planet = 0;
				}
			DBMathSetGlobeRadius (radius [planet]);
			if ((argNum = CMargShiftLeft (argPos,argv,argc)) <= argPos) break;
			continue;
			}
		if (CMargTest (argv [argPos],"-h","--help"))
			{
			CMmsgPrint (CMmsgInfo, "rgis [options]");
			CMmsgPrint (CMmsgInfo, "     -m, --metadb   [meta database]");
			CMmsgPrint (CMmsgInfo, "     -p, --progress [yes|no]");
			CMmsgPrint (CMmsgInfo, "     -s, --spin     [yes|no]");
			CMmsgPrint (CMmsgInfo, "     -P, --planet   [Earth|Mars|Venus|radius]");
			CMmsgPrint (CMmsgInfo, "     -h, --help");
			return (DBSuccess);
			}
		if ((argv [argPos][0] == '-') && (strlen (argv [argPos]) > 1))
			{ CMmsgPrint (CMmsgUsrError, "Unknown option: %s!",argv [argPos]); return (DBFault); }
		argPos++;
		}

	workspace = new RGISWorkspace;
	mainForm = UIInitialize ((char *) "GHAAS V2.2 - RiverGIS",(char *) "GHAASrgis",(char *) "RGISMain.html",
									 RGISMainMenu,(void *) workspace,&argc,argv,720,500,(bool) spin,(bool) progress);

	UIDataset ((char *) "GHAASrgis",metaDB);

	XtVaSetValues (mainForm,XmNkeyboardFocusPolicy,		XmPOINTER, NULL);

	workspace->Initialize (mainForm);

	if (argNum > 1)
		{
		DBDataset *dataset;
		DBObjData *data;
		DBObjectLIST<DBObjMetaEntry> *metaList;
		DBObjMetaEntry *metaEntry;

		dataset  = UIDataset ();
		metaList = dataset->MetaList ();

		for (argPos = 1;argPos < argNum; ++argPos)
			{
			data = new DBObjData ();
			if (data->Read (argv [argPos]) == DBSuccess)
				{
				workspace->CurrentData (data);
//.........这里部分代码省略.........
开发者ID:bmfekete,项目名称:RGIS,代码行数:101,代码来源:RGISMain.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


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