コード例 #1
0
 public bool AddNewRow(DotSpatial.Topology.IGeometry pPolygon, int pObjectId, string pDistrictAbbreviation, string pNameArabic, string pNameLatin, string pNamePopularArabic = "", string pNamePopularLatin= "", string pApproved = "N") {
     var mFeature = this.AddFeature(pPolygon);
     mFeature.DataRow.BeginEdit();
     mFeature.DataRow["OBJECTID"] = pObjectId;
     mFeature.DataRow["DISTRICTABBREVIATION"] = pDistrictAbbreviation;
     mFeature.DataRow["NAMEARABIC"] = pNameArabic;
     mFeature.DataRow["NAMELATIN"] = pNameLatin;
     mFeature.DataRow["NAMEPOPULARARABIC"] = pNamePopularArabic;
     mFeature.DataRow["NAMEPOPULARLATIN"] = pNamePopularLatin;
     mFeature.DataRow["APPROVED"] = pApproved;
     mFeature.DataRow.EndEdit();
     return true;
 }
コード例 #2
0
        /// <summary>
        /// Перепроецирует геометрию в WGS84 и возвращает набор точек
        /// </summary>
        /// <param name="input">Простые полигоны и полилинии из БД в системе координать UtmZone31N</param>
        /// <returns>Набор точек в системе координат WGS84 (SRID 4326)</returns>
        /// <remarks>Внимание! Многоконтурная геометрия не поддерживается</remarks>
        public LocationCollection UtmZone31nToWgs84Transform(DbGeometry input)
        {
            if (input == null)
            {
                return(null);
            }

            //Перевод геометрии в формат понятный для библиотеки DotSpatial
            byte[]    wkbBynary = input.AsBinary();
            WkbReader wkbReader = new WkbReader();

            DotSpatial.Topology.IGeometry geom = wkbReader.Read(wkbBynary);

            //Определение используемых проекций
            ProjectionInfo beninPrj = KnownCoordinateSystems.Projected.UtmWgs1984.WGS1984UTMZone31N;
            ProjectionInfo worldPrj = KnownCoordinateSystems.Geographic.World.WGS1984;

            //Создание массива точек Х1,У1,Х2,У2...Хn,Уn
            double[] pointArray = new double[geom.Coordinates.Count() * 2];
            double[] zArray     = new double[1];
            zArray[0] = 0;

            int counterX = 0; int counterY = 1;

            foreach (var coordinate in geom.Coordinates)
            {
                pointArray[counterX] = coordinate.X;
                pointArray[counterY] = coordinate.Y;

                counterX += 2;
                counterY += 2;
            }

            //Операция перепроецирования над массивом точек
            Reproject.ReprojectPoints(pointArray, zArray, beninPrj, worldPrj, 0, (pointArray.Length / 2));


            LocationCollection loc = new LocationCollection();

            counterX = 0; counterY = 1;

            foreach (var coordinate in geom.Coordinates)
            {
                loc.Add(new Location(pointArray[counterY], pointArray[counterX]));

                counterX += 2;
                counterY += 2;
            }

            return(loc);
        }
コード例 #3
0
        public bool AddNewRow(DotSpatial.Topology.IGeometry pLineString, int pDistrictId, int pRoadId, string pNameArabic, string pNameLatin, string pNamePopularArabic = "", string pNamePopularLatin = "", int pRoadClass = -1, int pApproved = 0)
        {
            var mFeature = this.AddFeature(pLineString);

            mFeature.DataRow.BeginEdit();
            mFeature.DataRow["DISTRICTID"]        = pDistrictId;
            mFeature.DataRow["ROADID"]            = pRoadId;
            mFeature.DataRow["NAMEARABIC"]        = pNameArabic;
            mFeature.DataRow["NAMELATIN"]         = pNameLatin;
            mFeature.DataRow["NAMEPOPULARARABIC"] = pNamePopularArabic;
            mFeature.DataRow["NAMEPOPULARLATIN"]  = pNamePopularLatin;
            mFeature.DataRow["ROADCLASS"]         = pRoadClass;
            mFeature.DataRow["APPROVED"]          = pApproved;
            mFeature.DataRow.EndEdit();
            return(true);
        }
コード例 #4
0
        private static DSGeometryCollection FromGeometryCollection(IGeometryCollection geometry, DSGeometryFactory factory, bool setUserData)
        {
            var dsGeometries = new DotSpatial.Topology.IGeometry[geometry.NumGeometries];

            for (var i = 0; i < dsGeometries.Length; i++)
            {
                dsGeometries[i] = FromGeometry(geometry.GetGeometryN(i), factory, setUserData);
            }

            var result = factory.CreateGeometryCollection(dsGeometries);

            if (setUserData)
            {
                result.UserData = geometry.UserData;
            }
            return(result);
        }
コード例 #5
0
        private static DSGeometryCollection FromGeometryCollection(IGeometryCollection geometry, DSGeometryFactory factory, bool setUserData)
        {
            var dsGeometries = new DotSpatial.Topology.IGeometry[geometry.NumGeometries];

            for (var i = 0; i < dsGeometries.Length; i++)
                dsGeometries[i] = FromGeometry(geometry.GetGeometryN(i), factory, setUserData);

            var result = factory.CreateGeometryCollection(dsGeometries);
            if (setUserData)
                result.UserData = geometry.UserData;
            return result;
        }