本文整理汇总了C++中DBNetworkIF::CellDelete方法的典型用法代码示例。如果您正苦于以下问题:C++ DBNetworkIF::CellDelete方法的具体用法?C++ DBNetworkIF::CellDelete怎么用?C++ DBNetworkIF::CellDelete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBNetworkIF
的用法示例。
在下文中一共展示了DBNetworkIF::CellDelete方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _RGISUserFuncionNetwork
void _RGISUserFuncionNetwork (DBObjData *data,UI2DView *view,XEvent *event)
{
DBInt sX, sY, redraw = false;
DBNetworkIF *netIF;
DBCoordinate coord;
DBObjRecord *cellRec, *basinRec;
void _RGISUserFuncionQuery (DBObjData *,UI2DView *,XEvent *);
if ((data->Flags () & DBDataFlagUserModeFlags) == DBDataFlagUserModeQuery)
{ _RGISUserFuncionQuery (data,view,event); return; }
if (event->type != ButtonPress) return;
if (DBTypeNetwork != data->Type ())
{ CMmsgPrint (CMmsgAppError, "Invalid data Type in: %s %d",__FILE__,__LINE__); }
sX = event->xbutton.x;
sY = event->xbutton.y;
view->Window2Map (sX,sY, &coord.X, &coord.Y);
netIF = new DBNetworkIF (data);
switch (data->Flags () & DBDataFlagUserModeFlags)
{
case DBDataFlagUserModeSelect:
{
DBInt basinID, cellID;
DBRegion extent;
UITable *tableView;
if ((cellRec = netIF->Cell (coord)) == (DBObjRecord *) NULL)
{ UIMessage ((char *) "Cell Does not Exists!"); return; }
for (basinID = 0;basinID < netIF->BasinNum ();++basinID)
{
basinRec = netIF->Basin (basinID);
if ((basinRec->Flags () & DBObjectFlagSelected) == DBObjectFlagSelected)
{
data->SelectObject (basinRec,DBClear);
extent.Expand (data->Extent (basinRec));
}
}
for (cellID = 0;cellID < netIF->CellNum ();++cellID)
{
cellRec = netIF->Cell (cellID);
if ((cellRec->Flags () & DBObjectFlagSelected) == DBObjectFlagSelected)
{
extent.Expand (netIF->Center (cellRec) + (netIF->CellSize () / 2.0));
extent.Expand (netIF->Center (cellRec) - (netIF->CellSize () / 2.0));
cellRec->Flags (DBObjectFlagSelected,DBClear);
}
}
if ((tableView = (UITable *) data->Display (UITableName (data,data->Table (DBrNItems)))) != (UITable *) NULL)
tableView->Draw ();
if ((tableView = (UITable *) data->Display (UITableName (data,data->Table (DBrNCells)))) != (UITable *) NULL)
tableView->Draw ();
UI2DViewRedrawAll (extent);
cellRec = netIF->Cell (coord);
switch (data->Flags () & DBDataFlagSelectMode)
{
case DBDataFlagSelectMode: netIF->DownStreamSearch (cellRec, DBNetworkSelect); break;
default: netIF->UpStreamSearch (cellRec, DBNetworkSelect); break;
}
extent.Initialize ();
for (cellID = 0;cellID < netIF->CellNum ();++cellID)
{
cellRec = netIF->Cell (cellID);
if ((cellRec->Flags () & DBObjectFlagSelected) == DBObjectFlagSelected)
{
extent.Expand (netIF->Center (cellRec) + (netIF->CellSize () / 2.0));
extent.Expand (netIF->Center (cellRec) - (netIF->CellSize () / 2.0));
}
}
UI2DViewRedrawAll (extent);
if ((tableView = (UITable *) data->Display (UITableName (data,data->Table (DBrNCells)))) != (UITable *) NULL)
tableView->Draw ();
} break;
case DBDataFlagUserModeAdd:
if (netIF->CellAdd (coord) == (DBObjRecord *) NULL) UIMessage ((char *) "Cell Creation Error");
else redraw = true;
break;
case DBDataFlagUserModeDelete:
if (netIF->CellDelete (coord) == DBFault) UIMessage ((char *) "Cell Does not Exists!");
else redraw = true;
break;
case DBDataFlagUserModeRotate:
{
DBObjRecord *cellRec = netIF->Cell (coord);
if (cellRec != (DBObjRecord *) NULL)
{
switch (netIF->CellDirection (cellRec))
{
case DBNull: netIF->CellDirection (cellRec,DBNetDirN); break;
case DBNetDirNW: netIF->CellDirection (cellRec,DBNull); break;
default: netIF->CellRotate (cellRec,DBForward); break;
}
redraw = true;
}
} break;
default: printf ("Unknown Mode %lX",data->Flags () & DBDataFlagUserModeFlags); break;
}
//.........这里部分代码省略.........
示例2: main
int main(int argc, char *argv[]) {
int argPos, argNum = argc, ret, verbose = false;
DBInt fromSelection = false, recID;
char *tableName = (char *) NULL;
char *expr = (char *) NULL;
DBInt cellID;
DBMathOperand *operand;
DBObjectLIST<DBObject> *variables = new DBObjectLIST<DBObject>("Variables");
DBObjData *data;
DBObjTable *table, *saveTable, *groups = (DBObjTable *) NULL, *saveGroups;
DBObjRecord *record;
DBNetworkIF *netIF = (DBNetworkIF *) NULL;
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], "-c", "--condition")) {
if ((argNum = CMargShiftLeft(argPos, argv, argNum)) <= argPos) {
CMmsgPrint(CMmsgUsrError, "Missing expression!");
return (CMfailed);
}
if (expr != (char *) NULL) {
CMmsgPrint(CMmsgUsrError, "Expression is already set");
return (CMfailed);
}
expr = argv[argPos];
if ((argNum = CMargShiftLeft(argPos, argv, argNum)) <= argPos) break;
continue;
}
if (CMargTest (argv[argPos], "-s", "--selection")) {
fromSelection = true;
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, " -c,--condition [expression]");
CMmsgPrint(CMmsgInfo, " -s,--selection");
CMmsgPrint(CMmsgInfo, " -V,--verbose");
CMmsgPrint(CMmsgInfo, " -h,--help");
return (DBSuccess);
}
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);
//.........这里部分代码省略.........