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


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

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


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

示例1: GetFPDistGrid

void CWet_hView::GetFPDistGrid()
   {
   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->GetLayer( "FLOWDIRX" );
   
 //  pFPDistGrid->m_name = "FP DistGrad";
   MapLayer *pWatershed = gpMapWnd->m_pMap->GetLayer( "CATCH" );


   float flowPathDistance=0.0f;
   int flowPathCount=0;

   int rows = pDEM->GetRowCount();
   int cols = pDEM->GetColCount();
   for ( int row=0; row < rows; row++ )
      {
      for ( int col=0; col < cols; col++ )
         {
         float distance = pFlowDir->GetDownFlowPathDistance( row, col, pStreamGrid );
         pFPDistGrid->m_pData->Set(col, row, (distance));
         }  // end of:  for ( col < cols )
      }  // end of:  for ( row < rows )
      pFPDistGrid->SaveGridFile("c:\\research\\maimai\\nato\\fpDist.grd");
   }
开发者ID:johnmetta,项目名称:wethydro,代码行数:26,代码来源:wet_hView.cpp

示例2: 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();
                     }
                  
                  pFPDistGrid->m_pData->Set(col, row, (distance/gradient));
                  flowPathGradient +=gradient;
                  flowPathDistance +=distance;

                  }
               }
            }  // end of:  for ( col < cols )
         }  // end of:  for ( row < rows )
      
      float averageFPDistance = flowPathDistance/flowPathCount;
      float averageFPGrad = flowPathGradient/flowPathCount;
      float averageFPDistGrad = averageFPDistance/averageFPGrad;
      //float rt = (0.00881f*averageFPDistGrad) + 0.00314f;
 		gpHydroModel->m_pMap->Notify( NT_CALCDIST, i, polygonCount );   
      pWatershed->SetData(i,pWatershed->m_pData->GetCol("EXTRA_1"), averageFPDistGrad);
















   pFPDistGrid2->SaveGridFile("c:\\temp\\Dist_Grad.asc");
   pFPDistGrid1->SaveGridFile("c:\\temp\\Dist.asc");
   pFPDistGrid->SaveGridFile("c:\\temp\\Grad.asc");
   }
开发者ID:johnmetta,项目名称:wethydro,代码行数:101,代码来源:wet_hView.cpp


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