本文整理汇总了C++中DBNetworkIF::MouthCell方法的典型用法代码示例。如果您正苦于以下问题:C++ DBNetworkIF::MouthCell方法的具体用法?C++ DBNetworkIF::MouthCell怎么用?C++ DBNetworkIF::MouthCell使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBNetworkIF
的用法示例。
在下文中一共展示了DBNetworkIF::MouthCell方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Extent
DBRegion DBObjData::Extent(DBObjRecord *record) {
DBRegion extent;
DBCoordinate coord;
DBFloat delta;
DBObjTable *items;
DBObjTableField *field;
if (record == (DBObjRecord *) NULL) return (Extent());
switch (Type()) {
case DBTypeVectorPoint:
delta = pow((double) 10.0, (double) Precision());
items = TablesPTR->Item(DBrNItems);
field = items->Field(DBrNCoord);
coord = field->Coordinate(record);
extent.Expand(coord + delta);
extent.Expand(coord - delta);
return (extent);
case DBTypeVectorLine:
case DBTypeVectorPolygon:
items = TablesPTR->Item(DBrNItems);
field = items->Field(DBrNRegion);
return (field->Region(record));
case DBTypeGridDiscrete:
case DBTypeGridContinuous:
return (Extent());
case DBTypeNetwork: {
DBInt cellID, cellNum;
DBObjRecord *cellRec;
DBNetworkIF *netIF = new DBNetworkIF(this);
cellRec = netIF->MouthCell(record);
cellNum = netIF->CellBasinCells(cellRec) + cellRec->RowID();
for (cellID = cellRec->RowID(); cellID < cellNum; ++cellID) {
cellRec = netIF->Cell(cellID);
extent.Expand(netIF->Center(cellRec) + (netIF->CellSize() / 2.0));
extent.Expand(netIF->Center(cellRec) - (netIF->CellSize() / 2.0));
}
delete netIF;
}
return (extent);
case DBTypeTable:
default:
return (extent);
}
}
示例2: RGISEditNetAddBasinXYCBK
void RGISEditNetAddBasinXYCBK (Widget widget, RGISWorkspace *workspace,XmAnyCallbackStruct *callData)
{
DBInt basinID;
DBDataset *dataset = UIDataset ();
DBObjData *dbData =dataset->Data ();
DBNetworkIF *netIF = new DBNetworkIF (dbData);
DBObjTable *itemTable = dbData->Table (DBrNItems);
DBObjTableField *xCoordFLD = itemTable->Field (RGISNetMouthXCoord);
DBObjTableField *yCoordFLD = itemTable->Field (RGISNetMouthYCoord);
DBCoordinate coord;
DBObjRecord *basinRec;
UITable *tableCLS = (UITable *) dbData->Display (UITableName (dbData,itemTable));
UIPauseDialogOpen ((char *) "Adding XY Coordinates");
if (xCoordFLD == NULL)
{
xCoordFLD = new DBObjTableField (RGISNetMouthXCoord,DBTableFieldFloat,(char *) "%10.3f",sizeof (DBFloat4));
itemTable->AddField (xCoordFLD);
if (tableCLS != (UITable *) NULL) tableCLS->AddField (xCoordFLD);
UIPause (40);
}
if (yCoordFLD == NULL)
{
yCoordFLD = new DBObjTableField (RGISNetMouthYCoord,DBTableFieldFloat,(char *) "%10.3f",sizeof (DBFloat4));
itemTable->AddField (yCoordFLD);
if (tableCLS != (UITable *) NULL) tableCLS->AddField (yCoordFLD);
UIPause (80);
}
for (basinID = 0;basinID < netIF->BasinNum ();++basinID)
{
basinRec = netIF->Basin (basinID);
if (UIPause (80 + basinID * 20 / netIF->BasinNum ())) goto Stop;
coord = netIF->Center (netIF->MouthCell (basinRec));
xCoordFLD->Float (basinRec,coord.X);
yCoordFLD->Float (basinRec,coord.Y);
}
Stop:
UIPauseDialogClose ();
if (tableCLS != (UITable *) NULL) tableCLS->Draw ();
}
示例3: main
//.........这里部分代码省略.........
if ((argNum = CMargShiftLeft(argPos, argv, argNum)) <= argPos) {
CMmsgPrint(CMmsgUsrError, "Missing field name!");
return (CMfailed);
}
fieldXName = argv[argPos];
if ((argNum = CMargShiftLeft(argPos, argv, argNum)) <= argPos) break;
continue;
}
if (CMargTest (argv[argPos], "-y", "--Yfield")) {
if ((argNum = CMargShiftLeft(argPos, argv, argNum)) <= argPos) {
CMmsgPrint(CMmsgUsrError, "Missing field name!");
return (CMfailed);
}
fieldYName = 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 file> <output file>", CMfileName(argv[0]));
CMmsgPrint(CMmsgInfo, " -a, --table [ [DBCells] | DBItems ]");
CMmsgPrint(CMmsgInfo, " -f, --IDfield [ [CellID] | BasinID ]");
CMmsgPrint(CMmsgInfo, " -x, --Xfield [ [CellXCoord] | MouthXCoord ]");
CMmsgPrint(CMmsgInfo, " -y, --Yfield [ [CellYCoord] | MouthYCoord ]");
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]);
if (tableName == (char *) NULL) tableName = (char *) "DBCells";
if (fieldIDName == (char *) NULL) fieldIDName = (char *) "CellID";
if (fieldXName == (char *) NULL) fieldXName = (char *) "CellXCoord";
if (fieldYName == (char *) NULL) fieldYName = (char *) "CellYCoord";
data = new DBObjData();
if (((argNum > 1) && (strcmp(argv[1], "-") != 0) ? data->Read(argv[1]) : data->Read(stdin)) == DBFault) {
delete data;
return (CMfailed);
}
if ((table = data->Table(tableName)) == (DBObjTable *) NULL) {
CMmsgPrint(CMmsgUsrError, "Invalid table: %s!", tableName);
delete data;
return (CMfailed);
}
netIF = new DBNetworkIF(data);
fieldID = new DBObjTableField(fieldIDName, DBTableFieldInt, (char *) "%8d", sizeof (DBInt));
fieldX = new DBObjTableField (fieldXName, DBTableFieldFloat, (char *) "%10.3f", sizeof (DBFloat4));
fieldY = new DBObjTableField (fieldYName, DBTableFieldFloat, (char *) "%10.3f", sizeof (DBFloat4));
table->AddField(fieldID);
table->AddField(fieldX);
table->AddField(fieldY);
if (strcmp(fieldIDName, "CellID") == 0) {
for (recID = 0; recID < table->ItemNum(); ++recID) {
record = netIF->Cell(recID);
coord = netIF->Center(record);
fieldID->Int(record, recID+1);
fieldX->Float(record, coord.X);
fieldY->Float(record, coord.Y);
}
} else if (strcmp(fieldIDName, "BasinID") == 0) {
for (recID = 0; recID < netIF->BasinNum(); ++recID) {
record = netIF->Basin(recID);
coord = netIF->Center(netIF->MouthCell(record));
fieldID->Int(record, recID+1);
fieldX->Float(record,coord.X);
fieldY->Float(record,coord.Y);
}
} else {
CMmsgPrint(CMmsgUsrError, "Invalid field name: %s!", fieldIDName);
delete data;
return (CMfailed);
}
ret = (argNum > 2) && (strcmp(argv[2], "-") != 0) ? data->Write(argv[2]) : data->Write(stdout);
delete data;
if (verbose) RGlibPauseClose();
return (ret);
}
示例4: _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;
}