示例#1
0
LONG CuDlgDomPropLocationSpace::OnUpdateData (WPARAM wParam, LPARAM lParam)
{
  // cast received parameters
  int nNodeHandle = (int)wParam;
  LPIPMUPDATEPARAMS pUps = (LPIPMUPDATEPARAMS)lParam;
  ASSERT (nNodeHandle != -1);
  ASSERT (pUps);

  // ignore selected actions on filters
  switch (pUps->nIpmHint)
  {
    case 0:
    //case FILTER_DOM_SYSTEMOBJECTS:
    //case FILTER_DOM_BASEOWNER:
    //case FILTER_DOM_OTHEROWNER:
    //case FILTER_DOM_BKREFRESH:          // Special item - no refresh code
    //case FILTER_DOM_BKREFRESH_DETAIL:   // Special item - no refresh code
      break;

    default:
      return 0L;    // nothing to change on the display
  }

  LPTREERECORD  lpRecord = (LPTREERECORD)pUps->pStruct;
  ASSERT (lpRecord);

  LOCATIONDATAMIN locData;
  x_strcpy ((char *)locData.LocationName, (const char *)lpRecord->objName);
  x_strcpy ((char *)locData.LocationArea, (const char *)lpRecord->szComplim);
  // Just in case - Normally not used by Create method with 2 parameters
  locData.LocationUsages[0] = ATTACHED_NO;   // DATA_PATH
  locData.LocationUsages[1] = ATTACHED_NO;   // WORK_PATH
  locData.LocationUsages[2] = ATTACHED_NO;   // JNL_PATH
  locData.LocationUsages[3] = ATTACHED_NO;   // CHK_PATH
  locData.LocationUsages[4] = ATTACHED_NO;   // DMP_PATH

  try
  {
    ResetDisplay();
    CaPieInfoData* pPieInfo = m_pDlgFrame->GetPieInformation();
    pPieInfo->Cleanup();
    if (!Pie_Create(pPieInfo, nNodeHandle, &locData))
    {
        AfxMessageBox (IDS_E_LOCATION_SPACE, MB_ICONEXCLAMATION|MB_OK);
        pPieInfo->Cleanup();
    }
    m_pDlgFrame->UpdatePieChart();
    m_pDlgFrame->UpdateLegend();
  }
  catch (CMemoryException* e)
  {
      VDBA_OutOfMemoryMessage();
      e->Delete();
  }
  return 0L;
}
示例#2
0
BOOL CuDlgDomPropLocationSpace::OnInitDialog() 
{
	CDialog::OnInitDialog();
	CaPieChartCreationData crData;
	crData.m_bDrawAxis = FALSE;
	crData.m_bDBLocation = FALSE;
	crData.m_bUseLButtonDown = TRUE;
	crData.m_nLines = 2;
	crData.m_bShowPercentage = TRUE;
//	if (bPaleteAware)
//	{
//		crData.m_pfnCreatePalette = &IPMCreatePalette;
//	}

	try
	{
		CRect r;
		GetClientRect (r);
		m_pDlgFrame = new CfStatisticFrame(CfStatisticFrame::nTypePie);
		m_pDlgFrame->Create(this, r, &crData);
		CaPieInfoData* pPieInfo = m_pDlgFrame->GetPieInformation();
		pPieInfo->Cleanup();
	}
	catch (CMemoryException* e)
	{
		e->ReportError();
		e->Delete();
	}
	catch (...)
	{

	}
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
示例#3
0
void CuDlgDomPropTblPages::ShowPieChartCtrl(LPVOID lpData, BOOL bHashTable)
{
	ASSERT (lpData);
	if (!lpData)
		return;
	int i;
	CWnd* pWnd = NULL;
	INGRESPAGEINFO* pPageInfo = (INGRESPAGEINFO*)lpData;
	UINT nTabStaticID[] = 
	{
		IDC_STATIC_I1,IDC_STATIC_L1,IDC_STATIC_V1,
		IDC_STATIC_I2,IDC_STATIC_L2,IDC_STATIC_V2,
		IDC_STATIC_I3,IDC_STATIC_L3,IDC_STATIC_V3,
		IDC_STATIC_I4,IDC_STATIC_L4,IDC_STATIC_V4,
		IDC_STATIC_I5,IDC_STATIC_L5,IDC_STATIC_V5,
		IDC_STATIC_I6,IDC_STATIC_L6,IDC_STATIC_V6,
		IDC_STATIC_I7,IDC_STATIC_L7,IDC_STATIC_V7,
//		IDC_STATIC_I8,IDC_STATIC_L8,IDC_STATIC_V8,
		IDC_STATIC_I9,IDC_STATIC_L9,IDC_STATIC_V9,
		IDC_STATIC_L_TOTAL,
		IDC_STATIC_L_LONGEST_OC,
		IDC_STATIC_L_AVG_OC,
		IDC_STATIC_V_TOTAL,
		IDC_STATIC_V_LOC,
		IDC_STATIC_V_ALOC,
		0
	};

	if (bHashTable) 
		GetDlgItem(IDC_MFC_STATIC_PAGECOUNT)->SetWindowText(VDBA_MfcResourceString(IDS_I_HASH_TABLE_PAGE));//_T("Hash Table Page Counts")
	else
		GetDlgItem(IDC_MFC_STATIC_PAGECOUNT)->SetWindowText(VDBA_MfcResourceString(IDS_I_PAGE_COUNT));//_T("Page Counts")

	if (bHashTable)
	{
		char buffer[30];
		double tot1, tot2, tot3, tot4, v1, v2, v3,like0;
		long lothers;
		if (m_pPieCtrl && IsWindow (m_pPieCtrl->m_hWnd))
			m_pPieCtrl->ShowWindow (SW_HIDE);
		if (m_pPieCtrlHashTable && IsWindow (m_pPieCtrlHashTable->m_hWnd))
			m_pPieCtrlHashTable->ShowWindow (SW_SHOW);
		for (i=0; nTabStaticID[i] > 0; i++)
		{
			pWnd = GetDlgItem (nTabStaticID[i]);
			if (pWnd)
				pWnd->ShowWindow (SW_SHOW);
		}
		//
		// Stack Bars:
		CaBarInfoData* pData = m_pPieCtrlHashTable->GetBarInformation();
		pData->Cleanup();

		//
		// Define the set of stack lebels.

		// Data bucket:
		pData->AddBar (_T("S01"), m_crDataBucket); 
		// Data with overflow:
		pData->AddBar (_T("H01"), m_crDataWithOverflow, TRUE, RGB (255, 0, 0)); // special label
		// Empty bucket
		pData->AddBar (_T("S02"), m_crEmptyBucket);
		// Empty with overflow
		pData->AddBar (_T("H02"), m_crEmptyWithOverflow, TRUE, RGB (255, 0, 0)); // special label
		// Overflow:
		pData->AddBar (_T("S03") ,m_crOverflow);
		// Empty overflow:
		pData->AddBar (_T("S04") ,m_crEmptyOverflow);
		// Never used:
		pData->AddBar (_T("S05") ,m_crNeverUsed);
		// Freed:
//		pData->AddBar ("S06" ,m_crFreed);
		// Other:
		pData->AddBar (_T("S07") ,m_crOthers);

		//
		// Must Add the Bar's Capacity (Tptal for each bar):

		lothers =		pPageInfo->ltotal 
						- pPageInfo->lneverused
						-pPageInfo->lbuckets_no_ovf    - pPageInfo->lemptybuckets_no_ovf
						-pPageInfo->lbuck_with_ovf     - pPageInfo->lemptybuckets_with_ovf
						-pPageInfo->loverflow_not_empty- pPageInfo->loverflow_empty;
		if (lothers<0L)
			lothers=0L;

		tot1 = (double)(pPageInfo->lbuckets_no_ovf    + pPageInfo->lemptybuckets_no_ovf);
		tot2 = (double)(pPageInfo->lbuck_with_ovf     + pPageInfo->lemptybuckets_with_ovf);
		tot3 = (double)(pPageInfo->loverflow_not_empty+ pPageInfo->loverflow_empty);
		tot4 = (double)(lothers /*+pPageInfo->lfreed*/ + pPageInfo->lneverused);
		v1=tot1;
		if (tot2>v1)
			v1=tot2;
		if (tot3>v1)
			v1=tot3;
		if (tot4>v1)
			v1=tot4;
		if (v1<4.)
			v1=4.;
		like0=v1*.03;
		if (tot1<like0)
			tot1=like0;
		if (tot2<like0)
			tot2=like0;
		if (tot3<like0)
			tot3=like0;
		if (tot4<like0)
			tot4=like0;
		like0*=1.0001;



		pData->AddBarUnit (_T("B1:"), tot1 ); // First bar
		pData->AddBarUnit (_T("B2:"), tot2 ); // Second bar
		pData->AddBarUnit (_T("B3:"), tot3 ); // Third bar
		pData->AddBarUnit (_T("B4:"), tot4 ); // Fourth bar
		
		//
		// Add the Occupants (stacks) of the bars.
		// You should round the percentage to the integer, so that the
		// picture will be drawn correctly. The sum of percentages of all Stacks
		// must be equal to 100.

		if (tot1<=like0) {
			pData->AddOccupant (_T("B1:"), _T("S01"), 50.0);
			pData->AddOccupant (_T("B1:"), _T("S02"), 50.0);
		}
		else {
			v1 = 100.0 * (double)(pPageInfo->lbuckets_no_ovf) / tot1;
			v2 = 100.0 - v1;

			pData->AddOccupant (_T("B1:"), _T("S01"), v1);
			pData->AddOccupant (_T("B1:"), _T("S02"), v2);
		}
		
		if (tot2<=like0) {
			pData->AddOccupant (_T("B2:"), _T("H01"), 50.0);
			pData->AddOccupant (_T("B2:"), _T("H02"), 50.0);
		}
		else {
			v1 = 100.0 * (double)(pPageInfo->lbuck_with_ovf) / tot2;
			v2 = 100.0 - v1;
			pData->AddOccupant (_T("B2:"), _T("H01"), v1);
			pData->AddOccupant (_T("B2:"), _T("H02"), v2);

		}
		
		if (tot3<=like0) {
			pData->AddOccupant (_T("B3:"), _T("S03"), 50.0);
			pData->AddOccupant (_T("B3:"), _T("S04"), 50.0);
		}
		else {
			v1 = 100.0 * (double)(pPageInfo->loverflow_not_empty) / tot3;
			v2 = 100.0 - v1;
			pData->AddOccupant (_T("B3:"), _T("S03"), v1);
			pData->AddOccupant (_T("B3:"), _T("S04"), v2);
		}
		
		if (tot4<=like0) {
			pData->AddOccupant (_T("B4:"), _T("S07"), 50.0);
			//pData->AddOccupant (_T("B4:"), _T("S06"), 30.0);
			pData->AddOccupant (_T("B4:"), _T("S05"), 50.0);
		}
		else {
			v1 = 100.0 * (double)(lothers)           / tot4;
//			v2 = 100.0 * (double)(pPageInfo->lfreed) / tot4;
			v3 = 100.0 - v1 ; /*-v2;*/
			pData->AddOccupant (_T("B4:"), _T("S07"), v1);
//			pData->AddOccupant (_T("B4:"), _T("S06"), v2);
			pData->AddOccupant (_T("B4:"), _T("S05"), v3);
		}

		m_strDataBucket        = ltoa(pPageInfo->lbuckets_no_ovf        ,buffer,10);
		m_strEmptyBucket       = ltoa(pPageInfo->lemptybuckets_no_ovf   ,buffer,10);
		m_strDataWithOverflow  = ltoa(pPageInfo->lbuck_with_ovf         ,buffer,10);
		m_strEmptyWithOverflow = ltoa(pPageInfo->lemptybuckets_with_ovf ,buffer,10);
		m_strOverflow          = ltoa(pPageInfo->loverflow_not_empty    ,buffer,10);
		m_strEmptyOverflow     = ltoa(pPageInfo->loverflow_empty        ,buffer,10);
		m_strNeverUsed         = ltoa(pPageInfo->lneverused             ,buffer,10);
		m_strFree              = ltoa(pPageInfo->lfreed                 ,buffer,10);
		m_strOthers            = ltoa(lothers                           ,buffer,10);
		if (pPageInfo->llongest_ovf_chain<0L)
			m_strLongestOverflowChain.LoadString (IDS_NOT_AVAILABLE);//_T("N/A")
		else
			m_strLongestOverflowChain = ltoa(pPageInfo->llongest_ovf_chain  ,buffer,10);
		if ( pPageInfo->favg_ovf_chain<0.0)
			m_strAvgLengOverflowChain.LoadString (IDS_NOT_AVAILABLE);//_T("N/A")
		else {
			sprintf (buffer, _T("%.6g"), pPageInfo->favg_ovf_chain);
			m_strAvgLengOverflowChain = buffer;
		}
		m_strTotal =ltoa(pPageInfo->ltotal,buffer,10);
	}
	else
	{
		if (m_pPieCtrlHashTable && IsWindow (m_pPieCtrlHashTable->m_hWnd))
			m_pPieCtrlHashTable->ShowWindow (SW_HIDE);
		if (m_pPieCtrl && IsWindow (m_pPieCtrl->m_hWnd))
			m_pPieCtrl->ShowWindow (SW_SHOW);
		for (i=0; nTabStaticID[i] > 0; i++)
		{
			pWnd = GetDlgItem (nTabStaticID[i]);
			if (pWnd)
				pWnd->ShowWindow (SW_HIDE);
		}

		//
		// There is a BUG. already reported to FNN:
		// Sometime 'pPageInfo->ltotal' is less than the sum of
		// 'pPageInfo->linuse', 'pPageInfo->lfreed', ...
		double dPercent = 0.0;
		CString strTitle;
		CaPieInfoData* pData = m_pPieCtrl->GetPieInformation();
		pData->Cleanup();
		pData->SetCapacity ((double)pPageInfo->ltotal, _T(""));
		long l1 = pPageInfo->linuse - pPageInfo->loverflow;  // not overflow
		long l2 = pPageInfo->loverflow;                      // overflow
		long l3 = pPageInfo->lfreed;                         // freed
		long l4 = pPageInfo->lneverused;                     // neverused
		long lt = l1+l2+l3+l4;
		if (lt == 0L) // 
			lt=1L;
		ASSERT (lt == pPageInfo->ltotal);

		if (l1 > 0)  // not overflow
		{
			dPercent = ((double)l1 / (double) lt) * 100.00;
			pData->AddPie2 (VDBA_MfcResourceString(IDS_I_NOT_OVERFLOW), dPercent, RGB(0, 0, 192), (double)l1);//_T("Not Overflow")
		}
		else
			pData->AddLegend (VDBA_MfcResourceString(IDS_I_NOT_OVERFLOW), RGB(0, 0, 192)); //_T("Not Overflow")
		
		if (l2 > 0) // overflow
		{
			dPercent = ((double)l2 / (double) lt) * 100.00;
			pData->AddPie2 (VDBA_MfcResourceString(IDS_I_OVERFLOW), dPercent, RGB(255, 0, 0), (double)l2);//_T("Overflow")
		}
		else
			pData->AddLegend (VDBA_MfcResourceString(IDS_I_OVERFLOW), RGB(255, 0, 0));//_T("Overflow")
		
		if (l3 > 0) // freed
		{
			dPercent = ((double)l3 / (double) lt) * 100.00;
			pData->AddPie2 (VDBA_MfcResourceString(IDS_I_FREED), dPercent, RGB(0, 192, .0), (double)l3);//_T("Freed")
		}
		else
			pData->AddLegend (VDBA_MfcResourceString(IDS_I_FREED), RGB(0, 192, .0));//_T("Freed")
		
		if (l4 > 0) // freed
		{
			dPercent = ((double)l4 / (double) lt) * 100.00;
			pData->AddPie2 (VDBA_MfcResourceString(IDS_I_NEVER_USED), dPercent, RGB(255, 255, 0), (double)l4);//_T("Never Used")
		}
		else
			pData->AddLegend (VDBA_MfcResourceString(IDS_I_NEVER_USED), RGB(255, 255, 0));//_T("Never Used")
		
		
		strTitle.Format (VDBA_MfcResourceString(IDS_F_TOTAL), (l1+l2+l3+l4));//_T("Total = %d")
		pData->SetTitle(strTitle);
		m_pPieCtrl->UpdateLegend();
		m_pPieCtrl->UpdatePieChart();
	}
	UpdateData (FALSE);
}