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


C# ITile.getOffset方法代码示例

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


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

示例1: toPixelLocationPrint

        public override Point toPixelLocationPrint(GeoCoord loc, ITile tile)
        {
            int xx = 0;
            int yy = 0;

            if(tile != null)
            {
                // the idea here is to simplify conversion for tiles around 180, when camera operates
                // on coordinates above 180 and below -180

                int offsetX = 0;
                int offsetY = 0;
                Point offset;

                if(!(offset=tile.getOffset()).IsEmpty)
                {
                    offsetX = offset.X;
                    offsetY = offset.Y;
                }

                GeoCoord tileTopLeft = tile.getTopLeft();
                GeoCoord tileTopLeftN = tileTopLeft.Clone();
                tileTopLeftN.Normalize();
                GeoCoord locN = loc.Clone();
                locN.Normalize();
                double dOffsetLng = locN.Lng - tileTopLeftN.Lng;
                double dOffsetLat = locN.Lat - tileTopLeftN.Lat;

                xx = (int)Math.Round((tileTopLeft.Lng + dOffsetLng - m_coverageTopLeftPrint.Lng) / xScalePrint) + offsetX;
                yy = (int)Math.Round((tileTopLeft.Lat + dOffsetLat - m_coverageTopLeftPrint.Lat) / yScalePrint) + offsetY;
            }
            else
            {
                // express location longitude and latitude in terms of camera coordinates:
                double dOffsetLng = loc.Lng - m_location.Lng;
                while(dOffsetLng >= 180.0d)
                {
                    dOffsetLng -= 360.0d;
                }
                while(dOffsetLng <= -180.0d)
                {
                    dOffsetLng += 360.0d;
                }

                if(TileSetTerra.This.hasRenderedTiles && TileSetTerra.This.insideCurrentZone(loc))
                {
                    Point screenPt = TileSetTerra.This.toScreenPoint(loc, true);
                    screenPt.Offset(m_pictureManager.OffsetXPrint, m_pictureManager.OffsetYPrint);
                    return screenPt;
                }
                else
                {
                    xx = (int)Math.Round(dOffsetLng / xScalePrint + pictureWidthPrint / 2.0d);
                    yy = (int)Math.Round((loc.Lat - m_location.Lat) / yScalePrint + pictureHeightPrint / 2.0d);
                }
            }
            //LibSys.StatusBar.Trace("toPixelLocation(" + loc + ")  x=" + xx + " y=" + yy);

            Point ret =  new Point(xx, yy);
            ret.Offset(m_pictureManager.OffsetXPrint, m_pictureManager.OffsetYPrint);
            return ret;
        }
开发者ID:slgrobotics,项目名称:QuakeMap,代码行数:62,代码来源:CameraManager.cs

示例2: toPixelLocation

        public override Point toPixelLocation(GeoCoord loc, ITile tile)
        {
            int xx = 0;
            int yy = 0;

            if(tile != null)
            {
                // the idea here is to simplify conversion for tiles around 180, when camera operates
                // on coordinates above 180 and below -180

                int offsetX = 0;
                int offsetY = 0;
                Point offset;

                if(!(offset=tile.getOffset()).IsEmpty)
                {
                    offsetX = offset.X;
                    offsetY = offset.Y;
                }

                GeoCoord tileTopLeft = tile.getTopLeft();
                GeoCoord tileTopLeftN = tileTopLeft.Clone();
                tileTopLeftN.Normalize();
                GeoCoord locN = loc.Clone();
                locN.Normalize();
                double dOffsetLng = locN.Lng - tileTopLeftN.Lng;
                double dOffsetLat = locN.Lat - tileTopLeftN.Lat;

                xx = (int)Math.Round((tileTopLeft.Lng + dOffsetLng - m_coverageTopLeft.Lng) / xScale) + offsetX;
                yy = (int)Math.Round((tileTopLeft.Lat + dOffsetLat - m_coverageTopLeft.Lat) / yScale) + offsetY;

                return new Point(xx, yy);
            }
            else
            {
                // express location longitude and latitude in terms of camera coordinates:
                double dOffsetLng = loc.Lng - m_location.Lng;
                while(dOffsetLng >= 180.0d)
                {
                    dOffsetLng -= 360.0d;
                }
                while(dOffsetLng <= -180.0d)
                {
                    dOffsetLng += 360.0d;
                }

                double dOffsetLat = loc.Lat - m_location.Lat;

                if(TileSetTerra.This.hasRenderedTiles && !TileSetTerra.This.RetilingSpecial && TileSetTerra.This.insideCurrentZone(loc) && insideScreenRectangle(loc))
                {
                    Point screenPt = TileSetTerra.This.toScreenPoint(loc, false);
                    return screenPt;
                }
                else
                {
                    xx = (int)Math.Round(dOffsetLng / xScale + pictureWidth / 2.0d);
                    yy = (int)Math.Round((loc.Lat - m_location.Lat) / yScale + pictureHeight / 2.0d);
                    return new Point(xx, yy);
                }
            }
        }
开发者ID:slgrobotics,项目名称:QuakeMap,代码行数:61,代码来源:CameraManager.cs


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