Exemple #1
0
        public void newPosition(GpsLocation gpsLocation)
        {
            // when gps location isn't known (invalid) skip processing
            if (!gpsLocation.isValid())
            {
                return;
            }
            // when delta location is to small skip processing
            if (!this.gpsDataAnalyzer.isLocationSignificant(gpsLocation))
            {
                return;
            }
            // add location to gps data analyzer
            this.gpsDataAnalyzer.addGpsLocation(gpsLocation);
            // set current gps location
            this.currentGpsLocation = gpsLocation;
            // update current map package
            retrieveCurrentMapPkg();
            // when there is no map for location stop processing
            if (this.currentMapPkg == null)
            {
                return;
            }
            // update map view builder
            this.mapViewBuilder.update(currentGpsLocation, currentMapPkg, currentZoom);
            // update current map view or create new one if current doesn't match gps location
            if (mapViewBuilder.getResult() != null &&
                mapViewBuilder.getResult().isValidForGpsLocation(this.currentGpsLocation))
            {
                // when current map view match gps location update it
                mapViewBuilder.adjustCurrent();
            }
            else
            {
                // create new map view when current doesn't match gps location
                mapViewBuilder.createNew();
                if (this.loadingEventMsg != "")
                {
                    mapLoaded();
                }
                // find current named area for pois by current gps location
                findCurrentArea();
                // find and set pois on newly created map view
                mapViewBuilder.loadPois();
            }
            // update current map view estimated course
            mapViewBuilder.loadCourse();
            // update current map view target
            mapViewBuilder.loadTarget();

            if (mapViewBuilder.getResult() != null)
            {
                // display map view
                this.mapDisplayer.displayView(mapViewBuilder.getResult());
            }
        }