本文整理汇总了C++中MapLayer::ClassifyData方法的典型用法代码示例。如果您正苦于以下问题:C++ MapLayer::ClassifyData方法的具体用法?C++ MapLayer::ClassifyData怎么用?C++ MapLayer::ClassifyData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MapLayer
的用法示例。
在下文中一共展示了MapLayer::ClassifyData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnTopographiccalculationMeanwatershedelevation
//.........这里部分代码省略.........
for (int i=0; i<gpHydroModel->m_fpDistributionArrayStream[pNode->m_pLeft->m_reachInfo.index].GetSize();i++)
gpHydroModel->m_fpDistributionArrayStream[pNode->m_reachInfo.index].Add((int)gpHydroModel->m_fpDistributionArrayStream[pNode->m_pLeft->m_reachInfo.index][i]);
}
else //Not a phantom so just add up the left, right and current area.
{
REACH_INFO_HYDRO *pHydro = gpHydroModel->GetReachInfoHydroFromReachID( pNode->m_reachInfo.reachID );
if ( pNode->m_pRight != NULL )
{
gpHydroModel->m_fpDistributionArrayStream[pNode->m_reachInfo.index].Add((int)pHydro->cumSedimentOutflow);
count++;
for (int i=0; i<gpHydroModel->m_fpDistributionArrayStream[pNode->m_pRight->m_reachInfo.index].GetSize();i++)
gpHydroModel->m_fpDistributionArrayStream[pNode->m_reachInfo.index].Add((int)gpHydroModel->m_fpDistributionArrayStream[pNode->m_pRight->m_reachInfo.index][i]);
for (int i=0; i<gpHydroModel->m_fpDistributionArrayStream[pNode->m_pLeft->m_reachInfo.index].GetSize();i++)
gpHydroModel->m_fpDistributionArrayStream[pNode->m_reachInfo.index].Add((int)gpHydroModel->m_fpDistributionArrayStream[pNode->m_pLeft->m_reachInfo.index][i]);
}
else
{
gpHydroModel->m_fpDistributionArrayStream[pNode->m_reachInfo.index].Add((int)pHydro->cumSedimentOutflow);
count++;
for (int i=0; i<gpHydroModel->m_fpDistributionArrayStream[pNode->m_pLeft->m_reachInfo.index].GetSize();i++)
gpHydroModel->m_fpDistributionArrayStream[pNode->m_reachInfo.index].Add((int)gpHydroModel->m_fpDistributionArrayStream[pNode->m_pLeft->m_reachInfo.index][i]);
}
}
}//end of : else
}//end of While (search for the root node...)
//Now go through the m_fpDistributionArray and again find the median value.
for (int j=0;j<pStreamV->GetRecordCount();j++)
{
float median=-1.0f;
float rt=0.0f;
if (method==2)
{
int temp=-1;
int count = gpHydroModel->m_fpDistributionArrayStream[j].GetCount();
for (int bottom=gpHydroModel->m_fpDistributionArrayStream[j].GetCount()-1; bottom>0;bottom--)
{
for (int position=0;position<bottom;position++)
{
int val = gpHydroModel->m_fpDistributionArrayStream[j][position+1];
int val2 = gpHydroModel->m_fpDistributionArrayStream[j][position];
if (val < val2)
{
int temp2 = gpHydroModel->m_fpDistributionArrayStream[j][position];
gpHydroModel->m_fpDistributionArrayStream[j][position] = gpHydroModel->m_fpDistributionArrayStream[j][position+1];
gpHydroModel->m_fpDistributionArrayStream[j][position+1] = temp2;
}
}
}
// if (gpHydroModel->m_fpDistributionArrayStream[j].GetCount()<=1)//there were no watersheds for this reach
// median = 0;
// else
// {
int midValue = gpHydroModel->m_fpDistributionArrayStream[j].GetCount();
if (midValue<0)
median=0.0f;
else
median = (float)gpHydroModel->m_fpDistributionArrayStream[j][(int)(midValue/2)];
rt = (0.002347f*median) + 0.186f;
// }
}//end of j - now on to the next stream reach in the array
// Then add the median value to somewhere that can be mapped...
gpHydroModel->m_pMap->Notify( NT_CALCDIST, j, reachCount );
pStreamV->SetData(j,pStreamV->m_pData->GetCol("EXTRA_1"), median);
int streamID=-1;
pStreamV->GetData(j,pStreamV->m_pData->GetCol("HYDRO_ID"), streamID);
for ( int jj=0; jj < watershedCount; jj++ )//this should be for each reach
{
Poly *pThisPoly = pWatershed->m_polyArray[jj];
int watershedID;
gpHydroModel->m_pCellLayer->GetData(jj,pWatershed->m_pData->GetCol("HYDRO_ID"), watershedID);
if (watershedID==streamID) // this polygon is in the current reach
pWatershed->SetData(jj,pWatershed->m_pData->GetCol("EXTRA_1"), rt);
}
}
float minVal=0.0f;
float maxVal=0.0f;
pWatershed->GetDataMinMax( pWatershed->m_pData->GetCol("EXTRA_1"), &minVal, &maxVal );
pWatershed->SetBins(minVal,maxVal,10);
pWatershed->ClassifyData(pWatershed->m_pData->GetCol("EXTRA_1"));
if ( gpMapWnd != NULL )
gpMapWnd->RefreshList();
gpMapWnd->m_pMapList->RedrawWindow();
CDC *dc = gpMapWnd->m_pMap->GetDC();
gpMapWnd->m_pMap->DrawMap(*dc);
gpMapWnd->m_pMap->ReleaseDC(dc);
pWatershed->SaveShapeFile("c:\\temp\\test.shp",false);
}//end of method...