STDMETHODIMP ConnSolverPropPage::QueryObject(VARIANT theObject) { // Check if we have a marker symbol // If we do, apply the setting from the page. CComVariant vObject(theObject); if (vObject.vt != VT_UNKNOWN) return E_UNEXPECTED; // Try and QI to IConnectivitySolver IConnectivitySolverPtr ipSolver(vObject.punkVal); if (ipSolver != 0) { // Set properties of the solver object LRESULT checkState = ::SendMessage(m_hDisconnected, BM_GETCHECK, 0, 0); outputConnectivityType connectivityOutput = (checkState == BST_CHECKED) ? outputDisconnectedLines : outputConnectedLines; ipSolver->put_OutputConnectivity(connectivityOutput); LRESULT selectedIndex = ::SendMessage(m_hOutputShape, CB_GETCURSEL, 0, 0); switch(selectedIndex) { case 0: { ipSolver->put_OutputLines(esriNAOutputLineNone); break; } case 1: { ipSolver->put_OutputLines(esriNAOutputLineTrueShape); break; } } } return S_OK; }
STDMETHODIMP EvcSolverPropPage::QueryObject(VARIANT theObject) { // Check if we have a marker symbol // If we do, apply the setting from the page. ATL::CComVariant vObject(theObject); if (vObject.vt != VT_UNKNOWN) return E_UNEXPECTED; // Try and QI to IEvcSolver IEvcSolverPtr ipSolver(vObject.punkVal); LRESULT size; if (ipSolver) { // save data from drop boxes LRESULT selectedIndex = ::SendMessage(m_hCapCombo, CB_GETCURSEL, NULL, NULL); if (selectedIndex > -1) ipSolver->put_CapacityAttribute((size_t)selectedIndex); selectedIndex = ::SendMessage(m_hCostCombo, CB_GETCURSEL, NULL, NULL); if (selectedIndex > -1) ipSolver->put_CostAttribute((size_t)selectedIndex); selectedIndex = ::SendMessage(m_hComboMethod, CB_GETCURSEL, NULL, NULL); if (selectedIndex > -1) ipSolver->put_SolverMethod((EvcSolverMethod)selectedIndex); selectedIndex = ::SendMessage(m_hComboTrafficModel, CB_GETCURSEL, NULL, NULL); if (selectedIndex > -1) ipSolver->put_TrafficModel((EvcTrafficModel)selectedIndex); selectedIndex = ::SendMessage(m_hCmbFlockProfile, CB_GETCURSEL, NULL, NULL); if (selectedIndex > -1) ipSolver->put_FlockingProfile((FLOCK_PROFILE)selectedIndex); selectedIndex = ::SendMessage(m_hCmbCarmaSort, CB_GETCURSEL, NULL, NULL); if (selectedIndex > -1) ipSolver->put_CARMASortSetting((CARMASort)selectedIndex); selectedIndex = ::SendMessage(m_hcmbEvcOptions, CB_GETCURSEL, NULL, NULL); if (selectedIndex > -1) ipSolver->put_EvacueeGroupingOption((EvacueeGrouping)selectedIndex); selectedIndex = ::SendMessage(m_hcmbdynModeOptions, CB_GETCURSEL, NULL, NULL); if (selectedIndex > -1) ipSolver->put_DynamicCASPEROption((DynamicMode)selectedIndex); if ((INASolverSettingsPtr)m_ipEvcSolver) { selectedIndex = ::SendMessage(m_hUTurnCombo, CB_GETCURSEL, NULL, NULL); if (selectedIndex > -1) ((INASolverSettingsPtr)(m_ipEvcSolver))->put_RestrictUTurns((esriNetworkForwardStarBacktrack)selectedIndex); } // flags selectedIndex = ::SendMessage(m_hThreeGenCARMA, BM_GETCHECK, NULL, NULL); if (selectedIndex == BST_CHECKED) ipSolver->put_ThreeGenCARMA(VARIANT_TRUE); else ipSolver->put_ThreeGenCARMA(VARIANT_FALSE); selectedIndex = ::SendMessage(m_hEdgeStat, BM_GETCHECK, NULL, NULL); if (selectedIndex == BST_CHECKED) ipSolver->put_ExportEdgeStat(VARIANT_TRUE); else ipSolver->put_ExportEdgeStat(VARIANT_FALSE); selectedIndex = ::SendMessage(m_hCheckFlock, BM_GETCHECK, NULL, NULL); if (selectedIndex == BST_CHECKED) ipSolver->put_FlockingEnabled(VARIANT_TRUE); else ipSolver->put_FlockingEnabled(VARIANT_FALSE); selectedIndex = ::SendMessage(m_hCheckShareCap, BM_GETCHECK, NULL, NULL); if (selectedIndex == BST_CHECKED) ipSolver->put_TwoWayShareCapacity(VARIANT_TRUE); else ipSolver->put_TwoWayShareCapacity(VARIANT_FALSE); // critical density per capacity BSTR critical; size = ::SendMessage(m_hEditCritical, WM_GETTEXTLENGTH, NULL, NULL); critical = new DEBUG_NEW_PLACEMENT WCHAR[size + 1]; ::SendMessage(m_hEditCritical, WM_GETTEXT, size + 1, (LPARAM)critical); ipSolver->put_CriticalDensPerCap(critical); delete [] critical; // init delay cost per population BSTR delay; size = ::SendMessage(m_hEditInitCost, WM_GETTEXTLENGTH, NULL, NULL); delay = new DEBUG_NEW_PLACEMENT WCHAR[size + 1]; ::SendMessage(m_hEditInitCost, WM_GETTEXT, size + 1, (LPARAM)delay); ipSolver->put_InitDelayCostPerPop(delay); delete [] delay; // CARMA ratio BSTR carma; size = ::SendMessage(m_heditCARMA, WM_GETTEXTLENGTH, NULL, NULL); carma = new DEBUG_NEW_PLACEMENT WCHAR[size + 1]; ::SendMessage(m_heditCARMA, WM_GETTEXT, size + 1, (LPARAM)carma); ipSolver->put_CARMAPerformanceRatio(carma); delete [] carma; // iterative ratio BSTR iterative; size = ::SendMessage(m_heditIterative, WM_GETTEXTLENGTH, NULL, NULL); iterative = new DEBUG_NEW_PLACEMENT WCHAR[size + 1]; ::SendMessage(m_heditIterative, WM_GETTEXT, size + 1, (LPARAM)iterative); ipSolver->put_IterativeRatio(iterative); delete[] iterative; // selfish ratio BSTR selfish; size = ::SendMessage(m_heditSelfish, WM_GETTEXTLENGTH, NULL, NULL); selfish = new DEBUG_NEW_PLACEMENT WCHAR[size + 1]; ::SendMessage(m_heditSelfish, WM_GETTEXT, size + 1, (LPARAM)selfish); ipSolver->put_SelfishRatio(selfish); delete[] selfish; // saturation density per capacity BSTR sat; size = ::SendMessage(m_hEditSat, WM_GETTEXTLENGTH, NULL, NULL); sat = new DEBUG_NEW_PLACEMENT WCHAR[size + 1]; ::SendMessage(m_hEditSat, WM_GETTEXT, size + 1, (LPARAM)sat); ipSolver->put_SaturationPerCap(sat); delete [] sat; // cost per zone density BSTR density; size = ::SendMessage(m_hEditDensity, WM_GETTEXTLENGTH, NULL, NULL); density = new DEBUG_NEW_PLACEMENT WCHAR[size + 1]; ::SendMessage(m_hEditDensity, WM_GETTEXT, size + 1, (LPARAM)density); ipSolver->put_CostPerZoneDensity(density); delete [] density; // flock snap interval BSTR flock; size = ::SendMessage(m_hEditSnapFlock, WM_GETTEXTLENGTH, NULL, NULL); flock = new DEBUG_NEW_PLACEMENT WCHAR[size + 1]; ::SendMessage(m_hEditSnapFlock, WM_GETTEXT, size + 1, (LPARAM)flock); ipSolver->put_FlockingSnapInterval(flock); delete [] flock; // flock simulation interval BSTR simul; size = ::SendMessage(m_hEditSimulationFlock, WM_GETTEXTLENGTH, NULL, NULL); simul = new DEBUG_NEW_PLACEMENT WCHAR[size + 1]; ::SendMessage(m_hEditSimulationFlock, WM_GETTEXT, size + 1, (LPARAM)simul); ipSolver->put_FlockingSimulationInterval(simul); delete [] simul; } return S_OK; }