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


C# Position3D类代码示例

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


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

示例1: GetNextZ

		public static int GetNextZ(Mobile m, Position3D loc, Direction d)
		{
            int newZ;
            if (CheckMovement(m, loc, d, out newZ, true))
                return newZ;
            return loc.Z;
		}
开发者ID:msx752,项目名称:UltimaXNA,代码行数:7,代码来源:MobileMovementCheck.cs

示例2: Filter

        // Average position calculation
        private void Filter()
        {
            double x = 0, y = 0, z = 0;

            int count = this._samples.Count;
            for (int i = 0; i < count; i++)
            {
                x += _samples[i].Longitude.DecimalDegrees;
                y += _samples[i].Latitude.DecimalDegrees;
                z += _samples[i].Altitude.ToMeters().Value;
            }

            this._filteredPositon = 
                new Position3D(
                    new Longitude(x / count), 
                    new Latitude(y / count), 
                    Distance.FromMeters(z / count));
        }
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:19,代码来源:PositionAverageFilter.cs

示例3: Update

        public void Update(Map map, Position3D center, MousePicking mousePick)
        {
            int pixelScale = (Settings.UserInterface.PlayWindowPixelDoubling) ? 2 : 1;
            if (m_RenderTargetSprites == null || m_RenderTargetSprites.Width != Settings.UserInterface.PlayWindowGumpResolution.Width / pixelScale || m_RenderTargetSprites.Height != Settings.UserInterface.PlayWindowGumpResolution.Height / pixelScale)
            {
                if (m_RenderTargetSprites != null)
                    m_RenderTargetSprites.Dispose();
                m_RenderTargetSprites = new RenderTarget2D(
                    m_SpriteBatch.GraphicsDevice, 
                    Settings.UserInterface.PlayWindowGumpResolution.Width / pixelScale, 
                    Settings.UserInterface.PlayWindowGumpResolution.Height / pixelScale, 
                    false, 
                    SurfaceFormat.Color, 
                    DepthFormat.Depth24Stencil8, 
                    0, 
                    RenderTargetUsage.DiscardContents);
            }

            DetermineIfClientIsUnderEntity(map, center);
            DrawEntities(map, center, mousePick, out m_DrawOffset);
        }
开发者ID:msx752,项目名称:UltimaXNA,代码行数:21,代码来源:IsometricView.cs

示例4: Filter

 /// <summary>
 /// Return a filtered Position3D from the specified parameters
 /// </summary>
 /// <param name="gpsPosition">The GPS position.</param>
 /// <param name="deviceError">The device error.</param>
 /// <param name="horizontalDOP">The horizontal DOP.</param>
 /// <param name="verticalDOP">The vertical DOP.</param>
 /// <param name="bearing">The bearing.</param>
 /// <param name="speed">The speed.</param>
 /// <returns></returns>
 public abstract Position3D Filter(Position3D gpsPosition, Distance deviceError, DilutionOfPrecision horizontalDOP, DilutionOfPrecision verticalDOP, Azimuth bearing, Speed speed);
开发者ID:JoeGilkey,项目名称:RadioLog,代码行数:11,代码来源:Filter.cs

示例5: UpdateState

 /// <summary>
 /// Updates the state.
 /// </summary>
 /// <param name="currentDOP">The current DOP.</param>
 /// <param name="z">The z.</param>
 public void UpdateState(DilutionOfPrecision currentDOP, Position3D z)
 {
     UpdateState(Distance.FromMeters(_deviceError), currentDOP, currentDOP, Azimuth.Empty, Speed.AtRest, z);
 }
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:9,代码来源:KalmanFilter.cs

示例6: Initialize

        /// <summary>
        /// Adds an initialization position.
        /// </summary>
        /// <param name="gpsPosition"> The initialization position to add. </param>
        /// <remarks>
        /// This method does not update the SampleCount or the FilteredLocation
        /// properties.
        /// </remarks>
        public override void Initialize(Position3D gpsPosition)
        {
            this._samples = new List<Position3D>(_sampleCount + 1);
            this._sampleTimes = new List<DateTime>(_sampleCount + 1);

            this._samples.Add(gpsPosition);
            this._sampleTimes.Add(DateTime.Now);
        }
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:16,代码来源:PositionAverageFilter.cs

示例7: Initialize

 /// <summary>
 /// Initializes the Kalman Filter using an initial observation (position)
 /// </summary>
 /// <param name="gpsPosition">The position at which tfilter is to begin opperating.</param>
 /// <param name="meanDOP">The mean dilution of precision</param>
 public void Initialize(Position3D gpsPosition, DilutionOfPrecision meanDOP)
 {
     Initialize(gpsPosition, DilutionOfPrecision.CurrentAverageDevicePrecision, meanDOP, meanDOP, Ellipsoid.Default);
 }
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:9,代码来源:KalmanFilter.cs

示例8: InternalDrawOverheads

 internal void InternalDrawOverheads(MapTile tile, Position3D position)
 {
     // base entities do not draw, but they can have overheads, so we draw those.
     foreach (Overhead overhead in m_Overheads)
     {
         if (!overhead.IsDisposed)
             overhead.Draw(tile, position);
     }
 }
开发者ID:gautamabudha,项目名称:UltimaXNA,代码行数:9,代码来源:AEntity.cs

示例9: DrawEntities

        private void DrawEntities(Map map, Position3D center, MousePicking mousePicking, out Vector2 renderOffset)
        {
            if (center == null)
            {
                renderOffset = new Vector2();
                return;
            }

            // reset the spritebatch Z
            m_SpriteBatch.Reset();
            // set the lighting variables.
            m_SpriteBatch.SetLightIntensity(Lighting.IsometricLightLevel);
            m_SpriteBatch.SetLightDirection(Lighting.IsometricLightDirection);

            // get variables that describe the tiles drawn in the viewport: the first tile to draw,
            // the offset to that tile, and the number of tiles drawn in the x and y dimensions.
            Point firstTile, renderDimensions;
            int overDrawTilesOnSides = 3;
            int overDrawTilesAtTopAndBottom = 6;
            int overDrawAdditionalTilesOnBottom = 10;
            CalculateViewport(center, overDrawTilesOnSides, overDrawTilesAtTopAndBottom, out firstTile, out renderOffset, out renderDimensions);

            CountEntitiesRendered = 0; // Count of objects rendered for statistics and debug

            MouseOverList overList = new MouseOverList(mousePicking); // List of entities mouse is over.
            List<AEntity> deferredToRemove = new List<AEntity>();

            for (int y = 0; y < renderDimensions.Y * 2 + 1 + overDrawAdditionalTilesOnBottom; y++)
            {
                Vector3 drawPosition = new Vector3();
                drawPosition.X = (firstTile.X - firstTile.Y + (y % 2)) * TILE_SIZE_FLOAT_HALF + renderOffset.X;
                drawPosition.Y = (firstTile.X + firstTile.Y + y) * TILE_SIZE_FLOAT_HALF + renderOffset.Y;

                Point firstTileInRow = new Point(firstTile.X + ((y + 1) / 2), firstTile.Y + (y / 2));

                for (int x = 0; x < renderDimensions.X + 1; x++)
                {
                    MapTile tile = map.GetMapTile(firstTileInRow.X - x, firstTileInRow.Y + x);
                    if (tile == null)
                    {
                        drawPosition.X -= TILE_SIZE_FLOAT;
                        continue;
                    }

                    List<AEntity> entities = tile.Entities;
                    bool draw = true;
                    for (int i = 0; i < entities.Count; i++)
                    {
                        if (entities[i] is DeferredEntity)
                            deferredToRemove.Add(entities[i]);

                        if (!m_DrawTerrain)
                        {
                            if ((entities[i] is Ground) || (entities[i].Z > tile.Ground.Z))
                                draw = false;
                        }

                        if ((entities[i].Z >= m_DrawMaxItemAltitude || (m_DrawMaxItemAltitude != 255 && entities[i] is Item && (entities[i] as Item).ItemData.IsRoof)) && !(entities[i] is Ground))
                        {
                            continue;
                        }

                        if (draw)
                        {
                            AEntityView view = entities[i].GetView();
                            if (view != null)
                            {
                                if (view.Draw(m_SpriteBatch, drawPosition, overList, map, !m_UnderSurface))
                                    CountEntitiesRendered++;
                            }
                        }
                    }

                    foreach (AEntity deferred in deferredToRemove)
                        tile.OnExit(deferred);
                    deferredToRemove.Clear();

                    drawPosition.X -= TILE_SIZE_FLOAT;
                }
            }

            OverheadsView.Render(m_SpriteBatch, overList, map, m_UnderSurface);

            // Update the MouseOver objects
            mousePicking.UpdateOverEntities(overList, mousePicking.Position);

            // Draw the objects we just send to the spritebatch.
            m_SpriteBatch.GraphicsDevice.SetRenderTarget(m_RenderTargetSprites);
            m_SpriteBatch.GraphicsDevice.Clear(Color.Black);
            m_SpriteBatch.FlushSprites(true);
            m_SpriteBatch.GraphicsDevice.SetRenderTarget(null);
        }
开发者ID:jorsi,项目名称:UltimaXNA,代码行数:92,代码来源:IsometricView.cs

示例10: Draw

 internal virtual void Draw(MapTile tile, Position3D position)
 {
 }
开发者ID:gautamabudha,项目名称:UltimaXNA,代码行数:3,代码来源:AEntity.cs

示例11: DetermineIfClientIsUnderEntity

        private void DetermineIfClientIsUnderEntity(Map map, Position3D center)
        {
            // Are we inside (under a roof)? Do not draw tiles above our head.
            m_DrawMaxItemAltitude = 255;
            m_DrawTerrain = true;
            m_UnderSurface = false;

            MapTile tile;
            AEntity underObject, underTerrain;
            if ((tile = map.GetMapTile(center.X, center.Y)) != null)
            {
                if (tile.IsZUnderEntityOrGround(center.Z, out underObject, out underTerrain))
                {
                    // if we are under terrain, then do not draw any terrain at all.
                    m_DrawTerrain = (underTerrain == null);

                    if (!(underObject == null))
                    {
                        // Roofing and new floors ALWAYS begin at intervals of 20.
                        // if we are under a ROOF, then get rid of everything above me.Z + 20
                        // (this accounts for A-frame roofs). Otherwise, get rid of everything
                        // at the object above us.Z.
                        if (underObject is Item)
                        {
                            Item item = (Item)underObject;
                            if (item.ItemData.IsRoof)
                                m_DrawMaxItemAltitude = center.Z - (center.Z % 20) + 20;
                            else if (item.ItemData.IsSurface || (item.ItemData.IsWall && !item.ItemData.IsDoor))
                                m_DrawMaxItemAltitude = item.Z;
                            else
                            {
                                int z = center.Z + ((item.ItemData.Height > 20) ? item.ItemData.Height : 20);
                                m_DrawMaxItemAltitude = z;
                            }
                        }

                        // If we are under a roof tile, do not make roofs transparent if we are on an edge.
                        if (underObject is Item && ((Item)underObject).ItemData.IsRoof)
                        {
                            bool isRoofSouthEast = true;
                            if ((tile = map.GetMapTile(center.X + 1, center.Y)) != null)
                            {
                                tile.IsZUnderEntityOrGround(center.Z, out underObject, out underTerrain);
                                isRoofSouthEast = !(underObject == null);
                            }

                            if (!isRoofSouthEast)
                                m_DrawMaxItemAltitude = 255;
                        }

                        m_UnderSurface = (m_DrawMaxItemAltitude != 255);
                    }
                }
            }
        }
开发者ID:jorsi,项目名称:UltimaXNA,代码行数:55,代码来源:IsometricView.cs

示例12: CalculateViewport

        private void CalculateViewport(Position3D center, int overDrawTilesOnSides, int overDrawTilesOnTopAndBottom, out Point firstTile, out Vector2 renderOffset, out Point renderDimensions)
        {
            int pixelScale = (Settings.UserInterface.PlayWindowPixelDoubling) ? 2 : 1;

            renderDimensions.Y = Settings.UserInterface.PlayWindowGumpResolution.Height / pixelScale / TILE_SIZE_INTEGER + overDrawTilesOnTopAndBottom; // the number of tiles that are drawn for half the screen (doubled to fill the entire screen).
            renderDimensions.X = Settings.UserInterface.PlayWindowGumpResolution.Width / pixelScale / TILE_SIZE_INTEGER + overDrawTilesOnSides; // the number of tiles that are drawn in the x-direction ( + renderExtraColumnsAtSides * 2 ).
            int renderDimensionsDiff = Math.Abs(renderDimensions.X - renderDimensions.Y);
            renderDimensionsDiff -= renderDimensionsDiff % 2; // make sure this is an even number...

            // when the player entity is at a higher z altitude in the world, we must offset the first row drawn so that tiles at lower altitudes are drawn.
            // The reverse is not true - at lower altitutdes, higher tiles are never on screen. This is an artifact of UO's isometric projection.
            // Note: The value of this variable MUST be a multiple of 2 and MUST be positive.
            int firstZOffset = (center.Z > 0) ? (int)Math.Abs(((center.Z + center.Z_offset) / 11)) : 0;
            // this is used to draw tall objects that would otherwise not be visible until their ground tile was on screen. This may still skip VERY tall objects (those weird jungle trees?)

            firstTile = new Point(center.X - firstZOffset, center.Y - renderDimensions.Y - firstZOffset);
            if (renderDimensions.Y > renderDimensions.X)
            {
                firstTile.X -= renderDimensionsDiff / 2;
                firstTile.Y -= renderDimensionsDiff / 2;
            }
            else
            {
                firstTile.X += renderDimensionsDiff / 2;
                firstTile.Y -= renderDimensionsDiff / 2;
            }

            renderOffset.X = (((Settings.UserInterface.PlayWindowGumpResolution.Width / pixelScale) + ((renderDimensions.Y) * TILE_SIZE_INTEGER)) / 2) - TILE_SIZE_FLOAT_HALF;
            renderOffset.X -= (int)((center.X_offset - center.Y_offset) * TILE_SIZE_FLOAT_HALF);
            renderOffset.X -= (firstTile.X - firstTile.Y) * TILE_SIZE_FLOAT_HALF;
            renderOffset.X += renderDimensionsDiff * TILE_SIZE_FLOAT_HALF;

            renderOffset.Y = ((Settings.UserInterface.PlayWindowGumpResolution.Height / pixelScale) / 2 - (renderDimensions.Y * TILE_SIZE_INTEGER / 2));
            renderOffset.Y += ((center.Z + center.Z_offset) * 4);
            renderOffset.Y -= (int)((center.X_offset + center.Y_offset) * TILE_SIZE_FLOAT_HALF);
            renderOffset.Y -= (firstTile.X + firstTile.Y) * TILE_SIZE_FLOAT_HALF;
            renderOffset.Y -= TILE_SIZE_FLOAT_HALF;
            renderOffset.Y -= firstZOffset * TILE_SIZE_FLOAT;
        }
开发者ID:jorsi,项目名称:UltimaXNA,代码行数:39,代码来源:IsometricView.cs

示例13: Initialize

 /// <summary>
 /// Initialise the filter from a specified Position3D
 /// </summary>
 /// <param name="gpsPosition">The GPS position.</param>
 public abstract void Initialize(Position3D gpsPosition);
开发者ID:JoeGilkey,项目名称:RadioLog,代码行数:5,代码来源:Filter.cs

示例14: AEntity

 // ============================================================
 // Methods
 // ============================================================
 public AEntity(Serial serial, Map map)
 {
     Serial = serial;
     Map = map;
     m_Position = new Position3D(OnTileChanged);
 }
开发者ID:gautamabudha,项目名称:UltimaXNA,代码行数:9,代码来源:AEntity.cs

示例15: KalmanFilter

     /// <summary>
     /// Kalman Filter with parameters
     /// </summary>
     /// <param name="initialObservation">The initial observation.</param>
     /// <param name="deviceError">The device error.</param>
     /// <param name="horizontalDOP">The horizontal DOP.</param>
     /// <param name="verticalDOP">The vertical DOP.</param>
     /// <param name="ellipsoid">The ellipsoid.</param>
     public KalmanFilter(
 Position3D initialObservation,
 Distance deviceError,
 DilutionOfPrecision horizontalDOP,
 DilutionOfPrecision verticalDOP,
 Ellipsoid ellipsoid)
     {
         _currentState = new KalmanSystemState(
             initialObservation,
             deviceError,
             horizontalDOP,
             verticalDOP,
             ellipsoid);
     }
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:22,代码来源:KalmanFilter.cs


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