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


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

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


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

示例1: RGlibPointSTNCoordinates

DBInt RGlibPointSTNCoordinates(DBObjData *dbData, DBObjTableField *field) {
    DBInt pointID, ret = DBFault;
    DBCoordinate coord;
    DBPosition pos;
    DBObjData *linkedData = dbData->LinkedData();
    DBVPointIF *pntIF;
    DBNetworkIF *netIF;
    DBObjRecord *pntRec, *cellRec;

    if (linkedData == (DBObjData *) NULL) return (DBFault);
    pntIF = new DBVPointIF(dbData);
    netIF = new DBNetworkIF(linkedData);
    for (pointID = 0; pointID < pntIF->ItemNum(); ++pointID) {
        pntRec = pntIF->Item(pointID);
        if (DBPause(pointID * 100 / pntIF->ItemNum())) goto Stop;
        if ((pntRec->Flags () & DBObjectFlagIdle) == DBObjectFlagIdle) continue;
        coord = pntIF->Coordinate(pntRec);
        if (netIF->Coord2Pos(coord, pos) == DBFault) continue;
        netIF->Pos2Coord(pos, coord);
        if ((field != (DBObjTableField *) NULL) &&
            (!CMmathEqualValues(field->Float(pntRec), field->FloatNoData())) &&
            ((cellRec = netIF->Cell(coord, field->Float(pntRec))) != (DBObjRecord *) NULL))
            coord = netIF->Center(cellRec);
        pntIF->Coordinate(pntRec, coord);
    }
    ret = DBSuccess;
    Stop:
    delete netIF;
    delete pntIF;
    return (ret);
}
开发者ID:bmfekete,项目名称:RGIS,代码行数:31,代码来源:RGlibPoint.C

示例2: _RGISUserFuncionNetwork


//.........这里部分代码省略.........
	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;
		}
	if (redraw)
		{
		DBPosition pos;

		if (netIF->Coord2Pos (coord,pos) == DBSuccess)
			{
			DBRegion extent;
			DBCoordinate delta (netIF->CellWidth () * 1.25, netIF->CellHeight () * 1.25);

			netIF->Pos2Coord (pos,coord); coord = coord + delta; extent.Expand (coord);
			netIF->Pos2Coord (pos,coord); coord = coord - delta; extent.Expand (coord);
			UI2DViewRedrawAll (extent);
			}
		}
	delete netIF;
	}
开发者ID:bandi13,项目名称:RGIS,代码行数:101,代码来源:RGISUsrFuncNet.C


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