示例#1
0
        public LambertConformalConic1P(Ellipsoid <Meter, Degree> ellipsoid,
                                       double centralMeridian,
                                       double latitudeOfOrigin,
                                       double falseEasting  = 0,
                                       double falseNorthing = 0,
                                       double scaleFactor   = 1.0,
                                       int srid             = 0)
        {
            this._srid = srid;

            this._ellipsoid = ellipsoid;

            this._latitudeOfOrigin = latitudeOfOrigin;

            this._centralMeridian = centralMeridian;

            this._falseEasting = falseEasting;

            this._falseNorthing = falseNorthing;

            this._scaleFactor = scaleFactor;

            double m0 = MapProjects.CalculateM(ellipsoid.FirstEccentricity, latitudeOfOrigin * Math.PI / 180.0);

            double t0 = GeodeticLatitudeToT(latitudeOfOrigin, ellipsoid.FirstEccentricity);

            //REF: MAP PROJECTIONS-A WORKING MANUAL P.108
            this.n = Math.Sin(latitudeOfOrigin * Math.PI / 180);

            this.F = m0 / (n * Math.Pow(t0, n));

            this.rho0 = this._scaleFactor * ellipsoid.SemiMajorAxis.Value * this.F * Math.Pow(t0, n);
        }
        public LambertConformalConic(Ellipsoid <Meter, Degree> ellipsoid, double standardParallel1, double standardParallel2, double centralMeridian, double latitudeOfOrigin, double falseEasting = 0, double falseNorthing = 0, double scaleFactor = 1.0)
        {
            this._ellipsoid = ellipsoid;

            this._latitudeOfOrigin = latitudeOfOrigin;

            this._standardParallel1 = standardParallel1;

            this._standardParallel2 = standardParallel2;

            this._centralMeridian = centralMeridian;

            this._falseEasting = falseEasting;

            this._falseNorthing = falseNorthing;

            this._scaleFactor = scaleFactor;

            //this.scaleFactor = 1;
            double m1 = MapProjects.CalculateM(ellipsoid.FirstEccentricity, standardParallel1 * Math.PI / 180.0);
            double m2 = MapProjects.CalculateM(ellipsoid.FirstEccentricity, standardParallel2 * Math.PI / 180.0);

            double t0 = GeodeticLatitudeToT(latitudeOfOrigin, ellipsoid.FirstEccentricity);
            double t1 = GeodeticLatitudeToT(standardParallel1, ellipsoid.FirstEccentricity);
            double t2 = GeodeticLatitudeToT(standardParallel2, ellipsoid.FirstEccentricity);

            this.n = (Math.Log(m1) - Math.Log(m2)) / (Math.Log(t1) - Math.Log(t2));

            this.F = m1 / (n * Math.Pow(t1, n));

            this.rho0 = this._scaleFactor * ellipsoid.SemiMajorAxis.Value * this.F * Math.Pow(t0, n);
        }
 private Locateable AsLocateable(Point webMercatorPoint, Color color)
 {
     return(new Locateable(MapProjects.WebMercatorToGeodeticWgs84(webMercatorPoint))
     {
         Element = new Circle(1, new SolidColorBrush(color))
     });
 }
示例#4
0
        //public override Point FromGeodetic(Point point)
        //{
        //    return MapProjects.GeodeticToUTM(point, this._ellipsoid);
        //}

        //public override Point ToGeodetic(Point point)
        //{
        //    return MapProjects.UTMToGeodetic(point, this._ellipsoid, this._centralMeridian);
        //}

        public override IPoint FromGeodetic(IPoint point)
        {
            var tempLongitude = point.X - _centralMeridian;

            var tempLatitude = point.Y - _latitudeOfOrigin;

            var result = MapProjects.GeodeticToTransverseMercator(new Point(tempLongitude, tempLatitude), this._ellipsoid);

            return(new Point(result.X * _scaleFactor + _falseEasting, result.Y * _scaleFactor + _falseNorthing));
        }
示例#5
0
        private void RegisterMapOptionsForVertices(MouseButtonEventArgs e, IPoint point, Locateable locateable)
        {
            var presenter = new Jab.Common.Presenters.MapOptions.MapOptionsPresenter(
                rightToolTip: _copy,
                leftToolTip: _displayCoordinates,
                middleToolTip: _delete,

                rightSymbol: IRI.Jab.Common.Assets.ShapeStrings.Appbar.appbarPageCopy,
                leftSymbol: IRI.Jab.Common.Assets.ShapeStrings.CustomShapes.xY,
                middleSymbol: IRI.Jab.Common.Assets.ShapeStrings.Appbar.appbarDelete);

            presenter.RightCommandAction = i =>
            {
                var geodetic = MapProjects.WebMercatorToGeodeticWgs84(presenter.Location);

                Clipboard.SetDataObject($"{geodetic.X.ToString("n4")},{geodetic.Y.ToString("n4")}");

                this.RemoveMapOptions();
            };

            presenter.LeftCommandAction = i =>
            {
                //RequestFinishEditing?.Invoke(this._mercatorGeometry);
                if (_primaryVerticesLabelLayer.Items.Any(l => l.Id == locateable.Id))
                {
                    _primaryVerticesLabelLayer.Remove(locateable.Id);
                }
                else
                {
                    var element = new View.MapMarkers.CoordinateMarker(locateable.X, locateable.Y);

                    var auxLocateable = new Locateable(Model.AncherFunctionHandlers.CenterLeft)
                    {
                        Element = element, X = point.X, Y = point.Y, Id = locateable.Id
                    };

                    _primaryVerticesLabelLayer.Items.Add(auxLocateable);
                }

                this.RemoveMapOptions();
            };

            presenter.MiddleCommandAction = i =>
            {
                this._primaryVerticesLabelLayer.Remove(locateable.Id);

                TryDeleteVertex(point, this._webMercatorGeometry, _webMercatorGeometry.Type == GeometryType.Polygon);

                this.RequestRefresh?.Invoke(this);

                this.RemoveMapOptions();
            };

            RequestRightClickOptions?.Invoke(new View.MapOptions.MapThreeOptions(false), e, presenter);
        }
示例#6
0
        private void CopyCurrentPointCoordinateToClipboard()
        {
            var currentPoint = this._primaryVerticesLayer.FindSelectedLocatable();

            if (currentPoint == null)
            {
                return;
            }

            var geodetic = MapProjects.WebMercatorToGeodeticWgs84(new Point(currentPoint.X, currentPoint.Y));

            Clipboard.SetDataObject($"{geodetic.X.ToString("n4")},{geodetic.Y.ToString("n4")}");
        }
示例#7
0
        public async Task <GeoReferencedImage> GetTile(BoundingBox mbb, double mapScale)
        {
            WiseWebClient client = new WiseWebClient(50);

            var center = MapProjects.WebMercatorToGeodeticWgs84(mbb.Center);

            var zoom = IRI.Ham.SpatialBase.Mapping.WebMercatorUtility.GetZoomLevel(mapScale);

            var url = $@"https://maps.googleapis.com/maps/api/staticmap?center={center.Y},{center.X}&zoom={zoom}&size=256x256&maptype=roadmap&key=AIzaSyASDX3dnoItXvimcgmsfNgw3J2piODjx9E";

            var byteImage = await client.DownloadDataTaskAsync(url);

            return(new GeoReferencedImage(byteImage, mbb.Transform(MapProjects.WebMercatorToGeodeticWgs84)));
        }
示例#8
0
        private Locateable ToEdgeLengthLocatable(Point first, Point second)
        {
            Func <Point, Point> toGeodeticWgs84 = p => MapProjects.WebMercatorToGeodeticWgs84(p);

            var edge = new LineSegment <Point>(first, second);

            var element = new View.MapMarkers.RectangleLabelMarker(edge.GetLengthLabel(toGeodeticWgs84));

            //var offset = _screenToMap(15);

            return(new Locateable(Model.AncherFunctionHandlers.BottomCenter)
            {
                Element = element, X = edge.Middle.X, Y = edge.Middle.Y
            });
        }
示例#9
0
        public override TPoint ToGeodetic <TPoint>(TPoint point)
        {
            //return MapProjects.TransverseMercatorToGeodetic(point, this._ellipsoid);

            double tempX = (point.X - _falseEasting) / _scaleFactor;

            double tempY = (point.Y - _falseNorthing) / _scaleFactor;

            Point result = MapProjects.TransverseMercatorToGeodetic(new Point(tempX, tempY), _ellipsoid);

            return(new TPoint()
            {
                X = result.X + _centralMeridian,
                Y = result.Y + _latitudeOfOrigin
            });
        }
        static WebMercatorUtility()
        {
            MaxAllowableLatitude = 85.05112877822864;

            MaxIsometricLatitude = MapProjects.GeodeticLatitudeToIsometricLatitude(MaxAllowableLatitude, FirstEccentricity);

            MinIsometricLatitude = MapProjects.GeodeticLatitudeToIsometricLatitude(-MaxAllowableLatitude, FirstEccentricity);

            ZoomLevels = Enumerable.Range(0, 24).Reverse().Select(i => new ZoomScale(i, 591657550.50 / Math.Pow(2, i))).ToList();

            minZoomLevel = 1;

            maxZoomLevel = 22;

            //ZoomLevels = new List<ZoomScale>();

            //24:  591657550.50 / 2 ^ (24 - 1) = 70.5311
            //23:  591657550.50 / 2 ^ (23 - 1) = 141.0622
            //22:  591657550.50 / 2 ^ (22 - 1) = 282.1243
            //21:  591657550.50 / 2 ^ (21 - 1) = 564.2486
            //20:  591657550.50 / 2 ^ (20 - 1) = 1128.4972

            //TO SUPPORT CORRECT ZOOM LEVEL
            //ZoomLevels.Add(new ZoomScale(20, double.Epsilon));

            //ZoomLevels.Add(new ZoomScale(19, 1128.497220));
            //ZoomLevels.Add(new ZoomScale(18, 2256.994440));
            //ZoomLevels.Add(new ZoomScale(17, 4513.988880));
            //ZoomLevels.Add(new ZoomScale(16, 9027.977761));
            //ZoomLevels.Add(new ZoomScale(15, 18055.955520));
            //ZoomLevels.Add(new ZoomScale(14, 36111.911040));
            //ZoomLevels.Add(new ZoomScale(13, 72223.822090));
            //ZoomLevels.Add(new ZoomScale(12, 144447.644200));
            //ZoomLevels.Add(new ZoomScale(11, 288895.288400));
            //ZoomLevels.Add(new ZoomScale(10, 577790.576700));
            //ZoomLevels.Add(new ZoomScale(9, 1155581.153000));
            //ZoomLevels.Add(new ZoomScale(8, 2311162.307000));
            //ZoomLevels.Add(new ZoomScale(7, 4622324.614000));
            //ZoomLevels.Add(new ZoomScale(6, 9244649.227000));
            //ZoomLevels.Add(new ZoomScale(5, 18489298.450000));
            //ZoomLevels.Add(new ZoomScale(4, 36978596.910000));
            //ZoomLevels.Add(new ZoomScale(3, 73957193.820000));
            //ZoomLevels.Add(new ZoomScale(2, 147914387.600000));
            //ZoomLevels.Add(new ZoomScale(1, 295828775.300000));
            //ZoomLevels.Add(new ZoomScale(0, 591657550.500000));
        }
        private void mainElement_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
        {
            var mainLocateable = sender as Locateable;

            var presenter = new Jab.Common.Presenters.MapOptions.MapOptionsPresenter(
                rightToolTip: string.Empty,
                leftToolTip: string.Empty,
                middleToolTip: string.Empty,

                rightSymbol: IRI.Jab.Common.Assets.ShapeStrings.Appbar.appbarClipboard,
                leftSymbol: IRI.Jab.Common.Assets.ShapeStrings.Appbar.appbarAdd,
                middleSymbol: IRI.Jab.Common.Assets.ShapeStrings.Appbar.appbarDelete);

            presenter.RightCommandAction = i =>
            {
                var geodetic = MapProjects.WebMercatorToGeodeticWgs84(mainLocateable.Location.AsPoint());

                System.Windows.Clipboard.SetDataObject($"{geodetic.X.ToString("n4")},{geodetic.Y.ToString("n4")}");

                this.RemoveMapOptions();
            };

            presenter.LeftCommandAction = i =>
            {
                Add(mainLocateable);

                this.RemoveMapOptions();
            };

            presenter.MiddleCommandAction = i =>
            {
                //delete mainlocateable
                Remove(mainLocateable);

                this.RemoveMapOptions();
            };

            if (RequestRightClickOptions != null)
            {
                RequestRightClickOptions(new View.MapOptions.MapThreeOptions(), e, presenter);
            }
        }
示例#12
0
        public void MainTest()
        {
            var    clarke  = IRI.Ham.CoordinateSystem.Ellipsoids.Clarke1880Rgs;
            double phi0    = 32.5;
            double phi1    = 29.65508274166;
            double phi2    = 35.31468809166;
            double lambda0 = 45.0;
            var    niocLcc = new LambertConformalConic(clarke, phi1, phi2, lambda0, phi0, 1500000.0, 1166200.0, 0.9987864078);

            var xLccNioc = 2047473.33479;
            var yLccNioc = 912594.777238;

            var xWgs84 = 50.689721;
            var yWgs84 = 30.072906;

            var xWebMercator = 5642753.9243;
            var yWebMercator = 3512924.70491;

            var xClarke1880Rgs = 50.689721;
            var yClarke1880Rgs = 30.075637;


            var wgs84 = niocLcc.ToWgs84Geodetic(new Point(xLccNioc, yLccNioc));

            Assert.AreEqual(xWgs84, wgs84.X, 1E-6);
            Assert.AreEqual(yWgs84, wgs84.Y, 1E-6);

            var clarke1880 = niocLcc.ToGeodetic(new Point(xLccNioc, yLccNioc));

            Assert.AreEqual(xClarke1880Rgs, clarke1880.X, 1E-6);
            Assert.AreEqual(yClarke1880Rgs, clarke1880.Y, 1E-6);

            var webMercator = MapProjects.GeodeticWgs84ToWebMercator(wgs84);

            Assert.AreEqual(xWebMercator, webMercator.X, 0.05);
            Assert.AreEqual(yWebMercator, webMercator.Y, 0.05);

            var clarke1880_2 = Transformation.ChangeDatum(wgs84, Ellipsoids.WGS84, Ellipsoids.Clarke1880Rgs);

            Assert.AreEqual(xClarke1880Rgs, clarke1880_2.X, 1E-6);
            Assert.AreEqual(yClarke1880Rgs, clarke1880_2.Y, 1E-6);
        }
示例#13
0
        public static SrsBase AsSrsBase(int srid)
        {
            switch (srid)
            {
            case SridHelper.GeodeticWGS84:
                return(new NoProjection("Wgs84", Ellipsoids.WGS84));   // { DatumName = this.Geogcs.Values?.First() };

            case SridHelper.WebMercator:
                return(new WebMercator());

            case SridHelper.UtmNorthZone38:
                return(new UTM(Ellipsoids.WGS84, MapProjects.CalculateCentralMeridian(38)));

            case SridHelper.UtmNorthZone39:
                return(new UTM(Ellipsoids.WGS84, MapProjects.CalculateCentralMeridian(39)));

            case SridHelper.UtmNorthZone40:
                return(new UTM(Ellipsoids.WGS84, MapProjects.CalculateCentralMeridian(40)));

            case SridHelper.UtmNorthZone41:
                return(new UTM(Ellipsoids.WGS84, MapProjects.CalculateCentralMeridian(41)));

            default:
                return(null);
            }

            //public static CrsBase GetCrs(int srid)
            //{
            //    switch (srid)
            //    {
            //        case GeodeticWGS84:
            //            return DefaultMapProjections.
            //            break;

            //        case WebMercator:
            //            return new WebMercator();

            //        default:
            //            break;
            //    }
            //}
        }
示例#14
0
        /// <summary>
        /// Gets all map projects in the database
        /// </summary>
        /// <returns>All map projects in the database</returns>
        public static MapProjects GetAllMapProjects()
        {
            MapProjects toReturn = new MapProjects();
            MapProject temp = null;
            DataTable dt = null;
            string query = "SELECT * FROM MapProject";
            dt = DatabaseHelper.ExecuteTextCommandQuery(GetConnectionString(), query);

            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    temp = new MapProject();
                    temp.Name = DatabaseHelper.GetValidValueFromObject(dr["Name"], string.Empty);
                    temp.TileMaps = new TileEngine.Collections.TileMaps();
                    temp.Tileset = GetObjectDirectory(DatabaseHelper.GetValidValueFromObject(dr["Tileset"], (long)0));
                }
            }

            return toReturn;
        }
        public static Point LatLonToImageNumber(double geocentricLatitude, double geocentricLongitude, int zoom)
        {
            var tempLongitude = geocentricLongitude % 360;

            if (tempLongitude > 180)
            {
                tempLongitude -= 180;
            }
            else
            {
                tempLongitude += 180;
            }

            //This is not the total number of images. It's the number of images per row/column
            int numberOfImages = (int)Math.Pow(2, zoom);

            var xUnit = 360.0 / numberOfImages;

            var yUnit = (MaxIsometricLatitude - MinIsometricLatitude) / numberOfImages;

            var columnNumber = Math.Floor(tempLongitude / xUnit);

            var isoY = MapProjects.GeodeticLatitudeToIsometricLatitude(geocentricLatitude, FirstEccentricity);

            var rowNumber = isoY / yUnit;

            if (rowNumber < 0)
            {
                rowNumber = Math.Ceiling(-rowNumber) + Math.Ceiling(MaxIsometricLatitude / yUnit) - 1;
            }
            else
            {
                rowNumber = Math.Ceiling(MaxIsometricLatitude / yUnit) - Math.Ceiling(rowNumber);
            }

            return(new Point(columnNumber, rowNumber));
        }
示例#16
0
        public GeoTaggedImage(string imageFileName)
        {
            try
            {
                this.ImageFileName = imageFileName;

                var location = System.IO.Path.ChangeExtension(imageFileName, ".corx");

                if (System.IO.File.Exists(location))
                {
                    this.GeographicLocation = JsonConvert.DeserializeObject <Point3D>(System.IO.File.ReadAllText(location));

                    var webMercator = MapProjects.GeodeticWgs84ToWebMercator((Point)GeographicLocation);

                    this.MercatorLocation = new Point3D(webMercator.X, webMercator.Y, GeographicLocation.Z);
                }
                else
                {
                    using (var bitmap = new System.Drawing.Bitmap(imageFileName))
                    {
                        this.GeographicLocation = Helpers.ImageHelper.GetWgs84Location(bitmap);

                        var webMercator = MapProjects.GeodeticWgs84ToWebMercator((Point)GeographicLocation);

                        this.MercatorLocation = new Point3D(webMercator.X, webMercator.Y, GeographicLocation.Z);

                        System.IO.File.WriteAllText(location, JsonConvert.SerializeObject(this.GeographicLocation));
                    }
                }
            }
            catch (Exception)
            {
                this.GeographicLocation = Point3D.NaN;

                this.MercatorLocation = Point3D.NaN;
            }
        }
示例#17
0
        public static GoToPresenter Create(MapPresenter mapPresenter)
        {
            var gotoPresenter = new GoToPresenter(
                p =>
            {
                var webMercatorPoint = MapProjects.GeodeticWgs84ToWebMercator(p);

                mapPresenter.PanTo(webMercatorPoint, () =>
                {
                    mapPresenter.FlashPoint(webMercatorPoint);
                });
            },
                p =>
            {
                var webMercatorPoint = IRI.Ham.CoordinateSystem.MapProjection.MapProjects.GeodeticWgs84ToWebMercator(p);

                mapPresenter.ZoomToLevelAndCenter(13, webMercatorPoint, () =>
                {
                    mapPresenter.FlashPoint(webMercatorPoint);
                });
            });

            return(gotoPresenter);
        }
示例#18
0
 public override IPoint ToGeodetic(IPoint webMercator)
 {
     return(MapProjects.WebMercatorToGeodeticWgs84(webMercator));
 }
        public static BoundingBox GetWgs84ImageBoundingBox(int row, int column, int zoom)
        {
            int numberOfImages = (int)Math.Pow(2, zoom);

            var unit = 360.0 / numberOfImages;

            double minLongitude = column * unit;

            double maxLongitude = (column + 1) * unit;

            minLongitude = minLongitude - 180;

            maxLongitude = maxLongitude - 180;

            var yUnit = (MaxIsometricLatitude - MinIsometricLatitude) / numberOfImages;

            var maxTempRow = row;

            double minTempRow = row;

            if (row > numberOfImages / 2.0)
            {
                maxTempRow = (int)(row - numberOfImages / 2.0);

                minTempRow = maxTempRow + 1;

                yUnit *= -1;
            }
            else
            {
                maxTempRow = (int)(numberOfImages / 2.0) - row;

                minTempRow = maxTempRow - 1;
            }

            var latitude01 = MapProjects.IsometricLatitudeToGeodeticLatitude(maxTempRow * yUnit, FirstEccentricity);

            var latitude02 = MapProjects.IsometricLatitudeToGeodeticLatitude(minTempRow * yUnit, FirstEccentricity);

            double minLatitude, maxLatitude;

            if (latitude01 < latitude02)
            {
                minLatitude = latitude01;

                maxLatitude = latitude02;
            }
            else
            {
                minLatitude = latitude02;

                maxLatitude = latitude01;
            }

            //var min = Transformation.ChangeDatum(new Point(minLongitude, minLatitude), Ellipsoids.Sphere, Ellipsoids.WGS84);

            //var max = Transformation.ChangeDatum(new Point(maxLongitude, maxLatitude), Ellipsoids.Sphere, Ellipsoids.WGS84);

            //return new BoundingBox(min.X, min.Y, max.X, max.Y);

            return(new BoundingBox(minLongitude, minLatitude, maxLongitude, maxLatitude));
        }
        public static List <TileInfo> WebMercatorBoundingBoxToGoogleTileRegions(BoundingBox webMercatorBoundingBox, int zoomLevel)
        {
            var geographicBoundingBox = webMercatorBoundingBox.Transform(i => MapProjects.WebMercatorToGeodeticWgs84(i));

            return(GeodeticBoundingBoxToGoogleTileRegions(geographicBoundingBox, zoomLevel));
        }
示例#21
0
 public static SqlGeometry GeodeticToMercator(this SqlGeography geometry)
 {
     return(Project(geometry, point => MapProjects.GeodeticToMercator(point, IRI.Msh.CoordinateSystem.Ellipsoids.WGS84)));
 }
示例#22
0
 public static SqlGeometry GeodeticWgs84ToWebMercator(this SqlGeography geometry)
 {
     return(Project(geometry, point => MapProjects.GeodeticWgs84ToWebMercator(point), SridHelper.WebMercator));
 }
示例#23
0
 public static SqlGeometry GeodeticToCylindricalEqualArea(this SqlGeography geometry)
 {
     return(Project(geometry, point => MapProjects.GeodeticToCylindricalEqualArea <Point>(point, IRI.Msh.CoordinateSystem.Ellipsoids.WGS84)));
 }
        public static void WriteWebMercatorBoundingBoxToGoogleTileRegionsAsShapefile(string fileName, BoundingBox webMercatorBoundingBox, int zoomLevel)
        {
            var geographicBoundingBox = webMercatorBoundingBox.Transform(i => MapProjects.WebMercatorToGeodeticWgs84(i));

            WriteGeodeticBoundingBoxToGoogleTileRegionsAsShapefile(fileName, geographicBoundingBox, zoomLevel);
        }
示例#25
0
 public override IPoint FromGeodetic(IPoint geodeticWgs84)
 {
     return(MapProjects.GeodeticWgs84ToWebMercator(geodeticWgs84));
 }
 public override IPoint FromGeodetic(IPoint point)
 {
     return(MapProjects.GeodeticToCylindricalEqualArea(point, this._ellipsoid));
 }
示例#27
0
 public override TPoint FromGeodetic <TPoint>(TPoint point)
 {
     return(MapProjects.GeodeticToMercator(point, this._ellipsoid));
 }
示例#28
0
 public override TPoint ToGeodetic <TPoint>(TPoint point)
 {
     return(MapProjects.MercatorToGeodetic(point, this._ellipsoid));
 }
示例#29
0
        static SrsBases()
        {
            GeodeticWgs84 = new NoProjection();

            WebMercator = new WebMercator();

            //https://epsg.io/3200
            //LccFd58 = new LambertConformalConic(
            //   ellipsoid: Ellipsoids.FD58,
            //   standardParallel1: 29.655083333333333333333333333333,
            //   standardParallel2: 35.314694444444444444444444444444,
            //   centralMeridian: 45.0,
            //   latitudeOfOrigin: 32.5,
            //   falseEasting: 1500000.0,
            //   falseNorthing: 1166200.0,
            //   scaleFactor: 0.9987864078,
            //   srid: 3200);

            LccFd58 = new LambertConformalConic1P(
                ellipsoid: Ellipsoids.FD58,
                centralMeridian: 45.0,
                latitudeOfOrigin: 32.5,
                falseEasting: 1500000.0,
                falseNorthing: 1166200.0,
                scaleFactor: 0.9987864078,
                srid: 3200);


            LccNahrawanIraq = new LambertConformalConic2P(
                ellipsoid: Ellipsoids.NahrawanIraq,
                standardParallel1: 29.655083333333333333333333333333,
                standardParallel2: 35.314694444444444444444444444444,
                centralMeridian: 45.0,
                latitudeOfOrigin: 32.5,
                falseEasting: 1500000.0,
                falseNorthing: 1166200.0,
                scaleFactor: 1);


            LccNahrawan = new LambertConformalConic2P(
                ellipsoid: Ellipsoids.Nahrawan,
                standardParallel1: 29.655083333333333333333333333333,
                standardParallel2: 35.314694444444444444444444444444,
                centralMeridian: 45.0,
                latitudeOfOrigin: 32.5,
                falseEasting: 1500000.0,
                falseNorthing: 1166200.0,
                scaleFactor: 1);

            LccNiocWithClarcke1880Rgs = new LambertConformalConic2P(
                ellipsoid: Ellipsoids.Clarke1880Rgs,
                standardParallel1: 29.655083333333333333333333333333,
                standardParallel2: 35.314694444444444444444444444444,
                centralMeridian: 45.0,
                latitudeOfOrigin: 32.5,
                falseEasting: 1500000.0,
                falseNorthing: 1166200.0,
                scaleFactor: 0.9987864078);

            LccNiocWithWgs84 = new LambertConformalConic2P(
                ellipsoid: Ellipsoids.WGS84,
                standardParallel1: 29.65508274166,
                standardParallel2: 35.31468809166,
                centralMeridian: 45.0,
                latitudeOfOrigin: 32.5,
                falseEasting: 1500000.0,
                falseNorthing: 1166200.0,
                scaleFactor: 0.9987864078);

            UtmNorthZone38 = new UTM(Ellipsoids.WGS84, MapProjects.CalculateCentralMeridian(38));

            UtmNorthZone39 = new UTM(Ellipsoids.WGS84, MapProjects.CalculateCentralMeridian(39));

            UtmNorthZone40 = new UTM(Ellipsoids.WGS84, MapProjects.CalculateCentralMeridian(40));

            UtmNorthZone41 = new UTM(Ellipsoids.WGS84, MapProjects.CalculateCentralMeridian(41));
        }
 public override IPoint ToGeodetic(IPoint point)
 {
     return(MapProjects.CylindricalEqualAreaToGeodetic(point, this._ellipsoid));
 }
示例#31
0
        public BezierItem(sb.Point startPoint, sb.Point endPoint, Transform toScreen)
        {
            this._toScreen = toScreen;

            var start = toScreen.Transform(startPoint.AsWpfPoint());

            var end = toScreen.Transform(endPoint.AsWpfPoint());

            var startControlPoint = toScreen.Transform(startPoint.AsWpfPoint());

            var endControlPoint = toScreen.Transform(endPoint.AsWpfPoint());


            var bezierSegment = new BezierSegment(startControlPoint, endControlPoint, end, true);

            _bezierFigure = new PathFigure()
            {
                StartPoint = start
            };

            _bezierFigure.Segments.Add(bezierSegment);

            PathGeometry bezierPathGeometry = new PathGeometry(new List <PathFigure>()
            {
                _bezierFigure
            });

            //pathGeometry.Transform = this.panTransformForPoints;


            _startControlLineFigure = new PathFigure()
            {
                StartPoint = start
            };

            _startControlLineFigure.Segments.Add(new LineSegment(startControlPoint, true));


            _endControlLineFigure = new PathFigure()
            {
                StartPoint = end
            };

            _endControlLineFigure.Segments.Add(new LineSegment(endControlPoint, true));

            StartLocateable = new Locateable(MapProjects.WebMercatorToGeodeticWgs84(startPoint))
            {
                Element = new Common.View.MapMarkers.Circle(1, new SolidColorBrush(Colors.Green))
            };

            StartLocateable.OnPositionChanged += (sender, e) =>
            {
                var locateable = (Locateable)sender;

                var newPoint = toScreen.Transform(new System.Windows.Point(locateable.X, locateable.Y));

                _bezierFigure.StartPoint = newPoint;

                _startControlLineFigure.StartPoint = newPoint;

                //update();
            };


            EndLocateable = new Locateable(MapProjects.WebMercatorToGeodeticWgs84(endPoint))
            {
                Element = new Common.View.MapMarkers.Circle(1, new SolidColorBrush(Colors.Green))
            };

            EndLocateable.OnPositionChanged += (sender, e) =>
            {
                var locateable = (Locateable)sender;

                var newPoint = toScreen.Transform(new System.Windows.Point(locateable.X, locateable.Y));

                bezierSegment.Point3 = newPoint;

                _endControlLineFigure.StartPoint = newPoint;

                //update();
            };


            StartControlLocateable = new Locateable(MapProjects.WebMercatorToGeodeticWgs84(startControlPoint.AsPoint()))
            {
                Element = new Common.View.MapMarkers.Circle(1, new SolidColorBrush(Colors.Green))
            };

            StartControlLocateable.OnPositionChanged += (sender, e) =>
            {
                var locateable = (Locateable)sender;

                var newPoint = toScreen.Transform(new System.Windows.Point(locateable.X, locateable.Y));

                bezierSegment.Point1 = newPoint;

                (_startControlLineFigure.Segments.First() as LineSegment).Point = newPoint;

                //update();
            };


            EndControlLocateable = new Locateable(MapProjects.WebMercatorToGeodeticWgs84(endControlPoint.AsPoint()))
            {
                Element = new Common.View.MapMarkers.Circle(1, new SolidColorBrush(Colors.Green))
            };

            EndControlLocateable.OnPositionChanged += (sender, e) =>
            {
                var locateable = (Locateable)sender;

                var newPoint = toScreen.Transform(new System.Windows.Point(locateable.X, locateable.Y));

                bezierSegment.Point2 = newPoint;

                (_endControlLineFigure.Segments.First() as LineSegment).Point = newPoint;

                //update();
            };



            Path temp = new Path();

            temp.Data            = bezierPathGeometry;
            temp.Stroke          = new SolidColorBrush(Colors.Black);
            temp.StrokeThickness = 2;
            //temp.RenderTransform = this.panTransformForPoints;
            //temp.Tag = new LayerTag(0) { IsTiled = false, LayerType = LayerType.Drawing };

            //this.mapView.Children.Add(temp);

            //Path axLine2 = new Path() { Stroke = new SolidColorBrush(Colors.Gray), StrokeThickness = 1, RenderTransform = panTransformForPoints };
            Path axLine2 = new Path()
            {
                Stroke = new SolidColorBrush(Colors.Gray), StrokeThickness = 1
            };

            axLine2.Data = new PathGeometry(new List <PathFigure>()
            {
                _startControlLineFigure
            });
            //axLine2.Tag = new LayerTag(-1) { IsTiled = false, LayerType = LayerType.Drawing };
            //this.mapView.Children.Add(axLine2);

            //Path axLine3 = new Path() { Stroke = new SolidColorBrush(Colors.Gray), StrokeThickness = 1, RenderTransform = panTransformForPoints };
            Path axLine3 = new Path()
            {
                Stroke = new SolidColorBrush(Colors.Gray), StrokeThickness = 1
            };

            axLine3.Data = new PathGeometry(new List <PathFigure>()
            {
                _endControlLineFigure
            });
            //axLine3.Tag = new LayerTag(-1) { IsTiled = false, LayerType = LayerType.Drawing };
            //this.mapView.Children.Add(axLine3);
        }