Exemple #1
0
        public static string LiveObjectTypeToString(LiveObjectTypes type)
        {
//			return EnumDescription.getDescription(type);		-- obfuscator breaks this code

            switch (type)
            {
            default:
            case LiveObjectTypes.LiveObjectTypeNone:
                return("none");

            case LiveObjectTypes.LiveObjectTypeWaypoint:
                return("wpt");

            case LiveObjectTypes.LiveObjectTypeTrackpoint:
                return("trkpt");

            case LiveObjectTypes.LiveObjectTypeRoutepoint:
                return("rtept");

            case LiveObjectTypes.LiveObjectTypeGeocache:
                return("geocache");

            case LiveObjectTypes.LiveObjectTypeLandmark:
                return("landmark");

            case LiveObjectTypes.LiveObjectTypeVehicle:
                return("vehicle");

            case LiveObjectTypes.LiveObjectTypeEarthquake:
                return("earthquake");
            }
        }
Exemple #2
0
        protected override int fontSizeByType(LiveObjectTypes type)
        {
            int ret = 8;

            /*
             * switch(type)
             * {
             *      case "Institution":
             *              ret = 18;
             *              break;
             * }
             */

            return(ret);
        }
Exemple #3
0
 protected virtual int imageSizeByType(LiveObjectTypes type)
 {
     int ret = 3;
     return ret;
 }
Exemple #4
0
 protected virtual int fontSizeByType(LiveObjectTypes type)
 {
     int ret = Project.FONT_SIZE_REGULAR;
     return ret;
 }
Exemple #5
0
        public static string LiveObjectTypeToString(LiveObjectTypes type)
        {
            //			return EnumDescription.getDescription(type);		-- obfuscator breaks this code

            switch(type)
            {
                default:
                case LiveObjectTypes.LiveObjectTypeNone:
                    return "none";
                case LiveObjectTypes.LiveObjectTypeWaypoint:
                    return "wpt";
                case LiveObjectTypes.LiveObjectTypeTrackpoint:
                    return "trkpt";
                case LiveObjectTypes.LiveObjectTypeRoutepoint:
                    return "rtept";
                case LiveObjectTypes.LiveObjectTypeGeocache:
                    return "geocache";
                case LiveObjectTypes.LiveObjectTypeLandmark:
                    return "landmark";
                case LiveObjectTypes.LiveObjectTypeVehicle:
                    return "vehicle";
                case LiveObjectTypes.LiveObjectTypeEarthquake:
                    return "earthquake";
            }
        }
Exemple #6
0
        private void act()
        {
            double lng  = 0.0d;
            double lat  = 0.0d;
            double elev = 0.0d;

            bool allcool = true;

            if (Project.coordStyle == 3)                        // UTM?
            {
                // something like "11S 0432345E 3712345N" in the latitudeTextBox
                allcool = Project.mainCommand.fromUtmString(latitudeTextBox.Text, out lng, out lat);
                if (allcool)
                {
                    latLabel.ForeColor = Color.Black;
                }
                else
                {
                    latLabel.ForeColor = Color.Red;
                }
            }
            else
            {
                try
                {
                    lng = GeoCoord.stringLngToDouble(longitudeTextBox.Text);
                    lngLabel.ForeColor = Color.Black;
                }
                catch
                {
                    lngLabel.ForeColor = Color.Red;
                    allcool            = false;
                }

                try
                {
                    lat = GeoCoord.stringLatToDouble(latitudeTextBox.Text);
                    latLabel.ForeColor = Color.Black;
                }
                catch
                {
                    latLabel.ForeColor = Color.Red;
                    allcool            = false;
                }
            }

            try
            {
                Distance elevDist   = new Distance(0.0d);
                int      unitsCompl = elevDist.UnitsCompl;

                double nuElev = Convert.ToDouble(elevationTextBox.Text.Replace(",", ""));
                elevDist.byUnits(nuElev, unitsCompl);

                elev = elevDist.Meters;

                if (elev < Project.cameraHeightMin * 1000.0d)
                {
                    elevDist.byUnits(Project.cameraHeightMin * 1000.0d, Distance.UNITS_DISTANCE_M);
                    elev = elevDist.Meters;
                }
                else if (elev > Project.CAMERA_HEIGHT_MAX * 1000.0d)
                {
                    elevDist.byUnits(Project.CAMERA_HEIGHT_MAX * 1000.0d, Distance.UNITS_DISTANCE_M);
                    elev = elevDist.Meters;
                }

                elevationUnitsLabel.Text = elevDist.toStringU(unitsCompl);

                elevLabel.ForeColor = Color.Black;
            }
            catch
            {
                elevLabel.ForeColor = Color.Red;
                allcool             = false;
            }

            if (makeWaypointCheckBox.Checked && waypointNameTextBox.Text.Length == 0)
            {
                waypointNameLabel.ForeColor = Color.Red;
                allcool = false;
            }
            else
            {
                waypointNameLabel.ForeColor = Color.Black;
            }

            if (allcool)
            {
                try
                {
                    GeoCoord location = new GeoCoord(lng, lat, elev);
                    location.Normalize();
                    m_cameraManager.MarkLocation(location, 0);
                    if (makeWaypointCheckBox.Checked)
                    {
                        LiveObjectTypes type    = LiveObjectTypes.LiveObjectTypeWaypoint;
                        bool            isFound = false;
                        switch (waypointTypeComboBox.SelectedIndex)
                        {
                        case 0:
                            type = LiveObjectTypes.LiveObjectTypeWaypoint;
                            break;

                        case 1:
                            type = LiveObjectTypes.LiveObjectTypeGeocache;
                            break;

                        case 2:
                            type    = LiveObjectTypes.LiveObjectTypeGeocache;
                            isFound = true;
                            break;
                        }
                        string   stype   = "" + waypointTypeComboBox.SelectedItem;
                        string   comment = waypointNameTextBox.Text;
                        Waypoint wpt     = new Waypoint(location, Project.localToZulu(DateTime.Now), type, -1L, comment, "", "");
                        wpt.Found = isFound;
                        WaypointsCache.WaypointsAll.Add(wpt);
                        WaypointsCache.WaypointsDisplayed.Add(wpt);
                        WaypointsCache.isDirty = true;
                        Project.drawWaypoints  = true;
                        m_cameraManager.PictureManager.LayersManager.ShowWaypoints = true;
                        if (!moveCameraCheckBox.Checked)
                        {
                            Cursor.Current = Cursors.WaitCursor;
                        }
                        m_cameraManager.PictureManager.Refresh();
                    }
                    if (moveCameraCheckBox.Checked)
                    {
                        Cursor.Current = Cursors.WaitCursor;
                        m_cameraManager.SpoilPicture();
                        m_cameraManager.Location = new GeoCoord(location);                                      // must be a new instance of GeoCoord
                        setCoordTextBoxes();
                        Cursor.Current = Cursors.Default;
                    }
                }
                catch
                {
                    elevLabel.ForeColor = Color.Red;
                    allcool             = false;
                }
            }
        }
        protected virtual void act()
        {
            double lng;
            double lat;
            double elev;

            bool allcool = validateCoord(out lng, out lat, out elev);

            if (waypointNameTextBox.Text.Length == 0)
            {
                waypointNameLabel.ForeColor = Color.Red;
                allcool = false;
            }
            else
            {
                waypointNameLabel.ForeColor = Color.Black;
            }

            DateTime dateTime = timePicker.isActive ? Project.localToZulu(timePicker.dateTime) : DateTime.MinValue;

            if (allcool)
            {
                try
                {
                    GeoCoord location = m_clickLocation;
                    if (!m_latText.Equals(latitudeTextBox.Text) || !m_lngText.Equals(longitudeTextBox.Text) || !m_elevText.Equals(elevationTextBox.Text))
                    {
                        location = new GeoCoord(lng, lat, elev);
                    }
                    location.Normalize();
                    LiveObjectTypes type    = LiveObjectTypes.LiveObjectTypeWaypoint;
                    bool            isFound = false;
                    switch (waypointTypeComboBox.SelectedIndex)
                    {
                    case 0:
                        type = LiveObjectTypes.LiveObjectTypeWaypoint;
                        break;

                    case 1:
                        type = LiveObjectTypes.LiveObjectTypeGeocache;
                        break;

                    case 2:
                        type    = LiveObjectTypes.LiveObjectTypeGeocache;
                        isFound = true;
                        break;
                    }
                    string   wptName = waypointNameTextBox.Text;
                    Waypoint wpt     = new Waypoint(location, dateTime, type, -1L, wptName, "", "");
                    wpt.Found   = isFound;
                    wpt.UrlName = urlNameTextBox.Text.Trim();
                    wpt.Sym     = symbolTextBox.Text.Trim();
                    wpt.Comment = commentTextBox.Text.Trim();
                    wpt.Desc    = detailTextBox.Text.Trim();
                    string url = urlTextBox.Text.Trim();
                    if (url.Length > 0 && !url.Equals("http://"))                               // if something meaningful has been entered
                    {
                        wpt.Url = url;
                    }

                    if (m_photoDescr != null)
                    {
                        wpt.ThumbSource    = m_photoDescr.imageThumbSource;
                        wpt.ThumbImage     = PhotoDescr.rebuildThumbnailImage(wpt.ThumbSource);
                        wpt.ThumbPosition  = Project.thumbPosition;
                        wpt.imageWidth     = m_photoDescr.Width;
                        wpt.imageHeight    = m_photoDescr.Height;
                        wpt.PhotoTimeShift = new TimeSpan(0L);
                    }

                    WaypointsCache.WaypointsAll.Add(wpt);
                    WaypointsCache.WaypointsDisplayed.Add(wpt);
                    WaypointsCache.isDirty = true;
                    Project.drawWaypoints  = true;

                    m_wpt = wpt;                        // in case the caller needs it

                    m_cameraManager.MarkLocation(location, 0);
                    m_cameraManager.PictureManager.LayersManager.ShowWaypoints = true;
                    m_cameraManager.ProcessCameraMove();
                    this.Close();
                }
                catch
                {
                    elevLabel.ForeColor = Color.Red;
                    allcool             = false;
                }
            }
        }
Exemple #8
0
        /// <summary>
        /// constructor with the most common parameters set
        /// </summary>
        /// <param name="loc"></param>
        /// <param name="dateTime"></param>
        /// <param name="liveObjectType"></param>
        /// <param name="trackId"></param>
        /// <param name="comment"></param>
        /// <param name="source"></param>
        /// <param name="url"></param>
        public Waypoint(GeoCoord loc, DateTime dateTime, LiveObjectTypes liveObjectType, long trackId, string name, string source, string url)
        {
            m_id = nextWaypointId++;

            m_location = loc;
            m_dateTime = dateTime;		// always UTC
            LiveObjectType = liveObjectType;
            m_trackId = trackId;
            m_name = name;
            m_wptName = name;
            m_source = source;
            m_url = url;

            Name = getLabel(false);

            setBrushes();
        }
Exemple #9
0
        protected override int imageSizeByType(LiveObjectTypes type)
        {
            int ret = PixelRadius;

            Image symImage = null;

            if(Project.useWaypointIcons)
            {
                symImage = Project.waypointImageGetter.getImageBySymbol(m_sym);
            }

            if(symImage != null)
            {
                ret = Math.Max(symImage.Width, symImage.Height);
            }
            else
            {
                switch(type)
                {
                    case LiveObjectTypes.LiveObjectTypeGeocache:
                        ret = 12;
                        break;
                }
            }
            return ret;
        }
Exemple #10
0
        protected override int fontSizeByType(LiveObjectTypes type)
        {
            int ret = Project.FONT_SIZE_REGULAR;

            switch(type)
            {
                case LiveObjectTypes.LiveObjectTypeGeocache:
                    ret = Project.FONT_SIZE_REGULAR;
                    break;
            }

            return ret;
        }
Exemple #11
0
        protected virtual int imageSizeByType(LiveObjectTypes type)
        {
            int ret = 3;

            return(ret);
        }
Exemple #12
0
        protected virtual int fontSizeByType(LiveObjectTypes type)
        {
            int ret = Project.FONT_SIZE_REGULAR;

            return(ret);
        }