本文整理汇总了C++中DBNetworkIF::CellBasinLength方法的典型用法代码示例。如果您正苦于以下问题:C++ DBNetworkIF::CellBasinLength方法的具体用法?C++ DBNetworkIF::CellBasinLength怎么用?C++ DBNetworkIF::CellBasinLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBNetworkIF
的用法示例。
在下文中一共展示了DBNetworkIF::CellBasinLength方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _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;
}
示例2: RGISAnNetworkStreamLinesCBK
void RGISAnNetworkStreamLinesCBK (Widget widget,RGISWorkspace *workspace,XmAnyCallbackStruct *callData)
{
char *selection;
DBDataset *dataset = UIDataset ();
DBObjData *netData = dataset->Data ();
DBObjTable *cellTable = netData->Table (DBrNCells);
DBObjData *arcData = new DBObjData ("",DBTypeVectorLine);
DBNetworkIF *netIF = new DBNetworkIF (netData);
static Widget fieldSelect = (Widget) NULL;
widget = widget; callData = callData;
if (fieldSelect == (Widget) NULL) fieldSelect = UISelectionCreate ((char *) "Select Field");
if ((selection = UISelectObject (fieldSelect,(DBObjectLIST<DBObject> *) cellTable->Fields (),DBTableFieldIsInteger)) == (char *) NULL)
return;
if ((_RGISAnNetOrderField = cellTable->Field (selection)) == (DBObjTableField *) NULL)
{ CMmsgPrint (CMmsgAppError, "Field Selection Error in: %s %d",__FILE__,__LINE__); return; }
arcData->Document (DBDocGeoDomain,netData->Document (DBDocGeoDomain));
arcData->Document (DBDocSubject,"Stream Lines");
if (UIDataHeaderForm (arcData))
{
DBInt cellID;
char objName [DBStringLength];
DBVLineIF *lineIF = new DBVLineIF (arcData);
DBObjTable *cellTable = netData->Table (DBrNCells);
DBObjTable *lineTable = arcData->Table (DBrNItems);
DBObjTableField *basinFLD = new DBObjTableField (DBrNBasin,DBTableFieldInt,"%8d",sizeof (DBInt));
DBObjTableField *fieldFLD = new DBObjTableField (_RGISAnNetOrderField->Name (),
_RGISAnNetOrderField->Type (),
_RGISAnNetOrderField->Format (),
_RGISAnNetOrderField->Length ());
DBObjTableField *lengthFLD = new DBObjTableField (RGISNetStreamLength,DBTableFieldFloat,"%10.1f",sizeof (DBFloat4));
DBObjTableField *areaFLD = new DBObjTableField (RGISNetStreamArea,DBTableFieldFloat,"%10.1f",sizeof (DBFloat4));
DBObjTableField *basinAreaFLD = new DBObjTableField (RGISNetBasinArea,DBTableFieldFloat,"%10.1f",sizeof (DBFloat4));
DBObjTableField *nextFLD = new DBObjTableField (RGISNetStreamNext,DBTableFieldInt,"%6d",sizeof (DBInt));
DBObjRecord *cellRec, *toCellRec, *lineRec;
arcData->Projection (netData->Projection ());
arcData->Precision (netData->Precision ());
arcData->MaxScale (netData->MaxScale ());
arcData->MinScale (netData->MinScale ());
lineTable->AddField (basinFLD);
lineTable->AddField (fieldFLD);
lineTable->AddField (lengthFLD);
lineTable->AddField (areaFLD);
lineTable->AddField (basinAreaFLD);
lineTable->AddField (nextFLD);
cellTable->AddField (_RGISAnNetStreamIDFLD = new DBObjTableField ("StreamID",DBTableFieldInt,"%8d",sizeof (DBInt)));
_RGISAnNetStreamID = 0;
UIPauseDialogOpen ((char *) "Creating Stream Lines");
cellID = netIF->CellNum () - 1;
cellRec = netIF->Cell (cellID);
if (lineIF->NewSymbol ("Default Symbol") == (DBObjRecord *) NULL)
{ CMmsgPrint (CMmsgAppError, "Symbol Creation Error in: %s %d",__FILE__,__LINE__); return; }
for (;cellID >= 0;--cellID)
{
cellRec = netIF->Cell (cellID);
if (((toCellRec = netIF->ToCell (cellRec)) == (DBObjRecord *) NULL) ||
(_RGISAnNetOrderField->Int (cellRec) != _RGISAnNetOrderField->Int (toCellRec)) ||
(netIF->CellOrder (cellRec) != netIF->CellOrder (toCellRec)))
{
if (UIPause ((netIF->CellNum () - cellRec->RowID ()) * 100 / netIF->CellNum ())) goto Stop;
sprintf (objName,"Line: %5d",_RGISAnNetStreamID + 1);
if ((lineRec = lineIF->NewItem (objName)) == (DBObjRecord *) NULL)
{ CMmsgPrint (CMmsgAppError, "Line Insertion Error in: %s %d",__FILE__,__LINE__); return; }
nextFLD->Int (lineRec,toCellRec == (DBObjRecord *) NULL ? 0 : _RGISAnNetStreamIDFLD->Int (toCellRec) + 1);
basinFLD->Int (lineRec,netIF->CellBasinID (cellRec));
fieldFLD->Int (lineRec,_RGISAnNetOrderField->Int (cellRec));
_RGISAnNetVertex = 0;
netIF->UpStreamSearch (_RGISAnNetworkCellRec = cellRec,(DBNetworkACTION) _RGISAnNetworkUpStreamAction);
lineIF->FromNode (lineRec,lineIF->Node (netIF->Center (_RGISAnNetworkCellRec),true));
lineIF->ToNode (lineRec,lineIF->Node (netIF->Center (cellRec) + netIF->Delta (cellRec),true));
_RGISAnNetArea = netIF->CellArea (_RGISAnNetworkCellRec);
if (_RGISAnNetVertex > 1)
{
if (_RGISAnNetVertexNum < _RGISAnNetVertex - 1)
{
_RGISAnNetCoord = (DBCoordinate *) realloc (_RGISAnNetCoord,(_RGISAnNetVertex - 1) * sizeof (DBCoordinate));
if (_RGISAnNetCoord == (DBCoordinate *) NULL)
{ CMmsgPrint (CMmsgSysError, "Memory Allocation Error in: %s %d",__FILE__,__LINE__); return; }
}
_RGISAnNetVertex = 0;
netIF->DownStreamSearch (netIF->ToCell (_RGISAnNetworkCellRec),(DBNetworkACTION) _RGISAnNetworkDownStreamAction);
}
else _RGISAnNetVertex = 0;
lineIF->Vertexes (lineRec,_RGISAnNetCoord,_RGISAnNetVertex);
lineIF->ItemSymbol (lineRec,lineIF->Symbol (0));
lengthFLD->Float (lineRec,netIF->CellBasinLength (cellRec));
areaFLD->Float (lineRec,_RGISAnNetArea);
basinAreaFLD->Float (lineRec,netIF->CellBasinArea (cellRec));
_RGISAnNetStreamID += 1;
}
}
//.........这里部分代码省略.........
示例3: RGlibPointSTNCharacteristics
//.........这里部分代码省略.........
}
for (pointID = 0; pointID < pointTable->ItemNum(); pointID++) {
pointRec = pointTable->Item(pointID);
if (DBPause(10 + pointID * 10 / pointTable->ItemNum())) goto Stop;
if ((pointRec->Flags() & DBObjectFlagIdle) == DBObjectFlagIdle) {
cellIDFLD->Int(pointRec, cellIDFLD->IntNoData());
basinFLD->Int(pointRec, basinFLD->IntNoData());
basinNameFLD->String(pointRec, "");
orderFLD->Int(pointRec, orderFLD->IntNoData());
colorFLD->Int(pointRec, colorFLD->IntNoData());
basinCellsFLD->Int(pointRec, basinCellsFLD->IntNoData());
basinAreaFLD->Float(pointRec, basinAreaFLD->FloatNoData());
interAreaFLD->Float(pointRec, interAreaFLD->FloatNoData());
continue;
}
if ((cellRec = netIF->Cell(pntIF->Coordinate(pointRec))) == (DBObjRecord *) NULL) {
cellIDFLD->Int(pointRec, 0);
basinFLD->Int(pointRec, 0);
basinNameFLD->String(pointRec, "Water");
orderFLD->Int(pointRec, colorFLD->IntNoData());
colorFLD->Int(pointRec, colorFLD->IntNoData());
basinCellsFLD->Int(pointRec, 0);
basinAreaFLD->Float(pointRec, 0.0);
interAreaFLD->Float(pointRec, 0.0);
}
else {
cellIDFLD->Int(pointRec, cellRec->RowID() + 1);
basinRec = netIF->Basin(cellRec);
basinFLD->Int(pointRec, basinRec->RowID() + 1);
basinNameFLD->String(pointRec, basinRec->Name());
orderFLD->Int(pointRec, netIF->CellOrder(cellRec));
colorFLD->Int(pointRec, 0);
basinCellsFLD->Int(pointRec, netIF->CellBasinCells(cellRec));
basinLengthFLD->Float(pointRec, netIF->CellBasinLength(cellRec));
basinAreaFLD->Float(pointRec, netIF->CellBasinArea(cellRec));
interAreaFLD->Float(pointRec, netIF->CellBasinArea(cellRec));
}
nextStationFLD->Int(pointRec, 0);
}
for (cellID = 0; cellID < cellTable->ItemNum(); ++cellID) {
if (DBPause(20 + cellID * 20 / cellTable->ItemNum())) goto Stop;
cellRec = cellTable->Item(cellID);
_RGlibTEMPPointIDFLD->Int(cellRec, DBFault);
}
pointTable->ListSort(basinAreaFLD);
for (pointRec = pointTable->Last(); pointRec != (DBObjRecord *) NULL; pointRec = pointTable->Next(DBBackward)) {
if ((pointRec->Flags() & DBObjectFlagIdle) == DBObjectFlagIdle) continue;
if (DBPause(40 + pointID * 20 / pointTable->ItemNum())) goto Stop;
cellRec = netIF->Cell(pntIF->Coordinate(pointRec));
netIF->UpStreamSearch(cellRec, (DBNetworkACTION) _RGlibSetPointID,
(void *) ((char *) NULL + pointRec->RowID()));
}
for (pointID = 0; pointID < pointTable->ItemNum(); pointID++) {
pointRec = pointTable->Item(pointID);
if ((pointRec->Flags() & DBObjectFlagIdle) == DBObjectFlagIdle) continue;
if (DBPause(60 + pointID * 20 / pointTable->ItemNum())) goto Stop;
if ((cellRec = netIF->Cell(pntIF->Coordinate(pointRec))) != (DBObjRecord *) NULL) {
if ((cellRec = netIF->ToCell(cellRec)) == (DBObjRecord *) NULL) continue;
if ((dPointID = _RGlibTEMPPointIDFLD->Int(cellRec)) != DBFault) {
dPointRec = pointTable->Item(dPointID);
nextStationFLD->Int(pointRec, dPointRec->RowID() + 1);
interAreaFLD->Float(dPointRec, interAreaFLD->Float(dPointRec) - basinAreaFLD->Float(pointRec));
}
}
}
pointTable->ListSort(interAreaFLD);