Esempio n. 1
0
        private double GetSelectedValueFromWaypoint(WayPoint wp, DrawCategory drawCategory)
        {
            double retVal = 0;
            switch (drawCategory)
            {
                case DrawCategory.DistanceFromStart:
                    retVal = wp.GetDistanceFromStart().GetLength(wp.Latitude);
                    break;
                case DrawCategory.Elevation:
                    retVal = Convert.ToDouble(wp.Elevation);
                    break;
                case DrawCategory.Latitude:
                    retVal = Convert.ToDouble(wp.Latitude);
                    break;
                case DrawCategory.LatitudeKm:
                    retVal = wp.LatitudeKm;
                    break;
                case DrawCategory.Longitude:
                    retVal = Convert.ToDouble(wp.Longitude);
                    break;
                case DrawCategory.LongitudeKm:
                    retVal = wp.LongitudeKm;
                    break;
                case DrawCategory.Speed:
                    retVal = wp.GetSpeed();
                    break;
                case DrawCategory.SpeedvectorEast:
                    retVal = wp.GetSpeedVector().DeltaLongitude;
                    break;
                case DrawCategory.SpeedvectorElevation:
                    retVal = wp.GetSpeedVector().DeltaElevation;
                    break;
                case DrawCategory.SpeedvectorNorth:
                    retVal = wp.GetSpeedVector().DeltaLatitude;
                    break;
                case DrawCategory.Time:
                    retVal = wp.GetTimeSinceStartSeconds();
                    break;
                case DrawCategory.TrackDistanceFromStart:
                    retVal = wp.GetTrackDistanceFromStart();
                    break;
                case DrawCategory.DirectionEast:
                    retVal = wp.GetDirectionVector().DeltaLongitude;
                    break;
                case DrawCategory.DirectionNorth:
                    retVal = wp.GetDirectionVector().DeltaLatitude;
                    break;
                case DrawCategory.DirectionVertical:
                    retVal = wp.GetDirectionVector().DeltaElevation;
                    break;
                case DrawCategory.PercrentAscent:
                    retVal = wp.GetAscent();
                    break;
                case DrawCategory.Heartrate:
                    retVal = wp.Heartreate;
                    break;
                case DrawCategory.Cadence:
                    retVal = wp.Cadence;
                    break;
                case DrawCategory.Depth:
                    retVal = wp.Depth;
                    break;
                case DrawCategory.Temperature:
                    retVal = wp.Temperature;
                    break;
                case DrawCategory.Watertemperature:
                    retVal = wp.WaterTemperature;
                    break;
                default:
                    //GPX_TrackControl_GetSelectedValueFromWaypoint0=Unknown category for drawing
                    throw new ArgumentException(ResourceManager.GetString("GPX_TrackControl_GetSelectedValueFromWaypoint0"));
            }

            return retVal;
        }
Esempio n. 2
0
        public TrackControl()
        {
            InitializeComponent();

            if (LicenseManager.UsageMode == LicenseUsageMode.Designtime)
                return;

            _Bitmap = null;
            _Zoom = 1;
            _XCategory = DrawCategory.LongitudeKm;
            _YCategory = DrawCategory.LatitudeKm;
            _UseEqualScale = false;
            _Selecting = false;
            _DrawWaypoints = false;
            _DrawTrackLine = false;
            _ShowAllPointsOfSegment = true;
            _IndexOfFirstPointShown = 1;
            _IndexOfLastPointShown = 100000;

            //For maps
            {
                timer1 = new Timer(this.components);
                timer1.Interval = 2500;
                timer1.Tick += new System.EventHandler(this.timer1_Tick);

                GMap.NET.CacheProviders.FilePureImageCache imageCache = new GMap.NET.CacheProviders.FilePureImageCache();
                string cacheLocation = Defaults.GMapsFileCacheLocation;
                imageCache.CacheLocation = cacheLocation;
                GMap.NET.Internals.Cache.Instance.ImageCache = imageCache;

                GMap.NET.GMaps.Instance.ImageProxy = new GMap.NET.WindowsForms.WindowsFormsImageProxy();
                GMap.NET.GMaps.Instance.UseGeocoderCache = true;
                GMap.NET.GMaps.Instance.UseMemoryCache = true;
                GMap.NET.GMaps.Instance.UsePlacemarkCache = true;

                _Core = GMap.NET.Internals.Core.Instance;
                _Core.MapType = GMap.NET.MapType.GoogleSatellite;
                _Core.Projection = new GMap.NET.Projections.MercatorProjection();

                _Core.OnNeedInvalidation += new GMap.NET.NeedInvalidation(Core_OnNeedInvalidation);
                _Core.StartSystem();
            }
        }