当前位置: 首页>>代码示例>>C#>>正文


C# Distance.ToStringCompl方法代码示例

本文整理汇总了C#中Distance.ToStringCompl方法的典型用法代码示例。如果您正苦于以下问题:C# Distance.ToStringCompl方法的具体用法?C# Distance.ToStringCompl怎么用?C# Distance.ToStringCompl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Distance的用法示例。


在下文中一共展示了Distance.ToStringCompl方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: toStringPopup

        /// <summary>
        /// returns a formatted string suitable for popups
        /// </summary>
        /// <returns></returns>
        public string toStringPopup()
        {
            StringBuilder builder = new StringBuilder();
            string speedLbl = null;
            string odometerLbl = null;
            string timeTraveledLbl = null;
            string timeThisLegLbl = null;
            string timeRemainingLbl = null;

            if(m_wptFrom.TrackId != -1)
            {
                Track trk = (Track)Project.mainCommand.getTrackById(m_wptFrom.TrackId);
                Distance dOdometer;

                if(trk != null)
                {
                    int i = trk.Trackpoints.IndexOfValue(this);
                    builder.Append("Leg : " + m_wptFrom.Name + " --> " + m_wptTo.Name);
                    builder.Append("\nof " + (trk.isRoute ? "Route" : "Track") + m_wptFrom.TrackId + " : " + trk.Name + "\n");

                    if(HasSpeed)
                    {
                        Speed dSpeed = new Speed(this.Speed);				// meters per hour
                        speedLbl = dSpeed.ToString();
                    }

                    TimeSpan ts = m_wptFrom.DateTime - trk.Start;
                    timeTraveledLbl = Project.TimeSpanToString(ts);

                    timeThisLegLbl = Project.TimeSpanToString(m_duration);

                    ts = trk.End - m_wptTo.DateTime;
                    timeRemainingLbl = Project.TimeSpanToString(ts);

                    dOdometer = new Distance(m_wptFrom.Odometer);	// meters
                    odometerLbl = dOdometer.ToString() + " plus this leg: " + Dist.ToString();
                }
            }
            builder.Append(m_wptFrom.Location.toString00(false, Project.coordStyle));
            Distance dElev = new Distance(m_wptFrom.Location.Elev);
            if(dElev.Meters != 0.0d)
            {
                builder.Append("  elev: " + dElev.ToStringCompl() + "\n");
            }

            if(m_wptFrom.DateTime.Ticks > minDateTimeTicks)
                // waypoint times are added to to avoid duplicates, we need to compare with tolerance
            {
                builder.Append("\n  " + Project.zuluToLocal(m_wptFrom.DateTime));
            }
            if(odometerLbl != null)
            {
                builder.Append((speedLbl == null ? "\n" : "  ") +  "odometer: " + odometerLbl);
            }
            if(speedLbl != null)
            {
                builder.Append("\n  speed: " + speedLbl);
            }
            builder.Append("\n time");
            if(timeTraveledLbl != null)
            {
                builder.Append(" traveled: " + timeTraveledLbl);
            }
            builder.Append(" this leg: " + timeThisLegLbl);
            if(timeRemainingLbl != null)
            {
                builder.Append("   remaining: " + timeRemainingLbl);
            }

            addCourseData(builder, false);

            return builder.ToString();
        }
开发者ID:slgrobotics,项目名称:QuakeMap,代码行数:77,代码来源:Leg.cs

示例2: heightToString

 public string heightToString()
 {
     string height = "";
     if(m_H > 0.3d) // meters
     {
         Distance d = new Distance(m_H);
         height = " " + d.ToStringCompl() + " high";
     }
     else if(m_H < -0.3d) // meters
     {
         Distance d = new Distance(-m_H);
         height = " " + d + " deep";
     }
     return height;
 }
开发者ID:slgrobotics,项目名称:QuakeMap,代码行数:15,代码来源:GeoCoord.cs

示例3: graphInfoString

        /// <summary>
        /// short info string about the trackpoint for elevation graph
        /// </summary>
        /// <returns></returns>
        public string graphInfoString()
        {
            string tmp = "";

            string speedLbl = null;
            string odometerLbl = null;

            Track trk = (Track)Project.mainCommand.getTrackById(this.TrackId);
            if(trk != null)
            {
                if(trk.isRoute)
                {
                    tmp += "Route " + this.TrackId + ": " + trk.Name;
                    if(HasOdometer)
                    {
                        Distance dOdometer = new Distance(this.Odometer);	// meters
                        odometerLbl = dOdometer.ToString();
                    }
                }
                else
                {
                    tmp += "Track " + this.TrackId + ": " + trk.Name;
                    if(HasSpeed)
                    {
                        Speed dSpeed = new Speed(this.Speed);				// meters per hour
                        speedLbl = dSpeed.ToString();
                    }
                    if(HasOdometer)
                    {
                        Distance dOdometer = new Distance(this.Odometer);	// meters
                        odometerLbl = dOdometer.ToString();
                    }
                }
            }

            Distance dElev = new Distance(this.Location.Elev);
            string elevLbl = dElev.ToStringCompl();

            tmp += "       elevation: " + elevLbl;

            if(speedLbl != null)
            {
                tmp += "  speed: " + speedLbl;
            }
            if(odometerLbl != null)
            {
                tmp += "  odometer: " + odometerLbl;
            }

            return tmp;
        }
开发者ID:slgrobotics,项目名称:QuakeMap,代码行数:55,代码来源:Waypoint.cs

示例4: addKmlCoords

        private void addKmlCoords(StringBuilder builder, bool addNewlines)
        {
            string sep = addNewlines ? "<br/>" : "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";

            int coordStyle = Project.coordStyle;
            if(Project.coordStyle == 3)
            {
                coordStyle = 1;
            }
            builder.Append("<b>Loc:</b> " + this.Location.toString00(false, coordStyle) + sep);
            builder.Append("<b>UTM:</b> " + this.Location.toString0(false, 3) + sep);

            Distance dElev = new Distance(this.Location.Elev);
            if(dElev.Meters != 0.0d)
            {
                builder.Append("<b>Altitude:</b> " + dElev.ToStringCompl());
            }

            if(dElev.Meters == 0.0d || !addNewlines)
            {
                builder.Append("<br/>\n");
            }
        }
开发者ID:slgrobotics,项目名称:QuakeMap,代码行数:23,代码来源:Waypoint.cs

示例5: ToStringProfile

        public string ToStringProfile()
        {
            StringBuilder builder = new StringBuilder();
            Waypoint nextWpt = null;
            string speedLbl = null;
            string odometerLbl = null;
            string timeTraveledLbl = null;
            string timeRemainingLbl = null;

            bool doTime = true;
            if(this.Desc != null && this.Desc.Length > 0 && !this.Desc.Equals(this.Name))
            {
                builder.Append(this.Desc.Trim() + "  ");
            }
            if(this.TrackId != -1)
            {
                Track trk = (Track)Project.mainCommand.getTrackById(this.TrackId);
                if(trk != null)
                {
                    int i = trk.Trackpoints.IndexOfValue(this);
                    nextWpt = (i < trk.Trackpoints.Count-1) ? (Waypoint)trk.Trackpoints.GetByIndex(i+1) : null;
                    string name = this.Name;
                    if(trk.isRoute)
                    {
                        builder.Append(name + " | ");
                        doTime = false;
                        if(HasOdometer)
                        {
                            Distance dOdometer = new Distance(this.Odometer);	// meters
                            odometerLbl = dOdometer.ToString();
                        }
                    }
                    else
                    {
                        builder.Append(name + " | ");
                        if(HasSpeed)
                        {
                            Speed dSpeed = new Speed(this.Speed);				// meters per hour
                            speedLbl = dSpeed.ToString();
                        }
                        TimeSpan ts = this.DateTime - trk.Start;
                        timeTraveledLbl = Project.TimeSpanToString(ts);

                        ts = trk.End - this.DateTime;
                        timeRemainingLbl = Project.TimeSpanToString(ts);
                    }
                    if(HasOdometer)
                    {
                        Distance dOdometer = new Distance(this.Odometer);	// meters
                        odometerLbl = dOdometer.ToString();
                    }
                }
            }
            builder.Append(this.Location.toString00(false, Project.coordStyle));
            Distance dElev = new Distance(this.Location.Elev);
            if(dElev.Meters != 0.0d)
            {
                builder.Append("  elev: " + dElev.ToStringCompl() + " ");
            }

            if(doTime && this.DateTime.Ticks > minDateTimeTicks)
                // waypoint times are added to to avoid duplicates, we need to compare with tolerance
            {
                builder.Append(" " + Project.zuluToLocal(this.DateTime));
            }
            if(speedLbl != null)
            {
                builder.Append("  speed: " + speedLbl);
            }
            if(odometerLbl != null)
            {
                builder.Append("  odometer: " + odometerLbl);
            }
            if(timeTraveledLbl != null)
            {
                builder.Append("  time traveled: " + timeTraveledLbl);
            }
            if(timeRemainingLbl != null)
            {
                builder.Append("  time remaining: " + timeRemainingLbl);
            }
            if(nextWpt != null && !this.Location.sameAs(nextWpt.Location))
            {
                addCourseData(builder, nextWpt, false);
            }
            if(this.WptName != null && this.WptName.Length > 0)
            {
                builder.Append(" Name: " + this.WptName.Trim());
            }
            if(this.TrackId == -1 && this.LiveObjectType == LiveObjectTypes.LiveObjectTypeGeocache && this.DateTime.Ticks > minDateTimeTicks)
            {
                builder.Append("      Hidden: " + Project.zuluToLocal(this.DateTime).ToShortDateString());
            }
            if(this.UrlName != null && this.UrlName.Length > 0)
            {
                builder.Append(" Url Name: " + this.UrlName.Trim());
            }
            if(this.Comment != null && this.Comment.Length > 0)
            {
                builder.Append(" Comment: " + this.Comment.Trim());
//.........这里部分代码省略.........
开发者ID:slgrobotics,项目名称:QuakeMap,代码行数:101,代码来源:Waypoint.cs

示例6: toStringPopup

        /// <summary>
        /// returns a formatted string suitable for popups
        /// </summary>
        /// <returns></returns>
        public string toStringPopup()
        {
            StringBuilder builder = new StringBuilder();
            Waypoint nextWpt = null;
            string speedLbl = null;
            string odometerLbl = null;
            //Waypoint prevWpt = null;
            string timeTraveledLbl = null;
            string timeRemainingLbl = null;

            bool doTime = this.DateTime.Ticks > minDateTimeTicks;

            if(this.Desc != null && this.Desc.Length > 0)
            {
                builder.Append(this.Desc.Trim() + "\n\n");
            }
            if(this.Url != null && this.Url.Length > 0)
            {
                builder.Append(Project.serverAvailable ? "[click waypoint or label to browse]\n\n" : "[can't browse offline]\n\n");
            }
            if(this.TrackId != -1)
            {
                Track trk = (Track)Project.mainCommand.getTrackById(this.TrackId);
                if(trk != null)
                {
                    int i = trk.Trackpoints.IndexOfValue(this);
                    nextWpt = (i < trk.Trackpoints.Count-1) ? (Waypoint)trk.Trackpoints.GetByIndex(i+1) : null;
                    string name = " : " + this.Name;
                    if(name.Length > 7)
                    {
                        name = "";
                    }

                    if(builder.Length == 0)
                    {
                        builder.Append("Waypoint on ");
                    }

                    builder.Append((trk.isRoute ? "Route " : "Track ") + this.TrackId + ": " + trk.Name + name + "\n");

                    if(HasSpeed)
                    {
                        Speed dSpeed = new Speed(this.Speed);				// meters per hour
                        speedLbl = dSpeed.ToString();
                    }
                    TimeSpan ts = this.DateTime - trk.Start;
                    timeTraveledLbl = Project.TimeSpanToString(ts);

                    ts = trk.End - this.DateTime;
                    timeRemainingLbl = Project.TimeSpanToString(ts);

                    if(HasOdometer)
                    {
                        Distance dOdometer = new Distance(this.Odometer);	// meters
                        odometerLbl = dOdometer.ToString();
                    }
                }
            }
            builder.Append(this.Location.toString00(false, Project.coordStyle));
            Distance dElev = new Distance(this.Location.Elev);
            if(dElev.Meters != 0.0d)
            {
                builder.Append("  elev: " + dElev.ToStringCompl() + "\n");
            }

            if(this.TrackId == -1)
            {
                string strLoType = this.LiveObjectTypeToString();
                builder.Append("Type: (" + strLoType + (this.Found ? " - FOUND" : "") + ")");
            }
            if(m_wptType.Length > 0)
            {
                builder.Append(" (" + m_wptType + (this.Found ? " - FOUND" : "") + ")");
            }
            if(doTime && this.DateTime.Ticks > minDateTimeTicks)
                // waypoint times are added to to avoid duplicates, we need to compare with tolerance
            {
                builder.Append("\n  " + Project.zuluToLocal(this.DateTime));
            }
            if(speedLbl != null)
            {
                builder.Append("\n  speed: " + speedLbl);
            }
            if(odometerLbl != null)
            {
                builder.Append((speedLbl == null ? "\n" : "  ") +  "odometer: " + odometerLbl);
            }
            if(timeTraveledLbl != null)
            {
                builder.Append("\n time traveled: " + timeTraveledLbl);
            }
            if(timeRemainingLbl != null)
            {
                builder.Append("  time remaining: " + timeRemainingLbl);
            }
            if(nextWpt != null && !this.Location.sameAs(nextWpt.Location))
//.........这里部分代码省略.........
开发者ID:slgrobotics,项目名称:QuakeMap,代码行数:101,代码来源:Waypoint.cs


注:本文中的Distance.ToStringCompl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。