Example #1
0
bool
LocationMonitorApp::OnAppInitializing(AppRegistry& appRegistry)
{
	// TODO:
	// Initialize App specific data, and add your initialization code here
	// The App's permanent data and context can be obtained from the appRegistry.
	//
	// If this method is successful, return true; otherwise, return false.
	// If this method returns false, the App will be terminated.

	LocationListener* pListener = null;
	pListener = new LocationListener();

	LocationCriteria criteria;
	criteria.SetAccuracy(LOC_ACCURACY_HUNDRED_METERS);

	LocationProvider* pLocProvider = new LocationProvider();
	pLocProvider->Construct(criteria, *pListener);

	//bool awake = true;
	//pLocProvider->KeepLocationUpdateAwake(awake);

	Coordinates coord;
	coord.Set(27.0, 125.0, 0.0); //result 	Set (double latitude, double longitude, double altitude)
	RegionId regionId;
	pLocProvider->AddMonitoringRegion(coord, 100, regionId);

	MockLocationListener* timer = new MockLocationListener();
	timer->StartApp();

	return true;
}
Example #2
0
bool
MapForm::MoveMarker(bool bMoved)
{
	bool bRet = _movedMarker;
	
	_movedMarker = bMoved;

	if (bMoved)
	{
		//Create Marker
		if (_pMovedMarker1 == null)
		{
			_pMovedMarker1 =  _pOverlay->MakeMarker();
			if (_pMovedMarker1 == null)
			{
				AppLog("Overlay::MakeMarker() has failed.");
			}
			else
			{
				Coordinates coord;
				coord.Set(51.501, -0.142 ,0); //backi
				_pMovedMarker1->SetCoordinates(coord);

				_pMap->AddMapOverlay(*_pMovedMarker1);
			}
		}

		if (_pMovedMarker2 == null)
		{
			_pMovedMarker2 =  _pOverlay->MakeMarker();
			if (_pMovedMarker2 == null)
			{
				AppLog("Overlay::MakeMarker() has failed.");
			}
			else
			{
				Coordinates coord;
				coord.Set(51.5033, -0.1197,0); //eye
				
				_pMovedMarker2->SetCoordinates(coord);
				_pMap->AddMapOverlay(*_pMovedMarker2);
			}
		}

		if (_pMovedMarker3 == null)
		{
			_pMovedMarker3 =  _pOverlay->MakeMarker();
			if (_pMovedMarker3 == null)
			{
				AppLog("Overlay::MakeMarker() has failed.");
			}
			else
			{
				Coordinates coord;
				coord.Set(51.500721983903,-0.124197006225586,0); //bigben
				
				_pMovedMarker3->SetCoordinates(coord);
				_pMap->AddMapOverlay(*_pMovedMarker3);
			}
		}
	}
	else
	{
		if (_pMovedMarker1 != null)
		{
			_pMap->RemoveMapOverlay(*_pMovedMarker1);

			delete _pMovedMarker1;
			_pMovedMarker1 = null;
		}

		if (_pMovedMarker2 != null)
		{
			_pMap->RemoveMapOverlay(*_pMovedMarker2);

			delete _pMovedMarker2;
			_pMovedMarker2 = null;
		}

		if (_pMovedMarker3 != null)
		{
			_pMap->RemoveMapOverlay(*_pMovedMarker3);

			delete _pMovedMarker3;
			_pMovedMarker3 = null;
		}
	}
	
	return bRet;
}
Example #3
0
bool
MapForm::InitializeMapService(void)
{
	result r = E_SUCCESS;

	// If you want to develop your own application with the location services.
	// Some service providers may need license key for displaying a map. refer to the developer guide for details.
	// Client name "guest" is invalid license.
	const String extraInfo =  L"ClientName=samsung-jc;ClientPassword=4xndosys;HostUrl=http://ws.decarta.com/openls/openls";

	Coordinates center;
	Rectangle clientRect = GetClientAreaBounds();

	// create map service provider and initialize map
	_pMapSvcProvider = static_cast<IMapServiceProvider*>(ProviderManager::ConnectToServiceProviderN(L"", LOC_SVC_PROVIDER_TYPE_MAP, extraInfo));
	if (null == _pMapSvcProvider)
	{
		AppLog( "ProviderManager::ConnectToServiceProviderN() has failed.");
		goto CATCH;
	}

	_pMap = new Map();
	if (null == _pMap)
	{
		AppLog( "MapForm::allocate new memory for map.");
		goto CATCH;
	}

	_pMap->Construct(Rectangle(0,0, clientRect.width, clientRect.height), *_pMapSvcProvider,true);
	if (IsFailed(r))
	{
		AppLog( "MapForm::fail to contruct map.");
		goto CATCH;
	}

	//Set the Prefetch Margin
	_pMap->SetPrefetchMargin(200,100);

	center.Set(51.499339, -0.126858, 0);
	_pMap->SetCenter(center, false);
	_pMap->SetZoomLevel(17.0, false);

	//This is used to make an application listen infowindow event.
	_pMap->AddMapInfoWindowEventListener(*this);

	_pMap->AddTouchEventListener(*this);

	AddControl(*_pMap);

	//Create overlay factory class
	_pOverlay = new Overlay(_pMap);

	// create geocoding service provider
	_pGeocodingSvcProvider = static_cast<IGeocodingServiceProvider*>(ProviderManager::ConnectToServiceProviderN(L"", LOC_SVC_PROVIDER_TYPE_GEOCODING, extraInfo));

	return true;

CATCH:

	delete _pMap;
	_pMap = null;

	delete _pMapSvcProvider;
	_pMapSvcProvider = null;
	return false;
}