Exemple #1
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            RestoreEnv();
            this._dt.Rows.Clear();
            string str = this.teRoadName.Text.Trim();
            object obj = this.cmbFCs.SelectedItem;

            WaitForm.Start("正在搜索...", "请稍后");
            try
            {
                if (obj == null)
                {
                    List <DF3DFeatureClass> list = Dictionary3DTable.Instance.GetFeatureClassByFacilityClassName("Road");
                    if (list != null && list.Count != 0)
                    {
                        foreach (DF3DFeatureClass dffc in list)
                        {
                            IFeatureClass fc  = dffc.GetFeatureClass();
                            FacilityClass fac = dffc.GetFacilityClass();
                            if (fc != null && fac != null)
                            {
                                SearchRes(fc, fac.GetFieldInfoNameBySystemName("Name"), str);
                            }
                        }
                    }
                }
                else
                {
                    if (obj is DF3DFeatureClass)
                    {
                        DF3DFeatureClass dffc = obj as DF3DFeatureClass;
                        IFeatureClass    fc   = dffc.GetFeatureClass();
                        FacilityClass    fac  = dffc.GetFacilityClass();
                        if (fc != null && fac != null)
                        {
                            SearchRes(fc, fac.GetFieldInfoNameBySystemName("Name"), str);
                        }
                    }
                }
            }
            catch (Exception ex) { }
            WaitForm.Stop();
        }
        private void btnSearch_Click(object sender, EventArgs e)
        {
            RestoreEnv();
            this._dt.Rows.Clear();
            string str = this.teName.Text.Trim();
            object obj = this.cmbFCs.SelectedItem;

            WaitForm.Start("正在搜索...", "请稍后");
            try
            {
                if (obj != null && obj is DF3DFeatureClass)
                {
                    DF3DFeatureClass dffc = obj as DF3DFeatureClass;
                    IFeatureClass    fc   = dffc.GetFeatureClass();
                    FacilityClass    fac  = dffc.GetFacilityClass();
                    if (fc != null && fac != null)
                    {
                        SearchRes(fc, fac.GetFieldInfoNameBySystemName("Name"), str);
                    }
                }
            }
            catch (Exception ex) { }
            WaitForm.Stop();
        }
Exemple #3
0
        private void ShowFlowDirect(IFeatureLayerPickResult pr)
        {
            if (pr == null)
            {
                return;
            }
            IRowBuffer row    = null;
            IFdeCursor cursor = null;

            try
            {
                int fid = pr.FeatureId;
                DF3DFeatureClass dffc = DF3DFeatureClassManager.Instance.GetFeatureClassByID(pr.FeatureLayer.FeatureClassId.ToString());
                if (dffc == null)
                {
                    return;
                }
                IFeatureClass fc  = dffc.GetFeatureClass();
                FacilityClass fac = dffc.GetFacilityClass();
                if (fc == null || fac == null || fac.Name != "PipeLine")
                {
                    return;
                }
                DFDataConfig.Class.FieldInfo fi = fac.GetFieldInfoBySystemName("FlowDirect");
                if (fi == null)
                {
                    return;
                }
                IFieldInfoCollection fiCol = fc.GetFields();
                int index = fiCol.IndexOf(fi.Name);
                if (index == -1)
                {
                    return;
                }
                int indexShape = fiCol.IndexOf("Shape");

                IQueryFilter filter = new QueryFilter();
                filter.WhereClause = "oid=" + fid;
                cursor             = fc.Search(filter, false);
                row = cursor.NextRow();
                if (row == null)
                {
                    return;
                }

                IPolyline line = null;
                if (indexShape != -1 && !row.IsNull(indexShape))
                {
                    object obj = row.GetValue(indexShape);
                    if (obj != null && obj is IPolyline)
                    {
                        line = obj as IPolyline;
                    }
                }
                string flowDirectValue = "0";
                int    type            = 1;// 1表示具有流向字段;2表示从高到低
                if (!row.IsNull(index))
                {
                    flowDirectValue = row.GetValue(index).ToString();
                    if (flowDirectValue != "0" && flowDirectValue != "1")
                    {
                        flowDirectValue = "0";
                    }
                    type = 1;
                }
                else if (line != null)
                {
                    if (line.StartPoint.Z > line.EndPoint.Z)
                    {
                        flowDirectValue = "0";
                    }
                    else
                    {
                        flowDirectValue = "1";
                    }
                    type = 2;
                }
                if (line == null)
                {
                    return;
                }

                if (this._isAuth)
                {
                    #region 流向渲染1
                    FacClassReg reg = FacilityInfoService.GetFacClassRegByFeatureClassID(fc.Guid.ToString());
                    if (reg == null)
                    {
                        return;
                    }
                    TopoClass tc = FacilityInfoService.GetTopoClassByFacClassCode(reg.FacClassCode);
                    if (tc == null)
                    {
                        return;
                    }
                    FacStyleClass        style          = null;
                    List <FacStyleClass> facilityStyles = FacilityInfoService.GetFacStyleByFacClassCode(reg.FacClassCode);
                    if ((facilityStyles != null) && (facilityStyles.Count > 0))
                    {
                        style = facilityStyles[0];
                    }
                    PipeLineFac       plfac = new PipeLineFac(reg, style, row, tc);
                    IRenderModelPoint rmp   = null;
                    DrawGeometry.Ocx = DF3DApplication.Application.Current3DMapControl;
                    plfac.ShowFlowDirection(int.Parse(flowDirectValue), out rmp);
                    if (rmp != null)
                    {
                        this._listRender.Add(rmp.Guid);
                    }
                    #endregion
                }
                else
                {
                    #region 流向渲染2
                    IEulerAngle angle    = DF3DApplication.Application.Current3DMapControl.Camera.GetAimingAngles2(line.StartPoint, line.EndPoint);
                    double      dia      = 0.0;
                    string      diaField = fac.GetFieldInfoNameBySystemName("Diameter");
                    int         indexDia = fiCol.IndexOf(diaField);
                    if (indexDia != -1 && !row.IsNull(indexDia))
                    {
                        string diaStr    = row.GetValue(indexDia).ToString();
                        int    indexDia1 = diaStr.ToString().IndexOf('*');
                        if (indexDia1 != -1)
                        {
                            var dia1 = int.Parse(diaStr.ToString().Substring(0, indexDia1));
                            var dia2 = int.Parse(diaStr.ToString().Substring(indexDia1 + 1, diaStr.ToString().Length));
                            dia = ((dia1 > dia2) ? dia1 : dia2) * 0.001;
                        }
                        else
                        {
                            dia = int.Parse(diaStr) * 0.001;
                        }
                    }
                    List <IPoint> points = new List <IPoint>();
                    if (flowDirectValue == "0")
                    {
                        for (int i = 0; i < line.PointCount; i++)
                        {
                            IPoint pt = line.GetPoint(i);
                            pt.Z += dia / 2;
                            points.Add(pt);
                        }
                    }
                    else if (flowDirectValue == "1")
                    {
                        for (int i = line.PointCount - 1; i >= 0; i--)
                        {
                            IPoint pt = line.GetPoint(i);
                            pt.Z += dia / 2;
                            points.Add(pt);
                        }
                    }
                    for (int i = 0; i < points.Count - 1; i++)
                    {
                        IPoint pt1 = points[i];
                        var    pt2 = points[i + 1];

                        double delt = 0;
                        double _rate, _distance;
                        if (!(Math.Abs(dia) < 0.0000001))
                        {
                            delt = 2.0 * dia;
                            if (dia <= 0.5 && dia >= 0.3)
                            {
                                _rate     = 7 * dia;
                                _distance = 3 * dia / 0.4;
                            }
                            else if (dia < 0.3 && dia > 0.1)
                            {
                                _rate     = 12 * dia;
                                _distance = 6 * dia / 0.4;
                            }
                            else if (dia <= 0.1)
                            {
                                _rate     = 22 * dia;
                                _distance = 9 * dia / 0.4;
                            }
                            else
                            {
                                _rate     = 3.5 * dia;
                                _distance = 1.5 * dia / 0.4;
                            }
                        }
                        else
                        {
                            _rate     = 2.0;
                            _distance = 3.0;
                            //z = maxZ + 0.2;
                            delt = 0.2;
                        }
                        List <IPoint> list = DisPerseLine(pt1, pt2, _distance);
                        if (list.Count < 2)
                        {
                            return;
                        }
                        List <IPoint>    list1   = new List <IPoint>();
                        IGeometryFactory geoFact = new GeometryFactoryClass();
                        for (int j = 0; j < list.Count - 1; j++)
                        {
                            IPoint p = geoFact.CreatePoint(gviVertexAttribute.gviVertexAttributeZ);
                            p.X = (list[j].X + list[j + 1].X) / 2;
                            p.Y = (list[j].Y + list[j + 1].Y) / 2;
                            p.Z = (list[j].Z + list[j + 1].Z) / 2;
                            list1.Add(p);
                        }

                        for (var m = 0; m < list1.Count; m++)
                        {
                            IPosition pos = new PositionClass();
                            pos.X            = list1[m].X;
                            pos.Y            = list1[m].Y;
                            pos.Altitude     = list1[m].Z + delt;
                            pos.AltitudeType = gviAltitudeType.gviAltitudeTerrainAbsolute;
                            pos.Heading      = angle.Heading;
                            pos.Tilt         = angle.Tilt;
                            pos.Roll         = angle.Roll;
                            UInt32 color;
                            if (type == 1)
                            {
                                color = 0xFFFFFF00;
                            }
                            else
                            {
                                color = 0xFF00FFFF;
                            }
                            ITerrainArrow rArrow = DF3DApplication.Application.Current3DMapControl.ObjectManager.CreateArrow(pos, 0.8 * _rate, 3, color, color, DF3DApplication.Application.Current3DMapControl.ProjectTree.RootID);
                            this._listRender.Add(rArrow.Guid);
                        }
                    }
                    #endregion
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                if (cursor != null)
                {
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(cursor);
                    cursor = null;
                }
                if (row != null)
                {
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(row);
                    row = null;
                }
            }
        }
        private void btnAnalyse_Click(object sender, EventArgs e)
        {
            try
            {
                this._dt.Rows.Clear();
                DF3DApplication app = DF3DApplication.Application;
                if (app == null || app.Current3DMapControl == null || !app.Current3DMapControl.Terrain.IsRegistered)
                {
                    return;
                }
                foreach (Guid g in this._listRender)
                {
                    app.Current3DMapControl.ObjectManager.DeleteObject(g);
                }
                this._listRender.Clear();

                WaitForm.Start("正在分析...", "请稍后");

                if (this._drawTool == null)
                {
                    return;
                }
                IGeometry geo = this._drawTool.GetGeo();
                if (geo == null || geo.GeometryType != gviGeometryType.gviGeometryPolygon)
                {
                    return;
                }
                IPolygon polygon = geo as IPolygon;
                IPoint   pt      = polygon.ExteriorRing.Midpoint;
                double   height  = double.Parse(this.seLimitHeight.Value.ToString());

                List <DF3DFeatureClass> list = Dictionary3DTable.Instance.GetFeatureClassByFacilityClassName(new string[] { "Building", "Structure" });
                if (list != null && list.Count != 0)
                {
                    foreach (DF3DFeatureClass dffc in list)
                    {
                        IFeatureClass fc  = dffc.GetFeatureClass();
                        IFeatureLayer fl  = dffc.GetFeatureLayer();
                        FacilityClass fac = dffc.GetFacilityClass();
                        if (fl != null)
                        {
                            if (fl.VisibleMask == gviViewportMask.gviViewNone)
                            {
                                continue;
                            }
                        }
                        if (fc != null)
                        {
                            IFieldInfoCollection fiCol = fc.GetFields();
                            int indexGeo = fiCol.IndexOf("Geometry");
                            if (indexGeo == -1)
                            {
                                continue;
                            }
                            int indexFid = fiCol.IndexOf(fc.FidFieldName);
                            if (indexFid == -1)
                            {
                                continue;
                            }
                            int indexName    = -1;
                            int indexAddress = -1;
                            int indexContact = -1;
                            if (fac != null)
                            {
                                indexName    = fiCol.IndexOf(fac.GetFieldInfoNameBySystemName("Name"));
                                indexAddress = fiCol.IndexOf(fac.GetFieldInfoNameBySystemName("Address"));
                                indexContact = fiCol.IndexOf(fac.GetFieldInfoNameBySystemName("Contact"));
                            }

                            IResourceManager resManager = fc.FeatureDataSet as IResourceManager;
                            if (resManager == null)
                            {
                                continue;
                            }

                            IRowBuffer row    = null;
                            IFdeCursor cursor = null;
                            try
                            {
                                ISpatialFilter filter = new SpatialFilter();
                                filter.Geometry      = geo;
                                filter.GeometryField = "Geometry";
                                filter.SpatialRel    = gviSpatialRel.gviSpatialRelIntersects;
                                cursor = fc.Search(filter, true);
                                while ((row = cursor.NextRow()) != null)
                                {
                                    IGeometry geoRow = row.GetValue(indexGeo) as IGeometry;
                                    if (geoRow != null && geoRow.GeometryType == gviGeometryType.gviGeometryModelPoint)
                                    {
                                        IModelPoint mp = geoRow as IModelPoint;
                                        IVector3    v3 = mp.AsMatrix().GetScale();
                                        //string name = mp.ModelName;
                                        //IModel m = resManager.GetModel(name);
                                        IEnvelope env           = mp.ModelEnvelope;
                                        double    terrainHeight = 0.0;
                                        if (app.Current3DMapControl.Terrain.IsRegistered)
                                        {
                                            terrainHeight = app.Current3DMapControl.Terrain.GetElevation(mp.X, mp.Y, gviGetElevationType.gviGetElevationFromDatabase);
                                        }
                                        double mpHeigth = env.Depth * v3.Z;
                                        if (mpHeigth > height)
                                        {
                                            DataRow dr = this._dt.NewRow();
                                            if (indexName != -1)
                                            {
                                                dr["Name"] = row.GetValue(indexName);
                                            }
                                            dr["fcName"] = string.IsNullOrEmpty(fc.AliasName) ? fc.Name : fc.AliasName;
                                            dr["fid"]    = row.GetValue(indexFid);
                                            dr["Geo"]    = row.GetValue(indexGeo);
                                            if (indexAddress != -1)
                                            {
                                                dr["Address"] = row.GetValue(indexAddress);
                                            }
                                            if (indexContact != -1)
                                            {
                                                dr["Contact"] = row.GetValue(indexContact);
                                            }
                                            dr["TerrainHeight"] = terrainHeight.ToString("0.00");
                                            dr["Height"]        = env.MaxZ.ToString("0.00");
                                            dr["OverHeight"]    = (mpHeigth - height).ToString("0.00");
                                            dr["fc"]            = fc;
                                            this._dt.Rows.Add(dr);
                                        }
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                            }
                            finally
                            {
                                if (row != null)
                                {
                                    System.Runtime.InteropServices.Marshal.ReleaseComObject(row);
                                    row = null;
                                }
                                if (cursor != null)
                                {
                                    System.Runtime.InteropServices.Marshal.ReleaseComObject(cursor);
                                    cursor = null;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex) { }
            finally
            {
                WaitForm.Stop();
            }
        }
        private void DataArcCheck()
        {
            //管线线表数据规范性检查
            int            i, j, k;
            string         strFld;
            string         strDicValue;
            IFeatureClass  pFeaClass;
            IFeatureCursor pFeaCursor;
            IQueryFilter   pFilter = new QueryFilterClass();
            //Dictionary<IFeatureClass, DataTable> dict = new Dictionary<IFeatureClass, DataTable>();
            IFeature pFea;

            string[] arrFc2DId;
            List <DF2DFeatureClass> List = new List <DF2DFeatureClass>();

            for (i = 0; i < m_arrPipeType.Count; i++)
            {
                MajorClass mc = m_arrPipeType[i] as MajorClass;
                arrFc2DId = mc.Fc2D.Split(';');
                if (arrFc2DId == null)
                {
                    continue;
                }
                foreach (string fc2DId in arrFc2DId)
                {
                    DF2DFeatureClass dffc = DF2DFeatureClassManager.Instance.GetFeatureClassByID(fc2DId);
                    if (dffc == null || dffc.GetFacilityClassName() != "PipeLine")
                    {
                        continue;
                    }
                    IFeatureClass fc = dffc.GetFeatureClass();
                    if (fc == null)
                    {
                        continue;
                    }
                    //if (fc.ShapeType == ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline)
                    //{
                    List.Add(dffc);
                    //}
                }
            }

            //List<DF2DFeatureClass> List = Dictionary2DTable.Instance.GetFeatureClassByFacilityClassName("PipeLine");
            if (List == null)
            {
                return;
            }
            WaitForm.Start("开始检查..", "请稍后");
            foreach (DF2DFeatureClass dfcc in List)
            {
                bool   b1 = false, b2 = false, b3 = false, b4 = false;
                string strPipeClass;
                pFeaClass = dfcc.GetFeatureClass();
                if (pFeaClass == null)
                {
                    continue;
                }
                WaitForm.SetCaption("正在检查:" + pFeaClass.AliasName);
                FacilityClass fac = dfcc.GetFacilityClass();
                if (fac == null)
                {
                    continue;
                }
                List <DFDataConfig.Class.FieldInfo> listField = fac.FieldInfoCollection;
                DFDataConfig.Class.FieldInfo        fi        = fac.GetFieldInfoBySystemName("StartHeight2D");
                if (fi == null)
                {
                    continue;
                }
                DFDataConfig.Class.FieldInfo fi1 = fac.GetFieldInfoBySystemName("EndHeight");
                if (fi1 == null)
                {
                    continue;
                }
                DFDataConfig.Class.FieldInfo fi2 = fac.GetFieldInfoBySystemName("StartDep");
                if (fi2 == null)
                {
                    continue;
                }
                DFDataConfig.Class.FieldInfo fi3 = fac.GetFieldInfoBySystemName("EndDep");
                if (fi3 == null)
                {
                    continue;
                }
                DFDataConfig.Class.FieldInfo fi4 = fac.GetFieldInfoBySystemName("CoverStyle");
                if (fi4 == null)
                {
                    continue;
                }
                DFDataConfig.Class.FieldInfo fi5 = fac.GetFieldInfoBySystemName("Diameter");
                if (fi5 == null)
                {
                    continue;
                }
                if (pFeaClass.AliasName.Contains("燃气"))
                {
                    strPipeClass = "BP";
                }
                else if (pFeaClass.AliasName.Contains("下水"))
                {
                    strPipeClass = "DP";
                }
                else if (pFeaClass.AliasName.Contains("电力"))
                {
                    strPipeClass = "EP";
                }
                else if (pFeaClass.AliasName.Contains("上水") || pFeaClass.AliasName.Contains("给水"))
                {
                    strPipeClass = "FP";
                }
                else if (pFeaClass.AliasName.Contains("热力"))
                {
                    strPipeClass = "HP";
                }
                else if (pFeaClass.AliasName.Contains("通信"))
                {
                    strPipeClass = "TP";
                }
                else if (pFeaClass.AliasName.Contains("工业"))
                {
                    strPipeClass = "IOP";
                }
                else
                {
                    strPipeClass = "";
                }
                //数据字典字段值检查
                DataTable dt = GetDataTableByStruture();
                //遍历字段
                for (j = 0; j < ArcField.Length; j++)
                {
                    if (fac.GetFieldInfoBySystemName(ArcField[j]) == null)
                    {
                        continue;
                    }
                    //获取数据字典中的对应值
                    strFld      = fac.GetFieldInfoNameBySystemName(ArcField[j]);
                    strDicValue = GetValueFromDictionary(strPipeClass, strFld);

                    if (strDicValue != "空")
                    {
                        if (strDicValue.Contains(","))
                        {
                            string   strWhere = "(";
                            string[] s        = strDicValue.Split(new char[] { ',' });
                            for (k = 0; k < s.Length; k++)
                            {
                                strWhere += "'" + s[k] + "',";
                            }
                            strWhere.Remove(strWhere.LastIndexOf(","));
                            strWhere           += ")";
                            pFilter.WhereClause = strFld + " not in" + strWhere;
                        }
                        else
                        {
                            pFilter.WhereClause = strFld + "<>'" + strDicValue + "'";
                        }

                        pFeaCursor = pFeaClass.Search(pFilter, true);
                        while ((pFea = pFeaCursor.NextFeature()) != null)
                        {
                            DataRow dr = dt.NewRow();
                            dr["ErrorFeatureID"] = pFea.OID;
                            dr["FeatureofClass"] = pFeaClass.AliasName;
                            dr["FeatureofLayer"] = (pFeaClass as IDataset).Name;
                            dr["FeatureClass"]   = pFeaClass;
                            dr["ErrorType"]      = "【" + strFld + "】字段值不属于数据字典";
                            dt.Rows.Add(dr);
                            //Console.WriteLine(pFea.OID + " " + pFeaClass.AliasName);
                        }
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(pFeaCursor);
                    }
                    //if (dt.Rows.Count > 0) dict[pFeaClass] = dt;
                }
                //if (dt.Rows.Count > 0) dict[pFeaClass] = dt;

                pFilter.WhereClause = fi.Name + "= -999 or " + fi1.Name + "= -999";
                pFeaCursor          = pFeaClass.Search(pFilter, true);
                while ((pFea = pFeaCursor.NextFeature()) != null)
                {
                    DataRow dr = dt.NewRow();
                    dr["ErrorFeatureID"] = pFea.OID;
                    dr["FeatureofClass"] = pFeaClass.AliasName;
                    dr["FeatureofLayer"] = (pFeaClass as IDataset).Name;
                    dr["ErrorType"]      = "【管线高程】字段值不能为-999";
                    dr["FeatureClass"]   = pFeaClass;
                    dt.Rows.Add(dr);
                    //Console.WriteLine(pFea.OID + " " + pFeaClass.AliasName);
                }
                System.Runtime.InteropServices.Marshal.ReleaseComObject(pFeaCursor);
                //if (dt.Rows.Count > 0) dict[pFeaClass] = dt;

                //管线埋深(只针对管线,管点不需要检查)
                if (strPipeClass == "BP")
                {
                    pFilter.WhereClause = "(" + fi2.Name + "< 0 or " + fi2.Name + "> 3) or (" + fi3.Name + "< 0 or " + fi3.Name + "> 3)";
                    pFeaCursor          = pFeaClass.Search(pFilter, true);
                    while ((pFea = pFeaCursor.NextFeature()) != null)
                    {
                        DataRow dr = dt.NewRow();
                        dr["ErrorFeatureID"] = pFea.OID;
                        dr["FeatureofClass"] = pFeaClass.AliasName;
                        dr["FeatureofLayer"] = (pFeaClass as IDataset).Name;
                        dr["FeatureClass"]   = pFeaClass;
                        dr["ErrorType"]      = "【管线埋深】字段值不在规范值范围内";
                        dt.Rows.Add(dr);
                        //Console.WriteLine(pFea.OID + " " + pFeaClass.AliasName);
                    }
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(pFeaCursor);
                    //if (dt.Rows.Count > 0) dict[pFeaClass] = dt;
                }
                else
                {
                    //'直埋', '管埋', '管块'
                    pFilter.WhereClause = fi4.Name + " in ('直埋','管埋','管块') and (" + fi2.Name + "< 0 or " + fi2.Name + "> 10) or (" + fi3.Name + "< 0 or " + fi3.Name + "> 10)";
                    pFeaCursor          = pFeaClass.Search(pFilter, true);
                    while ((pFea = pFeaCursor.NextFeature()) != null)
                    {
                        DataRow dr = dt.NewRow();
                        dr["ErrorFeatureID"] = pFea.OID;
                        dr["FeatureofClass"] = pFeaClass.AliasName;
                        dr["FeatureofLayer"] = (pFeaClass as IDataset).Name;
                        dr["FeatureClass"]   = pFeaClass;
                        dr["ErrorType"]      = "【管线埋深】字段值不在规范值范围内";
                        dt.Rows.Add(dr);
                        //Console.WriteLine(pFea.OID + " " + pFeaClass.AliasName);
                    }
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(pFeaCursor);
                    //if (dt.Rows.Count > 0) dict[pFeaClass] = dt;
                }
                //'架空'

                pFilter.WhereClause = fi4.Name + "='架空' and (" + fi2.Name + ">0 or " + fi3.Name + ">0)";
                pFeaCursor          = pFeaClass.Search(pFilter, true);
                while ((pFea = pFeaCursor.NextFeature()) != null)
                {
                    DataRow dr = dt.NewRow();
                    dr["ErrorFeatureID"] = pFea.OID;
                    dr["FeatureofClass"] = pFeaClass.AliasName;
                    dr["FeatureofLayer"] = (pFeaClass as IDataset).Name;
                    dr["FeatureClass"]   = pFeaClass;
                    dr["ErrorType"]      = "【管线埋深】字段值不在规范值范围内";
                    dt.Rows.Add(dr);
                    //Console.WriteLine(pFea.OID + " " + pFeaClass.AliasName);
                }
                System.Runtime.InteropServices.Marshal.ReleaseComObject(pFeaCursor);
                //if (dt.Rows.Count > 0) dict[pFeaClass] = dt;

                pFilter.WhereClause = fi4.Name + "='管沟'";
                pFeaCursor          = pFeaClass.Search(pFilter, true);
                while ((pFea = pFeaCursor.NextFeature()) != null)
                {
                    string s = pFea.get_Value(pFeaClass.FindField(fi5.Name)).ToString();
                    if (s.Contains("*"))
                    {
                        if (s.Contains("*"))
                        {
                            double d  = Convert.ToDouble(s.Substring(s.IndexOf("*") + 1));
                            double d1 = Convert.ToDouble(pFea.get_Value(pFeaClass.FindField(fi2.Name)).ToString());
                            double d2 = Convert.ToDouble(pFea.get_Value(pFeaClass.FindField(fi3.Name)).ToString());
                            if (d1 < d || d2 < d)
                            {
                                DataRow dr = dt.NewRow();
                                dr["ErrorFeatureID"] = pFea.OID;
                                dr["FeatureofClass"] = pFeaClass.AliasName;
                                dr["FeatureofLayer"] = (pFeaClass as IDataset).Name;
                                dr["FeatureClass"]   = pFeaClass;
                                dr["ErrorType"]      = "【管线埋深】字段值不在规范值范围内";
                                dt.Rows.Add(dr);
                                //Console.WriteLine(pFea.OID + " " + pFeaClass.AliasName);
                            }
                        }
                    }
                }
                System.Runtime.InteropServices.Marshal.ReleaseComObject(pFeaCursor);
                //if (dt.Rows.Count > 0) dict[pFeaClass] = dt;

                //管径
                if (strPipeClass == "BP" || strPipeClass == "FP")
                {
                    pFilter.WhereClause = "ISNUMERIC(" + fi5.Name + ")=1";
                }
                else
                {
                    //直埋、管埋
                    pFilter.WhereClause = fi4.Name + " in ('直埋','管埋') and " + "ISNUMERIC(" + fi5.Name + ")=1";
                    pFeaCursor          = pFeaClass.Search(pFilter, true);
                    while ((pFea = pFeaCursor.NextFeature()) != null)
                    {
                        DataRow dr = dt.NewRow();
                        dr["ErrorFeatureID"] = pFea.OID;
                        dr["FeatureofClass"] = pFeaClass.AliasName;
                        dr["FeatureofLayer"] = (pFeaClass as IDataset).Name;
                        dr["FeatureClass"]   = pFeaClass;
                        dr["ErrorType"]      = "【管线规格】字段值不在规范值范围内";
                        dt.Rows.Add(dr);
                        //Console.WriteLine(pFea.OID + " " + pFeaClass.AliasName);
                    }

                    System.Runtime.InteropServices.Marshal.ReleaseComObject(pFeaCursor);
                    //if (dt.Rows.Count > 0) dict[pFeaClass] = dt;
                }

                pFilter.WhereClause = fi4.Name + " in ('管块','管沟') and " + fi5.Name + " like '%*%'";
                pFeaCursor          = pFeaClass.Search(pFilter, true);
                while ((pFea = pFeaCursor.NextFeature()) != null)
                {
                    DataRow dr = dt.NewRow();
                    dr["ErrorFeatureID"] = pFea.OID;
                    dr["FeatureofClass"] = pFeaClass.AliasName;
                    dr["FeatureofLayer"] = (pFeaClass as IDataset).Name;
                    dr["FeatureClass"]   = pFeaClass;
                    dr["ErrorType"]      = "【管线规格】字段值不在规范值范围内";
                    dt.Rows.Add(dr);
                    //Console.WriteLine(pFea.OID + " " + pFeaClass.AliasName);
                }
                System.Runtime.InteropServices.Marshal.ReleaseComObject(pFeaCursor);

                dt = ReturnMergeData(dt);
                if (dt.Rows.Count > 0)
                {
                    dict[pFeaClass] = dt;
                }
            }
        }
        private void DataPntCheck()
        {
            //管线点表数据规范性检查

            int            i, j, k;
            string         strFld;
            string         strDicValue;
            IFeatureClass  pFeaClass;
            IFeatureCursor pFeaCursor;
            IQueryFilter   pFilter = new QueryFilterClass();
            IFeature       pFea;

            string[] arrFc2DId;

            //Dictionary<IFeatureClass, DataTable> dict = new Dictionary<IFeatureClass, DataTable>();

            List <DF2DFeatureClass> list = new List <DF2DFeatureClass>();

            for (i = 0; i < m_arrPipeType.Count; i++)
            {
                MajorClass mc = m_arrPipeType[i] as MajorClass;
                arrFc2DId = mc.Fc2D.Split(';');
                if (arrFc2DId == null)
                {
                    continue;
                }
                foreach (string fc2DId in arrFc2DId)
                {
                    DF2DFeatureClass dffc = DF2DFeatureClassManager.Instance.GetFeatureClassByID(fc2DId);
                    if (dffc == null || dffc.GetFacilityClassName() != "PipeNode")
                    {
                        continue;
                    }
                    IFeatureClass fc = dffc.GetFeatureClass();
                    if (fc == null)
                    {
                        continue;
                    }
                    //if (fc.ShapeType == ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPoint)
                    //{
                    list.Add(dffc);
                    //}
                }
            }

            //List<DF2DFeatureClass> list = Dictionary2DTable.Instance.GetFeatureClassByFacilityClassName("PipeNode");
            if (list == null)
            {
                return;
            }
            WaitForm.Start("开始数据规范性检查..", "请稍候");
            foreach (DF2DFeatureClass dfcc in list)
            {
                bool   b1 = false, b2 = false, b3 = false, b4 = false;
                string strPipeClass;
                pFeaClass = dfcc.GetFeatureClass();
                if (pFeaClass == null)
                {
                    continue;
                }
                WaitForm.SetCaption("正在检查图层:" + " " + pFeaClass.AliasName);
                FacilityClass fac = dfcc.GetFacilityClass();
                if (fac == null)
                {
                    continue;
                }

                DFDataConfig.Class.FieldInfo fi = fac.GetFieldInfoBySystemName("SurfHeight2D");
                if (fi == null)
                {
                    continue;
                }
                DFDataConfig.Class.FieldInfo fi1 = fac.GetFieldInfoBySystemName("WellDep");
                if (fi1 == null)
                {
                    continue;
                }
                DFDataConfig.Class.FieldInfo fi2 = fac.GetFieldInfoBySystemName("Additional");
                if (fi2 == null)
                {
                    continue;
                }

                if (pFeaClass.AliasName.Contains("燃气"))
                {
                    strPipeClass = "BP";
                }
                else if (pFeaClass.AliasName.Contains("下水"))
                {
                    strPipeClass = "DP";
                }
                else if (pFeaClass.AliasName.Contains("电力"))
                {
                    strPipeClass = "EP";
                }
                else if (pFeaClass.AliasName.Contains("上水"))
                {
                    strPipeClass = "FP";
                }
                else if (pFeaClass.AliasName.Contains("热力"))
                {
                    strPipeClass = "HP";
                }
                else if (pFeaClass.AliasName.Contains("通信"))
                {
                    strPipeClass = "TP";
                }
                else if (pFeaClass.AliasName.Contains("工业"))
                {
                    strPipeClass = "IOP";
                }
                else
                {
                    strPipeClass = "";
                }
                // 数据字典字段值检查
                DataTable dt = GetDataTableByStruture();

                //遍历字段
                for (j = 0; j < PntField.Length; j++)
                {
                    if (fac.GetFieldInfoBySystemName(PntField[j]) == null)
                    {
                        continue;
                    }

                    //获取数据字典中的对应值
                    strFld      = fac.GetFieldInfoNameBySystemName(PntField[j]);
                    strDicValue = GetValueFromDictionary(strPipeClass, strFld);

                    if (strDicValue != "空")
                    {
                        if (strDicValue.Contains(","))
                        {
                            string   strWhere = "(";
                            string[] s        = strDicValue.Split(new char[] { ',' });
                            for (k = 0; k < s.Length; k++)
                            {
                                strWhere += "'" + s[k] + "',";
                            }
                            strWhere.Remove(strWhere.LastIndexOf(","));
                            strWhere           += ")";
                            pFilter.WhereClause = strFld + " not in" + strWhere;
                        }
                        else
                        {
                            pFilter.WhereClause = strFld + "<>'" + strDicValue + "'";
                        }
                        pFeaCursor = pFeaClass.Search(pFilter, true);
                        pFea       = null;

                        while ((pFea = pFeaCursor.NextFeature()) != null)
                        {
                            b1 = true;
                            DataRow dr = dt.NewRow();
                            dr["ErrorFeatureID"] = pFea.OID;
                            dr["FeatureofClass"] = pFeaClass.AliasName;
                            dr["FeatureofLayer"] = (pFeaClass as IDataset).Name;
                            dr["FeatureClass"]   = pFeaClass;
                            dr["ErrorType"]      = "【" + strFld + "】字段值不属于数据字典";
                            dt.Rows.Add(dr);
                            //Console.WriteLine(pFea.OID + " " + pFeaClass.AliasName);
                        }
                    }
                    if (dt.Rows.Count > 0)
                    {
                        dict[pFeaClass] = dt;
                    }
                }
                pFilter.WhereClause = fi.Name + "=-999";
                pFeaCursor          = pFeaClass.Search(pFilter, true);
                pFea = pFeaCursor.NextFeature();
                while (pFea != null)
                {
                    b2 = true;
                    DataRow dr = dt.NewRow();
                    dr["ErrorFeatureID"] = pFea.OID;
                    dr["FeatureofClass"] = pFeaClass.AliasName;
                    dr["FeatureofLayer"] = (pFeaClass as IDataset).Name;
                    dr["FeatureClass"]   = pFeaClass;
                    dr["ErrorType"]      = "【地面高程】字段值不能为-999";
                    dt.Rows.Add(dr);
                    pFea = pFeaCursor.NextFeature();
                }

                //if (dt.Rows.Count > 0) dict[pFeaClass] = dt;

                if (strPipeClass == "BP")
                {
                    pFilter.WhereClause = fi1.Name + "< 0 or " + fi1.Name + "> 3";
                }
                else if (strPipeClass == "IOP")
                {
                    pFilter.WhereClause = fi1.Name + "< 0 or " + fi1.Name + "> 5";
                }
                else
                {
                    pFilter.WhereClause = fi1.Name + "< 0 or " + fi1.Name + "> 10";
                }
                pFeaCursor = pFeaClass.Search(pFilter, true);
                while ((pFea = pFeaCursor.NextFeature()) != null)
                {
                    b3 = true;
                    DataRow dr = dt.NewRow();
                    dr["ErrorFeatureID"] = pFea.OID;
                    dr["FeatureofClass"] = pFeaClass.AliasName;
                    dr["FeatureofLayer"] = (pFeaClass as IDataset).Name;
                    dr["FeatureClass"]   = pFeaClass;
                    dr["ErrorType"]      = "【井底深】字段值不在规范值范围内";
                    dt.Rows.Add(dr);
                }

                //if (dt.Rows.Count > 0) dict[pFeaClass] = dt;

                pFilter.WhereClause = fi2.Name + " in ('阀门井','水表井','消防井','水源井','净水池','检修井','清水池','雨水检修井','污水检修井','跌水井','雨水篦',"
                                      + "'测试井','人孔','手孔','排气井','凝水井','通风井') and len(" + fi1.Name + ")=0";

                pFeaCursor = pFeaClass.Search(pFilter, true);
                while ((pFea = pFeaCursor.NextFeature()) != null)
                {
                    b4 = true;
                    DataRow dr = dt.NewRow();
                    dr["ErrorFeatureID"] = pFea.OID;
                    dr["FeatureofClass"] = pFeaClass.AliasName;
                    dr["FeatureofLayer"] = (pFeaClass as IDataset).Name;
                    dr["FeatureClass"]   = pFeaClass;
                    dr["ErrorType"]      = "【井底深】字段值不应为空";
                    dt.Rows.Add(dr);
                }

                dt = ReturnMergeData(dt);
                if (dt.Rows.Count > 0)
                {
                    dict[pFeaClass] = dt;
                }
            }
        }