PinOverModelExample::PinOverModelExample(
    Eegeo::Modules::Core::RenderingModule& renderingModule,
    Eegeo::Modules::IPlatformAbstractionModule& platformAbstractionModule,
    Eegeo::Modules::Map::MapModule& mapModule,
    Eegeo::Rendering::AsyncTexturing::IAsyncTextureRequestor& textureRequestor,
    Eegeo::Lighting::GlobalFogging& fogging,
    Eegeo::Rendering::Materials::NullMaterialFactory& nullMaterialFactory,
    Eegeo::Camera::GlobeCamera::GlobeCameraController* pCameraController,
    Eegeo::Camera::GlobeCamera::GlobeCameraTouchController& cameraTouchController,
    const Eegeo::Rendering::ScreenProperties& initialScreenProperties
)
	: GlobeCameraExampleBase(pCameraController, cameraTouchController)
    , m_pin0UserData("Pin Zero(0) User Data")
	,m_pPin0(NULL)
	,m_fileIO(platformAbstractionModule.GetFileIO())
	,m_textureRequestor(textureRequestor)
	,m_pModel(NULL)
	,m_globalFogging(fogging)
	,m_renderableFilters(renderingModule.GetRenderableFilters())
	,m_nullMaterialFactory(nullMaterialFactory)
    ,m_pNullMaterial(NULL)
{
    Eegeo::Helpers::ITextureFileLoader& textureLoader = platformAbstractionModule.GetTextureFileLoader();

	textureLoader.LoadTexture(m_pinIconsTexture, "pin_over_model_example/PinIconTexturePage.png", true);
	Eegeo_ASSERT(m_pinIconsTexture.textureId != 0);

	// This example uses a texture page containing 2 x 2 icons.
	// Increase the following number to use a texture page containing more icons
	// (e.g. 3 for a page containing 3 x 3 icons)
	int numberOfTilesAlongEachAxisOfTexturePage = 2;
	m_pPinIconsTexturePageLayout = Eegeo_NEW(Eegeo::Rendering::RegularTexturePageLayout)(numberOfTilesAlongEachAxisOfTexturePage);

	// The following values specify the size and shape of the Pins within the 3D world.
	int spriteWidthInMetres = 64;
	int spriteHeightInMetres = 64;

	// N.B. The implementation for PinModule is given in PinModule.h as a guide for Apps that
	// require an alternate configuration of the various Pin related components.
    m_pPinsModule = Eegeo::Pins::PinsModule::Create(
                                    renderingModule,
                                    platformAbstractionModule,
                                    mapModule,
                                    m_pinIconsTexture.textureId,
                                    *m_pPinIconsTexturePageLayout,
                                    Eegeo::Rendering::LayerIds::PlaceNames,
                                    spriteWidthInMetres,
                                    spriteHeightInMetres,
                                    initialScreenProperties,
                                    false);

	CreateExamplePins();
}
PinsExample::PinsExample(
    Eegeo::Modules::Core::RenderingModule& renderingModule,
    Eegeo::Modules::IPlatformAbstractionModule& platformAbstractionModule,
    Eegeo::Modules::Map::MapModule& mapModule,
    Eegeo::Rendering::EnvironmentFlatteningService& environmentFlatteningService,
    Eegeo::Camera::GlobeCamera::GlobeCameraController* pCameraController,
    Eegeo::Camera::GlobeCamera::GlobeCameraTouchController& cameraTouchController,
    const Eegeo::Rendering::ScreenProperties& initialScreenProperties
)
	: GlobeCameraExampleBase(pCameraController, cameraTouchController)
    , m_pin0UserData("Pin Zero(0) User Data")
	, m_pin1UserData("Pin One(1) User Data")
	, m_pin2UserData("Pin Two(2) User Data")
	, m_pin3UserData("Pin Three(3) User Data")
	, m_addRemoveTimer(0.0f)
	, m_pPin0(NULL)
{
    Eegeo::Helpers::ITextureFileLoader& textureLoader = platformAbstractionModule.GetTextureFileLoader();
    
	textureLoader.LoadTexture(m_pinIconsTexture, "pins_example/PinIconTexturePage.png", true);
	Eegeo_ASSERT(m_pinIconsTexture.textureId != 0);

	// This example uses a texture page containing 2 x 2 icons.
	// Increase the following number to use a texture page containing more icons
	// (e.g. 3 for a page containing 3 x 3 icons)
	int numberOfTilesAlongEachAxisOfTexturePage = 2;
	m_pPinIconsTexturePageLayout = Eegeo_NEW(Eegeo::Rendering::RegularTexturePageLayout)(numberOfTilesAlongEachAxisOfTexturePage);

	// The following values specify the size and shape of the Pins within the 3D world.
	int spriteWidthInMetres = 64;
	int spriteHeightInMetres = 64;

	// N.B. The implementation for PinModule is given in PinModule.h as a guide for Apps that
	// require an alternate configuration of the various Pin related components.
    m_pPinsModule = Eegeo::Pins::PinsModule::Create(
        renderingModule,
        platformAbstractionModule,
        mapModule,
        m_pinIconsTexture.textureId,
        *m_pPinIconsTexturePageLayout,
        Eegeo::Rendering::LayerIds::PlaceNames,
        spriteWidthInMetres,
        spriteHeightInMetres,
        initialScreenProperties,
        false);

	CreateExamplePins();
}
            MyPinsModule::MyPinsModule(WorldPins::SdkModel::IWorldPinsService& worldPinsService,
                                       Eegeo::Modules::IPlatformAbstractionModule& platformAbstractions,
                                       PersistentSettings::IPersistentSettingsModel& persistentSettings,
                                       Menu::View::IMenuViewModel& menuViewModel,
                                       ExampleAppMessaging::TMessageBus& messageBus,
                                       ExampleAppMessaging::TSdkModelDomainEventBus& sdkModelDomainEventBus,
                                       CameraTransitions::SdkModel::ICameraTransitionController& cameraTransitionController,
                                       CategorySearch::View::ICategorySearchRepository& categorySearchRepository,
                                       Search::SdkModel::MyPins::IMyPinsSearchResultRefreshService& myPinsSearchResultRefreshService,
                                       Metrics::IMetricsService& metricsService,
                                       const std::string& myPinsWebServiceUrl,
                                       const std::string& myPinsWebServiceAuthToken,
                                       const Menu::View::IMenuReactionModel& menuReaction,
                                       Menu::View::IMenuIgnoredReactionModel& ignoredMenuReaction)
                : m_pMyPinsRepository(NULL)
                , m_pMyPinsFileIO(NULL)
                , m_pMyPinsService(NULL)
                , m_pMyPinsRepositoryObserver(NULL)
                , m_pMenuModel(NULL)
                , m_pMenuOptionsModel(NULL)
            {
                m_pMenuModel = Eegeo_NEW(Menu::View::SortedMenuModel)(Menu::View::LexicographicalNameCompare);
                m_pMenuOptionsModel = Eegeo_NEW(Menu::View::MenuOptionsModel)(*m_pMenuModel);

                m_pMyPinsRepository = Eegeo_NEW(MyPinsRepository)();
                
                m_pMyPinsWebService = Eegeo_NEW(MyPinsWebService)(myPinsWebServiceUrl,
                                                                  myPinsWebServiceAuthToken,
                                                                  platformAbstractions.GetWebLoadRequestFactory(),
                                                                  platformAbstractions.GetFileIO());
                
                m_pMyPinBoundObjectRepository = Eegeo_NEW(MyPinBoundObjectRepository);
                
                m_pMyPinBoundObjectFactory = Eegeo_NEW(MyPinBoundObjectFactory)(messageBus,
                                                                                sdkModelDomainEventBus,
                                                                                categorySearchRepository,
                                                                                myPinsSearchResultRefreshService,
                                                                                *m_pMyPinsWebService);

                m_pMyPinsSelectionHandlerFactory = Eegeo_NEW(MyPinSelectionHandlerFactory)(*m_pMyPinBoundObjectRepository, metricsService);
                
                m_pMyPinVisibilityStateChangedHandlerFactory = Eegeo_NEW(MyPinVisibilityStateChangedHandlerFactory)(*m_pMyPinBoundObjectRepository);

                m_pMyPinsFileIO = Eegeo_NEW(MyPinsFileIO)(platformAbstractions.GetFileIO(),
                                                          persistentSettings,
                                                          *m_pMyPinBoundObjectFactory,
                                                          *m_pMyPinBoundObjectRepository);
                
                m_pMyPinsRepositoryObserver = Eegeo_NEW(MyPinsRepositoryObserver)(*m_pMyPinsRepository,
                                                                                  *m_pMyPinBoundObjectRepository,
                                                                                  *m_pMyPinsFileIO,
                                                                                  messageBus);
                
                m_pMyPinAddedToMenuObserver = Eegeo_NEW(View::MyPinAddedToMenuObserver)(menuViewModel,
                                                                                        *m_pMenuOptionsModel,
                                                                                        messageBus,
                                                                                        menuReaction,
                                                                                        ignoredMenuReaction);
                
                m_pMyPinRemovedFromMenuObserver = Eegeo_NEW(View::MyPinRemovedFromMenuObserver)(*m_pMenuOptionsModel,
                                                  messageBus);

                m_pMyPinsService = Eegeo_NEW(MyPinsService)(*m_pMyPinsRepository,
                                                            *m_pMyPinsFileIO,
                                                            *m_pMyPinsSelectionHandlerFactory,
                                                            *m_pMyPinVisibilityStateChangedHandlerFactory,
                                                            *m_pMyPinBoundObjectFactory,
                                                            *m_pMyPinBoundObjectRepository,
                                                            worldPinsService);
                
                m_pMyPinSelectedMessageHandler = Eegeo_NEW(MyPinSelectedMessageHandler)(cameraTransitionController,
                                                 messageBus);

            }