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


C# Coordinate类代码示例

本文整理汇总了C#中Coordinate的典型用法代码示例。如果您正苦于以下问题:C# Coordinate类的具体用法?C# Coordinate怎么用?C# Coordinate使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: Announcement

        public Announcement(string description, string type, string operatorName, DateTime? startDate, DateTime? endDate, Coordinate location, IEnumerable<string> modes)
        {
            this.OperatorName = operatorName;
            this.Description = description;
            this.StartDate = startDate;
            this.EndDate = endDate;
            this.Location = location;
            this.Type = type;
            this.Modes.AddRange(modes);
            this.RelativeDateString = TimeConverter.ToRelativeDateString(StartDate, true);

            if (modes != null)
            {
                if (modes.Select(x => x.ToLower()).Contains("bus"))
                    this.ModeImages.Add("/Images/64/W/ModeBus.png");
                if (modes.Select(x => x.ToLower()).Contains("rail"))
                    this.ModeImages.Add("/Images/64/W/ModeRail.png");
                if (modes.Select(x => x.ToLower()).Contains("taxi"))
                    this.ModeImages.Add("/Images/64/W/ModeTaxi.png");
                if (modes.Select(x => x.ToLower()).Contains("boat"))
                    this.ModeImages.Add("/Images/64/W/ModeBoat.png");

                if (!this.ModeImages.Any())
                    this.ModeImages.Add("/Images/64/W/ModeBus.png");
            }
            else
            {
                this.Modes.Add("bus");
                this.ModeImages.Add("/Images/64/W/ModeBus.png");
            }
        }
开发者ID:CodeObsessed,项目名称:drumbleapp,代码行数:31,代码来源:Announcement.cs

示例2: reveal_all_tiles_near_mines_surrounding_tile_at

        public void reveal_all_tiles_near_mines_surrounding_tile_at(Coordinate coordinate, IGrid _grid)
        {
            // minefield.reveal

            for (var row = coordinate.X - 1; row <= coordinate.X + 1; row++)
                for (var col = coordinate.Y - 1; col <= coordinate.Y + 1; col++)
                {
                    var coordinate_of_tile_under_inspection = Coordinate.new_coord(row, col);

                    if (!coordinate_of_tile_under_inspection.Equals(coordinate))
                    {
                        if (!has_already_been_checked(coordinate_of_tile_under_inspection))
                        {
                            coordinates_checked.Add(coordinate_of_tile_under_inspection);

                            if (_grid.contains_tile_at(coordinate_of_tile_under_inspection) &&
                                !_grid.mine_on_tile_at(coordinate_of_tile_under_inspection))
                            {
                                _grid.reveal_tile_at(coordinate_of_tile_under_inspection);

                                if (!_grid.mines_near_tile_at(coordinate_of_tile_under_inspection))
                                {
                                    reveal_all_tiles_near_mines_surrounding_tile_at(coordinate_of_tile_under_inspection, _grid);
                                }
                            }
                        }
                    }
                }
        }
开发者ID:elbandit,项目名称:CQRS-Minesweeper,代码行数:29,代码来源:MineClearer.cs

示例3: Background

 public Background(string color = null, string imageurl = null, Coordinate position = null, BackgroundRepeat repeat = null)
 {
     Color = color;
     ImageUrl = imageurl;
     Position = position;
     Repeat = repeat;
 }
开发者ID:medelbrock,项目名称:Html.Markup,代码行数:7,代码来源:Background.cs

示例4: GetSpaceInFront

        public Coordinate GetSpaceInFront(Coordinate space, Direction direction)
        {
            if (direction == Direction.North)
            {
                if (space.Y + 1 >= numOfRows)
                    return new Coordinate(space.X, 0);

                return new Coordinate(space.X, space.Y + 1);
            }
            else if (direction == Direction.East)
            {
                if (space.X + 1 >= numOfCols)
                    return new Coordinate(0, space.Y);

                return new Coordinate(space.X + 1, space.Y);
            }
            else if (direction == Direction.West)
            {
                if (space.X - 1 < 0)
                    return new Coordinate(numOfCols - 1, space.Y);

                return new Coordinate(space.X - 1, space.Y);
            }
            else
            {
                if (space.Y - 1 < 0)
                    return new Coordinate(space.X, numOfRows - 1);

                return new Coordinate(space.X, space.Y - 1);
            }
        }
开发者ID:jramey,项目名称:MarsRover_Kata,代码行数:31,代码来源:Grid.cs

示例5: MonotoneChain

        private readonly object _context;  // user-defined information

        /// <summary>
        /// 
        /// </summary>
        /// <param name="pts"></param>
        /// <param name="start"></param>
        /// <param name="end"></param>
        /// <param name="context"></param>
        public MonotoneChain(Coordinate[] pts, int start, int end, object context)
        {
            _pts = pts;
            _start = start;
            _end = end;
            _context = context;
        }
开发者ID:ste10k41,项目名称:nettopologysuite,代码行数:16,代码来源:MonotoneChain.cs

示例6: PlaceShips

        public void PlaceShips(IPlayerView playerView, ICollection<IVessel> ships)
        {
            /* This AI places ships in the upper right corner and to the left.
             *
             * E.g.
             *
             * 10  #   #   #   #   #
             * 9   #   #   #   #   #
             * 8       #   #   #   #
             * 7               #   #
             * 6                   #
             * 5
             * 4
             * 3
             * 2
             * 1
             *   1 2 3 4 5 6 7 8 9 10
             */

            Placement place;
            Coordinate coord;
            int xMax = playerView.GetXMax();
            int yMax = playerView.GetYMax();

            int i = 0;
            foreach (IVessel ship in ships)
            {
                coord = new Coordinate(xMax - (2 * i), yMax);
                place = new Placement(ship, coord, Orientation.Vertical);
                playerView.PutShip(place);

                i++;
            }
        }
开发者ID:korroz,项目名称:BattleShip,代码行数:34,代码来源:MethodicalPlayer.cs

示例7: PublicStopPoint

 public PublicStopPoint(string name, string address, Coordinate location)
 {
     this.Id = Guid.NewGuid();
     this.Name = name;
     this.Address = address;
     this.Location = location;
 }
开发者ID:CodeObsessed,项目名称:drumbleapp,代码行数:7,代码来源:PublicStopPoint.cs

示例8: FindGeolocationAsync

        /// <summary>
        /// Finds the geolocation according <paramref name="coordinate"/>.
        /// </summary>
        /// <returns>The filled geolocation.</returns>
        /// <param name="coordinate">Coordinate.</param>
        /// <param name="language">Language of results in ISO code.</param>
        public Task<Location> FindGeolocationAsync(Coordinate coordinate, string language)
        {
            if (language == null)
                language = CultureInfo.CurrentUICulture.Name;

            return Task.Run(() =>
            {
                string Country;
                string State;
                string AdministrativeArea;
                string Locality;
                string Route;

                ReverseGeoLoc(coordinate.Longitude, coordinate.Latitude, language,
                    out Country,
                    out State,
                    out AdministrativeArea,
                    out Locality,
                    out Route);

                return new Location() 
                {
                    Coordinate = coordinate,
                    Country = Country,
                    State = State,
                    AdministrativeArea = AdministrativeArea,
                    Locality = Locality,
                    Route = Route,
                };
            });
        }
开发者ID:crabouif,项目名称:Self-Media-Database,代码行数:37,代码来源:GeolocationHelper.cs

示例9: DistanceTo

 public float DistanceTo(Coordinate c)
 {
     float dx = x - c.X;
     float dy = y - c.Y;
     float dz = z - c.Z;
     return (float)Math.Sqrt(dx * dx + dy * dy + dz * dz);
 }
开发者ID:remixod,项目名称:NetLibClient,代码行数:7,代码来源:Coordinate.cs

示例10: ComputeDistance

 public static void ComputeDistance(IGeometry geom, Coordinate pt, PointPairDistance ptDist)
 {
     if (geom is ILineString)
     {
         ComputeDistance((ILineString) geom, pt, ptDist);
     }
     else if (geom is IPolygon)
     {
         ComputeDistance((IPolygon) geom, pt, ptDist);
     }
     else if (geom is IGeometryCollection)
     {
         var gc = (IGeometryCollection) geom;
         for (var i = 0; i < gc.NumGeometries; i++)
         {
             var g = gc.GetGeometryN(i);
             ComputeDistance(g, pt, ptDist);
         }
     }
     else
     {
         // assume geom is Point
         ptDist.SetMinimum(geom.Coordinate, pt);
     }
 }
开发者ID:leoliusg,项目名称:NetTopologySuite,代码行数:25,代码来源:DistanceToPoint.cs

示例11: InsertCoordinates

        async private void InsertCoordinates(Coordinate coordinate)
        {

            await coordinateTable.InsertAsync(coordinate);

            //coordinates.Add(coordinate);
        }
开发者ID:vishsram,项目名称:BikeCrumbs,代码行数:7,代码来源:MainPage.xaml.cs

示例12: Locate

		/// <summary>
		///		Determines the topological relationship (location) of a single point
		///		to a Geometry.  It handles both single-element and multi-element Geometries.  
		///		The algorithm for multi-part Geometries is more complex, since it has 
		///		to take into account the boundaryDetermination rule.
		/// </summary>
		/// <param name="p"></param>
		/// <param name="geom"></param>
		/// <returns>Returns the location of the point relative to the input Geometry.</returns>
		public int Locate( Coordinate p, Geometry geom )
		{
			if ( geom.IsEmpty() ) return Location.Exterior;

			if ( geom is LineString )
			{
				return Locate( p, (LineString) geom );
			}
			if ( geom is LinearRing )
			{
				return Locate( p, (LinearRing) geom );
			}
			else if ( geom is Polygon ) 
			{
				return Locate( p, (Polygon) geom );
			}

			_isIn = false;
			_numBoundaries = 0;
			ComputeLocation( p, geom );
			if ( GeometryGraph.IsInBoundary( _numBoundaries ) )
			{
				return Location.Boundary;
			}
			if ( _numBoundaries > 0 || _isIn)
			{
				return Location.Interior;
			}
			return Location.Exterior;
		} // public int Locate( Coordinate p, Geometry geom )
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:39,代码来源:PointLocator.cs

示例13: Position

 public Position(Coordinate coordinate, Accuracy accuracy, Distance altitide, DateTimeOffset timestamp)
 {
     Coordinate = coordinate;
     Accuracy = accuracy;
     Altitude = altitide;
     Timestamp = timestamp;
 }
开发者ID:tomgilder,项目名称:RxPosition,代码行数:7,代码来源:Position.cs

示例14: RelatedResults

        public RelatedResults(JsonData resultsJson)
        {
            if (resultsJson == null) return;

            ResultAnnotations = new Annotation(resultsJson.GetValue<JsonData>("annotations"));
            Score = resultsJson.GetValue<double>("score");
            Kind = resultsJson.GetValue<string>("kind");
            JsonData value = resultsJson.GetValue<JsonData>("value");
            ValueAnnotations = new Annotation(value.GetValue<JsonData>("annotations"));
            Retweeted = value.GetValue<bool>("retweeted");
            InReplyToScreenName = value.GetValue<string>("in_reply_to_screen_name");
            var contributors = value.GetValue<JsonData>("contributors");
            Contributors =
                contributors == null ?
                    new List<Contributor>() :
                    (from JsonData contributor in contributors
                     select new Contributor(contributor))
                    .ToList();
            Coordinates = new Coordinate(value.GetValue<JsonData>("coordinates"));
            Place = new Place(value.GetValue<JsonData>("place"));
            User = new User(value.GetValue<JsonData>("user"));
            RetweetCount = value.GetValue<int>("retweet_count");
            IDString = value.GetValue<string>("id_str");
            InReplyToUserID = value.GetValue<ulong>("in_reply_to_user_id");
            Favorited = value.GetValue<bool>("favorited");
            InReplyToStatusIDString = value.GetValue<string>("in_reply_to_status_id_str");
            InReplyToStatusID = value.GetValue<ulong>("in_reply_to_status_id");
            Source = value.GetValue<string>("source");
            CreatedAt = value.GetValue<string>("created_at").GetDate(DateTime.MaxValue);
            InReplyToUserIDString = value.GetValue<string>("in_reply_to_user_id_str");
            Truncated = value.GetValue<bool>("truncated");
            Geo = new Geo(value.GetValue<JsonData>("geo"));
            Text = value.GetValue<string>("text");
        }
开发者ID:prog-moh,项目名称:LinqToTwitter,代码行数:34,代码来源:RelatedResults.cs

示例15: Distance

 public Double Distance(Coordinate other)
 {
     Double x2 = Math.Pow(m_x - other.X, 2.0);
     Double y2 = Math.Pow(m_y - other.Y, 2.0);
     Double distance = Math.Sqrt(x2 + y2);
     return distance;
 }
开发者ID:dkuwahara,项目名称:AlphaBot,代码行数:7,代码来源:Coordinate.cs


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