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


C++ MapLayer::GetRecordCount方法代码示例

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


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

示例1: OnTopographiccalculationSideofstream

void CWet_hView::OnTopographiccalculationSideofstream()
   {
      MapLayer *pSourceLayer = gpMapWnd->m_pMap->GetLayer( "Cells" );
		MapLayer *pToLayer = gpMapWnd->m_pMap->GetLayer("STRGRID");
		MapLayer *pFlowDirectionLayer = gpMapWnd->m_pMap->GetLayer("FLOWDIR");
		int colToSet = pSourceLayer->GetFieldCol("SIDE");
 
		int thisCount = pSourceLayer->GetRecordCount();
      int order = -1;
      
      for ( int i=0; i < thisCount; i++ )
			{
			Poly *pPoly = pSourceLayer->GetPolygon(i);
         float test = pPoly->GetArea();
			Vertex centroid = pPoly->GetCentroid();
      //   int colOrder = pSourceLayer->GetFieldCol("ORDER");
            
      //   pSourceLayer->GetData(i,colOrder,order);
         int side = -1;      
     //    if (order == 1)
         //   side = 0;
      //   else
         //   {
		   	int row = 0;
		   	int col = 0;
		   	pFlowDirectionLayer->GetGridCellFromCoord( centroid.x, centroid.y, row, col);
		   	side = pFlowDirectionLayer->GetSideOfStream(row, col, pToLayer);
         //   }

         pSourceLayer->SetData(i, colToSet, side);
         }
   }
开发者ID:johnmetta,项目名称:wethydro,代码行数:32,代码来源:wet_hView.cpp

示例2: OnTopographiccalculationMeanwatershedelevation

void CWet_hView::OnTopographiccalculationMeanwatershedelevation()
   {
   MapLayer *pFlowDir = gpMapWnd->m_pMap->GetLayer( "FLOWDIR" );
   MapLayer *pStreamGrid = gpMapWnd->m_pMap->GetLayer( "STRGRID" );
   MapLayer *pDEM = gpMapWnd->m_pMap->GetLayer( "DEM" );
   MapLayer *pFPDistGrid = gpMapWnd->m_pMap->CloneLayer( *pDEM );
   pFPDistGrid->m_name = "FP DistGrad";
   MapLayer *pWatershed = gpMapWnd->m_pMap->GetLayer( "Cells" );
   MapLayer *pStreamV = gpMapWnd->m_pMap->GetLayer("Streams");
   
   int method = 2;
  // the third parameter is the method to use.  a 1 simply returns the average fpdist for each polygon
   // a two returns the entire fp distribution
   int watershedCount   = pWatershed->GetRecordCount();
   int reachCount = pStreamV->GetRecordCount();
   gpHydroModel->m_fpDistributionArray.SetSize(reachCount);
   gpHydroModel->m_fpDistributionArrayStream.SetSize(reachCount);
   for (int i=0; i < reachCount; i++ )
		{
      Poly *pStreamPoly = pStreamV->m_polyArray[i];
      int streamID;
      gpHydroModel->m_pStreamLayer->GetData(i,pStreamV->m_pData->GetCol("HYDRO_ID"), streamID);
      for ( int j=0; j < watershedCount; j++ )//this should be for each reach
         {
		   Poly *pThisPoly = pWatershed->m_polyArray[j];
         int watershedID;
         gpHydroModel->m_pCellLayer->GetData(j,pWatershed->m_pData->GetCol("HYDRO_ID"), watershedID);
         if (watershedID==streamID) // this polygon is in the current reach
            {
		      Poly *pThisPoly = pWatershed->m_polyArray[j];
            float flowPathDistance=0.0f;
            int flowPathCount=0;
            
            float flowPathGradient = 0.001f;
            int rows = pDEM->GetRowCount();
            int cols = pDEM->GetColCount();
            for ( int row=0; row < rows; row++ )
               {
               for ( int col=0; col < cols; col++ )
                  {
                  float x = 0;
                  float y = 0;
                  pDEM->GetGridCellCenter(row, col, x, y);
                  
                  Vertex point;
                  point.x = x;
                  point.y = y;       ///the stream grid is smaller than the flowdir grid
                  if (pThisPoly->IsPointInPoly(point))
                     {
                     int flowPathCellCount=0;
                     float distance = pFlowDir->GetDownFlowPathDistance( row, col, pStreamGrid );
                     float gradient = pFlowDir->GetDownFlowPathGradient(row,col,pStreamGrid,pDEM,flowPathCellCount);
                     gradient=gradient/flowPathCellCount;        
                     float dist_grad = distance/gradient;
                     if (distance==pFlowDir->GetNoDataValue())
                        {
                        dist_grad = pFlowDir->GetNoDataValue();
                        gradient = pFlowDir->GetNoDataValue();
                        }
                     pFPDistGrid->m_pData->Set(col, row, (distance/gradient)); 
                     if (method==1)// we just want the average fpdistance
                        {
                        flowPathGradient +=gradient;
                        flowPathDistance +=distance;
                        flowPathCount++;
                        }
                     if (method==2)// we want to maintain the entire distribution
                        {
                        int dist = (int)(distance/gradient);
                        gpHydroModel->m_fpDistributionArray[i].Add(dist);
                        }
                     }
                  }  // end of:  for ( col < cols )
               }  // end of:  for ( row < rows )
            } // end of :  if watershed==streamID
         }// end of j (watershedCount)
   //  we have found all the flowpaths in the jth reach, but want to now find the median value of that distribution
      float median=-1;
      if (method==2)
         {
         int  temp=-1;
         for (int bottom=gpHydroModel->m_fpDistributionArray[i].GetCount()-1; bottom>0;bottom--)
            {
            for (int position=0;position<bottom;position++)
               {
               int val = gpHydroModel->m_fpDistributionArray[i][position+1];
               int val2 = gpHydroModel->m_fpDistributionArray[i][position];
               if (val < val2)
                  {
                  int temp2 = gpHydroModel->m_fpDistributionArray[i][position];
                  gpHydroModel->m_fpDistributionArray[i][position] = gpHydroModel->m_fpDistributionArray[i][position+1];
                  gpHydroModel->m_fpDistributionArray[i][position+1] = temp2;
                  }
               }
            }
         if (gpHydroModel->m_fpDistributionArray[i].GetCount()<=1)//there were no watersheds for this reach
            {
            median = 0.0f;
            }
         else
//.........这里部分代码省略.........
开发者ID:johnmetta,项目名称:wethydro,代码行数:101,代码来源:wet_hView.cpp

示例3: movieSaveDlg


//.........这里部分代码省略.........
   
   float flowPathGradient = 0.0001f;
   int rows = pFlowDir->GetRowCount();
   int cols = pFlowDir->GetColCount();
   int cellCount = rows*cols;
   int sofar=0;
   for ( int row=0; row < rows; row++ )
      {
      for ( int col=0; col < cols; col++ )
         {
         int flowPathCellCount=0;
         float distance = pFlowDir->GetDownFlowPathDistance( row, col, pStreamGrid );
         float gradient = pFlowDir->GetDownFlowPathGradient(row,col,pStreamGrid,pDEM,flowPathCellCount);
         gradient=gradient/flowPathCellCount;        
         float dist_grad = distance/gradient;
         if (distance==pFlowDir->GetNoDataValue())
            {
            dist_grad = pFlowDir->GetNoDataValue();
            gradient = pFlowDir->GetNoDataValue();
            }

         pFPDistGrid->m_pData->Set(col, row, gradient);  
         pFPDistGrid1->m_pData->Set(col, row, distance);  
         pFPDistGrid2->m_pData->Set(col, row, dist_grad);  
         sofar = sofar++;
         gpHydroModel->m_pMap->Notify( NT_CALCDIST, sofar, cellCount ); 
         }  // end of:  for ( col < cols )
      }  // end of:  for ( row < rows )
*/
   float flowPathDistance=0.0f;
   int flowPathCount=0;
    float flowPathGradient = 0.0001f;
   MapLayer *pWatershed = gpMapWnd->m_pMap->GetLayer( "Cells" );
   int polygonCount   = pWatershed->GetRecordCount();
   for ( int i=0; i < polygonCount; i++ )
		{    
		Poly *pThisPoly = pWatershed->m_polyArray[ i ];
      float flowPathDistance=0.0f;
      int flowPathCount=0;
      float flowPathGradient = 0.0001f;
      int rows = pDEM->GetRowCount();
      int cols = pDEM->GetColCount();
      for ( int row=0; row < rows; row++ )
         {
         for ( int col=0; col < cols; col++ )
            {
               float x = 0;
               float y = 0;
               pDEM->GetGridCellCenter(row, col, x, y);
              
               Vertex point;
               point.x = x;
               point.y = y;       
               if (pThisPoly->IsPointInPoly(point))
                  {
                  int flowPathCellCount=0;
                  float distance = pFlowDir->GetDownFlowPathDistance( row, col, pStreamGrid );
                  float gradient = pFlowDir->GetDownFlowPathGradient(row,col,pStreamGrid,pDEM,flowPathCellCount);
                  gradient=gradient/flowPathCellCount;        
                  float dist_grad = distance/gradient;
                  if (distance==pFlowDir->GetNoDataValue())
                     {
                     dist_grad = pFlowDir->GetNoDataValue();
                     gradient = pFlowDir->GetNoDataValue();
                     }
                  
开发者ID:johnmetta,项目名称:wethydro,代码行数:66,代码来源:wet_hView.cpp


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