Esempio n. 1
0
 public void importZrzFeatures(int dcxmId, List <IFeature> features)
 {
     foreach (IFeature feature in features)
     {
         ZRZ zrz = zrzServ.newZrz(dcxmId);
         zrz.SHAPE = ArcgisService.featureToDbGeometry(feature);
         zrzServ.saveWithoutValidate(zrz);
     }
 }
Esempio n. 2
0
        public void importZdFeatures(int dcxmId, List <IFeature> features)
        {
            foreach (IFeature feature in features)
            {
                ZDJBXX zd = zdServ.newZdjbxx();
                zd.SHAPE    = ArcgisService.featureToDbGeometry(feature);
                zd.QJDCXMID = dcxmId;

                zdServ.saveWithoutValidate(zd);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 获取多边形的折点集合
        /// </summary>
        /// <param name="shape"></param>
        /// <returns></returns>
        public static List <IPoint> getPolygonPoints(DbGeometry shape)
        {
            Polygon       p      = (Polygon)ArcgisService.dbGeometryToGeometry(shape);
            int           pCount = p.PointCount;
            List <IPoint> pList  = new List <IPoint>();

            for (int i = 0; i < pCount - 1; i++)
            {
                IPoint point = p.Point[i];
                pList.Add(point);
            }

            return(pList);
        }
Esempio n. 4
0
 private void saveJzdList(string zddm, int dcxmId, List <JZD> jzdList, DbContext ctx)
 {
     for (int i = 0; i < jzdList.Count; i++)
     {
         JZD jzd = jzdList[i];
         jzd.SXH      = i + 1;
         jzd.ZDDM     = zddm;
         jzd.QJDCXMID = dcxmId;
         if (jzd.SHAPE == null)
         {
             jzd.SHAPE = ArcgisService.pointToDbGeometry((double)jzd.X, (double)jzd.Y);
         }
         insertOrUpdate(jzd, ctx);
     }
 }
Esempio n. 5
0
        public List <string> findZddmIntersectZrz(ZRZ zrz)
        {
            ITable          table  = ArcgisService.queryTable("ZDJBXX", "ZT in (0,1)");
            IGeometry       geom   = ArcgisService.dbGeometryToGeometry(zrz.SHAPE);
            List <IFeature> list   = ArcgisService.spatialQuery(table as IFeatureClass, geom, esriSpatialRelEnum.esriSpatialRelIntersects);
            List <string>   result = new List <string>();

            foreach (IFeature feature in list)
            {
                int    idx_zddm = feature.Fields.FindField("ZDDM");
                string dm       = feature.Value[idx_zddm].ToString();
                result.Add(dm);
            }
            return(result);
        }
Esempio n. 6
0
        /// <summary>
        /// 从数据库中获取数据表记录
        /// </summary>
        /// <param name="tableName"></param>
        /// <param name="whereClause"></param>
        /// <returns></returns>
        public static ITable queryTable(string tableName, string whereClause)
        {
            ISqlWorkspace ws = ArcgisService.openBdcWorkspace() as ISqlWorkspace;

            string            query = "select * from " + tableName + " where 1=1 and " + whereClause;
            IQueryDescription q     = ws.GetQueryDescription(query);

            q.OIDFields = "fId";
            string qName = "";

            ws.CheckDatasetName(tableName, q, out qName);
            if (ws.OpenQueryCursor(query).NextRow() == null)
            {
                return(null);
            }
            ITable table = ws.OpenQueryClass(qName, q);

            return(table);
        }
Esempio n. 7
0
        public IFeatureLayer getDcxmLayer(int dcxmId, string tableName)
        {
            ISqlWorkspace ws = ArcgisService.openBdcWorkspace() as ISqlWorkspace;

            string            query = "select * from " + tableName + " where QJDCXM_ID=" + dcxmId;
            IQueryDescription q     = ws.GetQueryDescription(query);

            q.OIDFields    = "fId";
            q.GeometryType = esriGeometryType.esriGeometryPolygon;
            string qName = "";

            ws.CheckDatasetName(tableName, q, out qName);
            ITable table = ws.OpenQueryClass(qName, q);

            IFeatureLayer layer = new FeatureLayer();

            layer.FeatureClass = table as IFeatureClass;
            return(layer);
        }
Esempio n. 8
0
        public List <JZD> getJzdListFromShape(ZDJBXX zdjbxx)
        {
            List <IPoint> pList = ArcgisService.getPolygonPoints(zdjbxx.SHAPE);
            List <JZD>    list  = new List <JZD>();

            for (int i = 0; i < pList.Count; i++)
            {
                IPoint point = pList[i];
                double x     = point.X;
                double y     = point.Y;
                JZD    d     = new JZD();
                d.ZDDM  = zdjbxx.ZDDM;
                d.JZDLX = "1";
                d.JBLX  = "2";
                d.SXH   = i + 1;
                d.JZDH  = "J" + d.SXH;
                d.X     = Decimal.Round(new Decimal(x), 3);
                d.Y     = Decimal.Round(new Decimal(y), 3);
                d.SHAPE = ArcgisService.pointToDbGeometry(x, y);
                d.ZT    = 0;
                list.Add(d);
            }
            return(list);
        }