void ReadHeadingExample::Update(float dt) { double degrees; if(m_locationService.GetHeadingDegrees(degrees)) { EXAMPLE_LOG("Heading: %f\n", degrees); Eegeo::dv3 ecefCenter = ConvertLatLongAltitudeToEcef(Eegeo::Space::LatLongAltitude::FromDegrees(37.78469,-122.40143, 200)); Eegeo::Space::EcefTangentBasis tangentBasis; Eegeo::Camera::CameraHelpers::EcefTangentBasisFromPointAndHeading(ecefCenter, static_cast<float>(degrees), tangentBasis); const float axesSize = 150.0f; m_debugRenderer.DrawAxes(ecefCenter, tangentBasis.GetRight()*axesSize, tangentBasis.GetUp()*axesSize, tangentBasis.GetForward()*axesSize); } else { EXAMPLE_LOG("Unable to read heading from device.\n"); } }
void ControlCityThemeExample::FindThemeByPointInPolygon() { Eegeo::Space::LatLong osaka = Eegeo::Space::LatLong::FromDegrees(34.700131,135.478884); Eegeo::v2 osakav2(static_cast<float>(osaka.GetLatitudeInDegrees()), static_cast<float>(osaka.GetLongitudeInDegrees())); // enumerate all of the themes in the theme repository int numberOfThemes = m_themeRepository.GetNumberOfThemes(); for (int i=0; i<numberOfThemes; ++i) { const Eegeo::Resources::CityThemes::CityThemeData& themeData = m_themeRepository.GetCityThemeAt(i); if (themeData.PolygonBounds.size() > 0) // there are points in the bounding polygon { std::vector<Eegeo::v2> polygon; VectorLatLonToV2(themeData.PolygonBounds, polygon); if (PointInPolygon(polygon, osakav2)) { EXAMPLE_LOG("This theme contains the Osaka point: %s\n", themeData.Name.c_str()); return; } } } EXAMPLE_LOG("No theme found that contains the Osaka point\n"); }
void RouteSimulationExample::Update(float dt) { //Defer initialisation until the loading state is over. if(!m_initialised) { return; } Eegeo::Camera::RenderCamera renderCamera(m_usingFollowCamera ? m_pRouteSessionFollowCameraController->GetRenderCamera() : GetGlobeCameraController().GetRenderCamera()); m_pViewBindingForCycleSession->Update(); m_pViewBindingForOscillatingSession->Update(); m_pViewBindingForCameraSession->Update(); //The route session for which we want to project a position to (in this case, the ecef interest //point) should be updated giving it the latest position. Eegeo::Camera::CameraState cameraState(GetCurrentCameraState()); const Eegeo::dv3& ecefPositionToProjectToRoute = cameraState.InterestPointEcef(); m_pSessionCamera->SetCurrentPositionSnappedToRoute(ecefPositionToProjectToRoute); //For the session which should just cycle the route forever, when it has completed simply end //the session and restart playback from the beginning. if(m_pSessionCycle->IsRouteCompleted()) { m_pSessionCycle->EndPlayback(); m_pSessionCycle->StartPlaybackFromBeginning(); } //For the session which should oscillate, when the route is finished we change the playback direction //and unpause the session (such that it restarts from where it left off), and also demonstrate that //we can change playback speed by selecting a random speed multiplier. This multiplier applies to the //link speed (such that it is like a 'fast-forward' function). If we wanted to, we could also override //the playback speed such that the link speed is ignored by calling the UseCustomSpeedValue method. if(m_pSessionAlternatingSpeedChanger->IsRouteCompleted()) { m_pSessionAlternatingSpeedChanger->TogglePlaybackDirection(); m_pSessionAlternatingSpeedChanger->Unpause(); m_linkSpeedMultiplier = 0.5f + ((rand() % 200)/100.f); m_pSessionAlternatingSpeedChanger->UseLinkSpeedValueWithMultiplier(m_linkSpeedMultiplier); } EXAMPLE_LOG("%f metres from start of route. %f percent.\n", m_pSessionAlternatingSpeedChanger->GetDistanceFromStartInMetres(),(m_pSessionAlternatingSpeedChanger->GetDistanceFromStartInMetres() / m_pRoute->GetLength())*100.0f) ; }
void TourService::SetActiveTourState(int activeStateIndex) { Eegeo_ASSERT(m_hasActiveTour); Eegeo_ASSERT(activeStateIndex < m_activeTourModel.StateCount()); EXAMPLE_LOG("SDK: Active tour state index: %d, name: %s\n", activeStateIndex, m_activeTourModel.States()[activeStateIndex].Headline().c_str()); if(m_activeTourState != activeStateIndex) { std::stringstream ss; ss << m_activeTourState; m_metricsService.SetEvent(TourMetricsPrefix + m_activeTourModel.Name(), TourCardExitedKey, ss.str()); m_activeTourState = activeStateIndex; m_pActiveTourStateMachine->ChangeToState(activeStateIndex); ss.clear(); ss << m_activeTourState; m_metricsService.SetEvent(TourMetricsPrefix + m_activeTourModel.Name(), TourCardEnteredKey, ss.str()); } }
// This method does the following: // 1. Disables ICityThemesUpdater - so the App is in sole control of what Theme is active // 2. Sets "SummerNewYork" as the current Theme. void ControlCityThemeExample::ChangeTheme() { const std::string themeToSelect = "SummerNewYork"; EXAMPLE_LOG("Starting City Theme Control Example\n"); EXAMPLE_LOG("Disabling ICityThemesUpdater control over theme selection\n"); m_themeUpdater.SetEnabled(false); const bool enabled = m_themeUpdater.GetEnabled(); EXAMPLE_LOG("ICityThemesUpdater control over theme selection: %d\n", enabled); EXAMPLE_LOG("Obtaining %s ThemeData\n", themeToSelect.c_str()); const Eegeo::Resources::CityThemes::CityThemeData& themeDataToSelect = *m_themeRepository.GetThemeDataByName(themeToSelect); EXAMPLE_LOG("Setting %s Theme\n", themeToSelect.c_str()); m_themeService.SetSpecificTheme(themeDataToSelect); EXAMPLE_LOG("%s Theme will now be downloaded and applied asynchronously. It will remain active until SetSpecificTheme is called again\n", themeToSelect.c_str()); }
void PinsWithAttachedJavaUIExample::Start() { EXAMPLE_LOG("PinsWithAttachedJavaUIExample::Start()"); }