void WorldPinsService::GetPinEcefAndScreenLocations(const WorldPinItemModel& pinItemModel,
                    Eegeo::dv3& ecefLocation,
                    Eegeo::v2& screenLocation) const
            {
                Eegeo::Pins::Pin* pPin = m_pinRepository.GetPinById(pinItemModel.Id());
                Eegeo_ASSERT(pPin != NULL);

                ecefLocation = m_environmentFlatteningService.GetScaledPointEcef(pPin->GetEcefPosition(),
                               m_environmentFlatteningService.GetCurrentScale());

                Eegeo::Geometry::Bounds2D outScreenBounds = Eegeo::Geometry::Bounds2D::Empty();
                m_pinController.GetScreenBoundsForPin(*pPin, outScreenBounds);
                screenLocation = outScreenBounds.center();
            }
    void PinsWithAttachedJavaUIExample::Draw()
    {
    	//lazily create the pin button when we start drawing so it is not displayed on top of the loading screen
		if(m_world.Initialising()) {
			return;
		}
		else if(m_buttonID == 0) {
			CreateJavaUIButton();
		}

		AndroidSafeNativeThreadAttachment attached(m_nativeState);
		JNIEnv* env = attached.envForThread;

		Eegeo_ASSERT(m_buttonID != 0);

		// Get the pin position on the screen
		Eegeo::Pins::PinRepository& pinRepo = m_pPinsModule->GetRepository();
		Eegeo::Pins::Pin* pPin = pinRepo.GetPinAtIndex(0);
		Eegeo_ASSERT(pPin != NULL);

		Eegeo::Pins::PinController& pinController = m_pPinsModule->GetController();
		Eegeo::Geometry::Bounds2D pinScreenBounds = Eegeo::Geometry::Bounds2D::Empty();
		pinController.GetScreenBoundsForPin(*pPin, pinScreenBounds);
		Eegeo::v2 screenPosition = pinScreenBounds.center();

		// now update the java ui to be in sync with the pin, positioned above it on screen.
		// the pixel nudging is hard-coded for simplicity; you should probably do something more sophisticated
		// (based on the size of your pin & java ui assets)
		const int buttonOffsetPixelsX = 40;
		const int buttonOffsetPixelsY = 110;

		env->CallVoidMethod(
			m_hudPinController,
			m_updateLocationMethodId,
			m_buttonID,
			screenPosition.GetX() - buttonOffsetPixelsX,
			screenPosition.GetY() - buttonOffsetPixelsY
		);
    }