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


C++ DBNetworkIF::Build方法代码示例

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


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

示例1: RGISEditNetBuildCBK

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

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

	UIPauseDialogOpen ((char *) "Building Topological Networks");
	netIF->Build ();
	UIPauseDialogClose ();

	delete netIF;
	}
开发者ID:bandi13,项目名称:RGIS,代码行数:13,代码来源:RGISEditNet.C

示例2: main

int main (int argc,char *argv [])

	{
	int argPos, argNum = argc, ret, verbose = false;
	char *title      = (char *) NULL, *subject = (char *) NULL;
	char *domain     = (char *) NULL, *version = (char *) NULL;
	DBObjData *netData;
   DBNetworkIF *netIF;

	for (argPos = 1;argPos < argNum; )
		{
		if (CMargTest (argv [argPos],"-t","--title"))
			{
			if ((argNum = CMargShiftLeft (argPos,argv,argNum)) <= argPos)
				{ CMmsgPrint (CMmsgUsrError,"Missing title!");        return (CMfailed); }
			title = argv [argPos];
			if ((argNum = CMargShiftLeft (argPos,argv,argNum)) <= argPos) break;
			continue;
			}
		if (CMargTest (argv [argPos],"-u","--subject"))
			{
			if ((argNum = CMargShiftLeft (argPos,argv,argNum)) <= argPos)
				{ CMmsgPrint (CMmsgUsrError,"Missing subject!");      return (CMfailed); }
			subject = argv [argPos];
			if ((argNum = CMargShiftLeft (argPos,argv,argNum)) <= argPos) break;
			continue;
			}
		if (CMargTest (argv [argPos],"-d","--domain"))
			{
			if ((argNum = CMargShiftLeft (argPos,argv,argNum)) <= argPos)
				{ CMmsgPrint (CMmsgUsrError,"Missing domain!");       return (CMfailed); }
			domain  = argv [argPos];
			if ((argNum = CMargShiftLeft (argPos,argv,argNum)) <= argPos) break;
			continue;
			}
		if (CMargTest (argv [argPos],"-v","--version"))
			{
			if ((argNum = CMargShiftLeft (argPos,argv,argNum)) <= argPos)
				{ CMmsgPrint (CMmsgUsrError,"Missing version!");      return (CMfailed); }
			version  = argv [argPos];
			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 network> <output network>",CMfileName(argv[0]));
			CMmsgPrint (CMmsgInfo,"     -t,--title       [dataset title]");
			CMmsgPrint (CMmsgInfo,"     -u,--subject     [subject]");
			CMmsgPrint (CMmsgInfo,"     -d,--domain      [domain]");
			CMmsgPrint (CMmsgInfo,"     -v,--version     [version]");
			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]);

	netData = new DBObjData ();

	ret = (argNum > 1) && (strcmp (argv [1],"-") != 0) ? netData->Read (argv [1]) : netData->Read (stdin);
	if (netData->Type () != DBTypeNetwork)
		{
      CMmsgPrint (CMmsgUsrError,"Not a network input!");
      delete netData;
      return (CMfailed);
      }
   if (title	!= (char *) NULL) netData->Name (title);
	if (subject != (char *) NULL) netData->Document (DBDocSubject,   subject);
	if (domain	!= (char *) NULL) netData->Document (DBDocGeoDomain, domain);
   if (version != (char *) NULL) netData->Document (DBDocVersion,   version);
   
   netIF = new DBNetworkIF (netData);   
   ret = netIF->Build ();
   delete netIF;

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

	delete netData;
	if (verbose) RGlibPauseClose ();
	return (ret);
	}
开发者ID:rjs80,项目名称:RGIS,代码行数:93,代码来源:CMDnetBuild.C

示例3: DBGridCont2Network


//.........这里部分代码省略.........
						if (((0x01 << dir) == DBNetDirNE) || ((0x01 << dir) == DBNetDirE) || ((0x01 << dir) == DBNetDirSE)) col++;
						if (((0x01 << dir) == DBNetDirNW) || ((0x01 << dir) == DBNetDirW) || ((0x01 << dir) == DBNetDirSW)) col--;
						if (row < 0) continue;
						if (col < 0) continue;
						if (row >= gridIF->RowNum ()) continue;
						if (col >= gridIF->ColNum ()) continue;
						auxPos.Row = row;
						auxPos.Col = col;
						gridIF->Pos2Coord (auxPos,coord1);
						switch (zGridData->Type ())
							{
							case DBTypeGridDiscrete:	basinID = zGridIF->GridValue (layerRec,coord1);	break;
							case DBTypeGridContinuous:	zGridIF->Value (layerRec,coord1,&basinID);		break;
							}
						zones [zLayerID * 9 + dir] = basinID;
						}
					switch (zGridData->Type ())
						{
						case DBTypeGridDiscrete:	basinID = zGridIF->GridValue (layerRec,coord0);	break;
						case DBTypeGridContinuous: zGridIF->Value (layerRec,coord0,&basinID);		break;
						}
					zones [zLayerID * 9 + 8] = basinID;
					}
			for (dir = 0;dir < 9;++dir) zones [zLayerID * 9 + dir] = 0;

			maxDir = DBFault;
			for (layerID = 0;layerID < gridIF->LayerNum ();++layerID)
				{
				layerRec = gridIF->Layer (layerID);
				if ((layerRec->Flags () & DBObjectFlagIdle) == DBObjectFlagIdle) continue;
				if (gridIF->Value (layerRec,pos,&elev0))
					{
					maxDelta = (DBFloat) 0.0;
					maxDir   = 0;

					for (zLayerID = 0;zLayerID < zLayerNum;++zLayerID)
						{
						for (dir = 0;dir < 8;++dir)
							{
							row = pos.Row;
							col = pos.Col;
							if (((0x01 << dir) == DBNetDirNW) || ((0x01 << dir) == DBNetDirN) || ((0x01 << dir) == DBNetDirNE)) row++;
							if (((0x01 << dir) == DBNetDirSE) || ((0x01 << dir) == DBNetDirS) || ((0x01 << dir) == DBNetDirSW)) row--;
							if (((0x01 << dir) == DBNetDirNE) || ((0x01 << dir) == DBNetDirE) || ((0x01 << dir) == DBNetDirSE)) col++;
							if (((0x01 << dir) == DBNetDirNW) || ((0x01 << dir) == DBNetDirW) || ((0x01 << dir) == DBNetDirSW)) col--;
							if (col < 0) continue;
							if (row < 0) continue;
							if (col >= gridIF->ColNum ()) continue;
							if (row >= gridIF->RowNum ()) continue;
							auxPos.Row = row;
							auxPos.Col = col;
							gridIF->Pos2Coord (auxPos,coord1);
							distance = DBMathCoordinateDistance (projection,coord0,coord1);
							if ((zones [zLayerID * 9 + dir] == zones [zLayerID * 9 + 8]) && (gridIF->Value (layerRec,auxPos,&elev1)))
								{
								delta = (downhill ? (elev1 - elev0) : (elev0 - elev1)) / distance;
								if (maxDelta > delta) { maxDelta = delta; maxDir = (0x01 << dir); }
								}
							}
						if (maxDir != 0) goto SlopeStop;
						}
					}
				}
SlopeStop:
			if (maxDir != DBFault)
				{
				sprintf (nameSTR,"GHAASCell:%d",cellTable->ItemNum ());
				cellRec = cellTable->Add (nameSTR);
				positionFLD->Position(cellRec,pos);
				toCellFLD->Int			(cellRec,(DBInt) maxDir);
				fromCellFLD->Int		(cellRec,(DBInt) 0);
				orderFLD->Int			(cellRec,(DBInt) 0);
				basinFLD->Int			(cellRec,(DBInt) 0);
				basinCellsFLD->Int	(cellRec,(DBInt) 0);
				travelFLD->Int			(cellRec,(DBInt) 0);
				upCellPosFLD->Position	(cellRec,pos);
				cellAreaFLD->Float	(cellRec,(DBFloat) 0.0);
				subbasinLengthFLD->Float(cellRec,(DBFloat) 0.0);
				subbasinAreaFLD->Float	(cellRec,(DBFloat) 0.0);
				((DBInt *) dataRec->Data ()) [pos.Row * gridIF->ColNum () + pos.Col] = cellRec->RowID ();
				}
			}
		}
PauseStop:
	if (pos.Row < gridIF->RowNum ())	return (DBFault);
	sprintf (nameSTR,"GHAASBasin%d",(DBInt) 0);
	basinRec = basinTable->Add (nameSTR);
	mouthPosFLD->Position	(basinRec,positionFLD->Position (cellTable->Item (0)));
	colorFLD->Int				(basinRec,0);

	free (zones);
	delete gridIF;
	if (zGridIF != (DBGridIF *) NULL) delete zGridIF;

	netData->Precision (DBMathMin (gridIF->CellWidth (),gridIF->CellHeight ()) / 25.0);
	netIF = new DBNetworkIF (netData);
	netIF->Build ();
	delete netIF;
	return (DBSuccess);
	}
开发者ID:amiara,项目名称:RGIS,代码行数:101,代码来源:DBGCont2Net.C

示例4: main


//.........这里部分代码省略.........
        }
        if ((argv[argPos][0] == '-') && ((int) 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]);

    if (expr != (char *) NULL) {
        operand = new DBMathOperand(expr);
        if (operand->Expand(variables) == DBFault) return (CMfailed);
    }

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

    if (tableName == (char *) NULL) tableName = DBrNItems;
    if (strcmp (tableName,DBrNCells) == 0) netIF = new DBNetworkIF (data);

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

    saveTable = new DBObjTable(*table);
    if (netIF != (DBNetworkIF *) NULL) {
        for (cellID = 0; cellID < table->ItemNum(); ++cellID) {
            record = table->Item(cellID);
            netIF->CellDelete(record);
        }
    }
    table->DeleteAll();
    if ((strcmp(tableName, DBrNItems) == 0) && ((groups = data->Table(DBrNGroups)) != (DBObjTable *) NULL)) {
        saveGroups = new DBObjTable(*groups);
        groups->DeleteAll();
    }

    if (expr != (char *) NULL) {
        if (operand->Configure(saveTable->Fields()) == DBFault) {
            delete data;
            delete operand;
            return (CMfailed);
        }

        for (recID = 0; recID < saveTable->ItemNum(); ++recID) {
            record = saveTable->Item(recID);
            if (operand->Int(record) == true) {
                if (!fromSelection) continue;
                if ((record->Flags() & DBObjectFlagSelected) == DBObjectFlagSelected) continue;
            }
            table->Add(new DBObjRecord(*record));
            if (groups != (DBObjTable *) NULL) groups->Add(new DBObjRecord(*(saveGroups->Item(recID))));
        }
    }
    else {
        if (fromSelection) {
            for (recID = 0; recID < saveTable->ItemNum(); ++recID) {
                record = saveTable->Item(recID);
                if ((record->Flags() & DBObjectFlagSelected) == DBObjectFlagSelected) {
                    table->Add(new DBObjRecord(*record));
                    if (groups != (DBObjTable *) NULL)
                        groups->Add(new DBObjRecord(*(saveGroups->Item(recID))));
                }
            }
        }
    }
    if (netIF != (DBNetworkIF *) NULL) {
        for (cellID = 0; cellID < netIF->CellNum(); ++cellID) {
            record = table->Item(cellID);
            netIF->CellAdd(record);
        }
    }

    if (expr != (char *) NULL) delete operand;
    delete variables;
    delete saveTable;
    if (groups != (DBObjTable *) NULL) delete saveGroups;

    if (netIF != (DBNetworkIF *) NULL) {
        netIF->Trim();
        netIF->Build();
        delete netIF;
    }
    ret = (argNum > 2) && (strcmp(argv[2], "-") != 0) ? data->Write(argv[2]) : data->Write(stdout);
    delete data;
    if (verbose) RGlibPauseClose();
    return (ret);
}
开发者ID:bmfekete,项目名称:RGIS,代码行数:101,代码来源:CMDtblDeleteRec.C


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