Ejemplo n.º 1
0
 public override void Init()
 {
     try
     {
         base.Init();
         FacilityClass fac = this._facClassReg.FacilityType;
         if (fac == null)
         {
             return;
         }
         DFDataConfig.Class.FieldInfo fi = null;
         bool bHaveTopHeight             = false;
         bool bHaveBottomHeight          = false;
         fi = fac.GetFieldInfoBySystemName("TopHeight");
         if (fi != null)
         {
             int index = this._rowInfo.FieldIndex(fi.Name);
             if (index != -1)
             {
                 this._topHeight = Fac.GetDouble(this._rowInfo, index);
                 bHaveTopHeight  = true;
             }
         }
         fi = fac.GetFieldInfoBySystemName("BottomHeight");
         if (fi != null)
         {
             int index = this._rowInfo.FieldIndex(fi.Name);
             if (index != -1)
             {
                 this._bottomHeight = Fac.GetDouble(this._rowInfo, index);
                 bHaveBottomHeight  = true;
             }
         }
         if (!(bHaveBottomHeight && bHaveTopHeight))
         {
             bool bHaveSurfHeight  = false;
             bool bHaveTopDepth    = false;
             bool bHaveBottomDepth = false;
             fi = fac.GetFieldInfoBySystemName("SurfHeight");
             if (fi != null)
             {
                 int index = this._rowInfo.FieldIndex(fi.Name);
                 if (index != -1)
                 {
                     this._surfH     = Fac.GetDouble(this._rowInfo, index);
                     bHaveSurfHeight = true;
                 }
             }
             if (bHaveSurfHeight)
             {
                 fi = fac.GetFieldInfoBySystemName("TopDepth");
                 if (fi != null)
                 {
                     int index = this._rowInfo.FieldIndex(fi.Name);
                     if (index != -1)
                     {
                         this._topDeep   = Fac.GetDouble(this._rowInfo, index);
                         bHaveTopDepth   = true;
                         this._topHeight = this._surfH - this._topDeep;
                     }
                     else
                     {
                         this._topHeight = 0.0;
                     }
                 }
                 else
                 {
                     this._topHeight = 0.0;
                 }
                 fi = fac.GetFieldInfoBySystemName("BottomDepth");
                 if (fi != null)
                 {
                     int index = this._rowInfo.FieldIndex(fi.Name);
                     if (index != -1)
                     {
                         this._bottomDeep   = Fac.GetDouble(this._rowInfo, index);
                         bHaveBottomDepth   = true;
                         this._bottomHeight = this._surfH - this._bottomDeep;
                     }
                     else
                     {
                         this._bottomHeight = 0.0;
                     }
                 }
                 else
                 {
                     this._bottomHeight = 0.0;
                 }
             }
             else
             {
                 this._topHeight    = 0.0;
                 this._bottomHeight = 0.0;
             }
         }
     }
     catch (Exception ex)
     {
     }
 }
Ejemplo n.º 2
0
        public override void Init()
        {
            try
            {
                base.Init();
                FacilityClass fac = this._facClassReg.FacilityType;
                if (fac == null)
                {
                    return;
                }
                DFDataConfig.Class.FieldInfo fi = fac.GetFieldInfoBySystemName("Height");
                if (fi != null)
                {
                    int index = this._rowInfo.FieldIndex(fi.Name);
                    if (index != -1)
                    {
                        this._height = Fac.GetDouble(this._rowInfo, index);
                    }
                }
                fi = fac.GetFieldInfoBySystemName("SurfHeight");
                if (fi != null)
                {
                    int index = this._rowInfo.FieldIndex(fi.Name);
                    if (index != -1)
                    {
                        this._surfH = Fac.GetDouble(this._rowInfo, index);
                    }
                }
                bool bHaveTopHeight = false;
                fi = fac.GetFieldInfoBySystemName("TopHeight");
                if (fi != null)
                {
                    int index = this._rowInfo.FieldIndex(fi.Name);
                    if (index != -1)
                    {
                        this._topH     = Fac.GetDouble(this._rowInfo, index);
                        bHaveTopHeight = true;
                    }
                }
                bool bHaveBottomHeight = false;
                fi = fac.GetFieldInfoBySystemName("BottomHeight");
                if (fi != null)
                {
                    int index = this._rowInfo.FieldIndex(fi.Name);
                    if (index != -1)
                    {
                        this._bottomH     = Fac.GetDouble(this._rowInfo, index);
                        bHaveBottomHeight = true;
                    }
                }
                if (!bHaveTopHeight && bHaveBottomHeight)
                {
                    this._topH = this.SurfH;
                }

                fi = fac.GetFieldInfoBySystemName("Direction");
                if (fi != null)
                {
                    int index = this._rowInfo.FieldIndex(fi.Name);
                    if (index != -1)
                    {
                        this._angleZ = Fac.GetDouble(this._rowInfo, index);
                    }
                }
                fi = fac.GetFieldInfoBySystemName("Additional");
                if (fi != null)
                {
                    int index = this._rowInfo.FieldIndex(fi.Name);
                    if (index != -1)
                    {
                        this._fusu = Fac.GetString(this._rowInfo, index);
                    }
                }
                fi = fac.GetFieldInfoBySystemName("Pitch");
                if (fi != null)
                {
                    int index = this._rowInfo.FieldIndex(fi.Name);
                    if (index != -1)
                    {
                        this._pitch = Fac.GetDouble(this._rowInfo, index);
                    }
                }
                fi = fac.GetFieldInfoBySystemName("Yaw");
                if (fi != null)
                {
                    int index = this._rowInfo.FieldIndex(fi.Name);
                    if (index != -1)
                    {
                        this._yaw = Fac.GetDouble(this._rowInfo, index);
                    }
                }
                if (this._style != null)
                {
                    if (this._style.Name.Contains("井") || this._style.Name.Contains("篦"))
                    {
                        this._IsWell  = true;
                        this._IsValve = false;
                        // 重新设置模型点Z坐标
                        if (base._geoGroup[1] != null && (base._geoGroup[1] as IPoint) != null)
                        {
                            IPoint pointValue = base._geoGroup[1] as IPoint;
                            if (this._topH != null && this._bottomH != null)
                            {
                                pointValue.Z = (this._topH + this._bottomH) / 2.0;
                            }
                            base._geoGroup[1] = pointValue;
                            base.SetValue("Shape", base._geoGroup[1]);
                        }
                    }
                    if (!this._IsWell && this._style.Name.Contains("阀"))
                    {
                        this._IsValve = true;
                        this._IsWell  = false;
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
Ejemplo n.º 3
0
        public List <PipeLineFac> GetTopoPipeLine()
        {
            if (this._tc == null)
            {
                return(null);
            }
            if (DF3DPipeCreateApp.App.PipeLib == null)
            {
                return(null);
            }
            IQueryFilter filter = null;
            IFdeCursor   o      = null;
            IRowBuffer   r      = null;
            Dictionary <string, List <int> > dictionary  = null;
            Dictionary <string, FacClassReg> dictReg     = null;
            Dictionary <int, int>            dictionary2 = null;
            List <PipeLineFac> list = null;

            try
            {
                IFeatureDataSet fds = DF3DPipeCreateApp.App.PipeLib.OpenFeatureDataset("DataSet_BIZ");
                if (fds == null)
                {
                    return(null);
                }
                IFeatureClass class2 = fds.OpenFeatureClass(this._tc.TopoTable);
                if (class2 == null)
                {
                    return(null);
                }
                filter = new QueryFilterClass
                {
                    WhereClause = string.Format("(P_FacClass = '{0}' and PNode = {1}) or (E_FacClass = '{0}' and ENode = {1})", this._facClassReg.FeatureClassId, base._oid),
                    SubFields   = "oid,A_FacClass,Edge,PNode,ENode"
                };
                int count = class2.GetCount(filter);
                if (count == 0)
                {
                    return(null);
                }
                dictionary  = new Dictionary <string, List <int> >();
                dictionary2 = new Dictionary <int, int>();
                dictReg     = new Dictionary <string, FacClassReg>();
                o           = class2.Search(filter, true);
                while ((r = o.NextRow()) != null)
                {
                    if (!r.IsNull(1) && !r.IsNull(2))
                    {
                        FacClassReg reg = GetFacClassReg(r.GetValue(1).ToString());
                        if (!dictionary.ContainsKey(reg.FacClassCode))
                        {
                            dictionary.Add(reg.FacClassCode, new List <int>());
                            dictReg.Add(reg.FacClassCode, reg);
                        }
                        dictionary[reg.FacClassCode].Add(Fac.GetInt(r, 2));
                        if (Fac.GetInt(r, 3) == this._oid)
                        {
                            dictionary2.Add(Fac.GetInt(r, 2), 0);
                        }
                        else
                        {
                            dictionary2.Add(Fac.GetInt(r, 2), 1);
                        }
                    }
                }
                if (dictionary.Count == 0)
                {
                    return(null);
                }
                list = new List <PipeLineFac>();
                foreach (KeyValuePair <string, List <int> > pair in dictionary)
                {
                    FacClassReg reg = dictReg[pair.Key];
                    if (reg.FacilityType.Name == "PipeLine")
                    {
                        IFeatureClass class3 = reg.GetFeatureClass();
                        o = class3.GetRows(pair.Value.ToArray(), false);
                        while ((r = o.NextRow()) != null)
                        {
                            int index = r.FieldIndex("StyleId");
                            if (index == -1)
                            {
                                continue;
                            }
                            FacStyleClass style = GetFacStyleByID(r.GetValue(index).ToString());
                            if (style != null)
                            {
                                PipeLineFac line = new PipeLineFac(reg, style, r, this._tc);
                                line.Tag = dictionary2[line.FeatureId];
                                list.Add(line);
                            }
                        }
                    }
                }
                return(list);
            }
            catch (Exception ex)
            {
                return(null);
            }
            finally
            {
                if (o != null)
                {
                    Marshal.ReleaseComObject(o);
                    o = null;
                }
                if (r != null)
                {
                    Marshal.ReleaseComObject(r);
                    r = null;
                }
            }
        }
Ejemplo n.º 4
0
        public override void Init()
        {
            try
            {
                base.Init();

                FacilityClass fac = this._facClassReg.FacilityType;
                if (fac == null)
                {
                    return;
                }
                #region 设置管径
                bool bHaveDia1 = false;
                bool bHaveDia2 = false;
                bool bHaveDia  = false;
                DFDataConfig.Class.FieldInfo fiDiameter1 = fac.GetFieldInfoBySystemName("Diameter1");
                if (fiDiameter1 != null)
                {
                    int indexDiameter1 = this._rowInfo.FieldIndex(fiDiameter1.Name);
                    if (indexDiameter1 != -1)
                    {
                        string diaInfo1 = "";
                        if (!this._rowInfo.IsNull(indexDiameter1) && !string.IsNullOrEmpty(diaInfo1 = this._rowInfo.GetValue(indexDiameter1).ToString()))
                        {
                            this._dia1 = double.Parse(diaInfo1) * 0.001;
                            bHaveDia1  = true;
                        }
                    }
                }
                DFDataConfig.Class.FieldInfo fiDiameter2 = fac.GetFieldInfoBySystemName("Diameter2");
                if (fiDiameter2 != null)
                {
                    int indexDiameter2 = this._rowInfo.FieldIndex(fiDiameter2.Name);
                    if (indexDiameter2 != -1)
                    {
                        string diaInfo2 = "";
                        if (!this._rowInfo.IsNull(indexDiameter2) && !string.IsNullOrEmpty(diaInfo2 = this._rowInfo.GetValue(indexDiameter2).ToString()))
                        {
                            this._dia2 = double.Parse(diaInfo2) * 0.001;
                            bHaveDia2  = true;
                        }
                    }
                }
                if (bHaveDia1 && bHaveDia2)
                {
                    bHaveDia = true;
                }
                else
                {
                    DFDataConfig.Class.FieldInfo fiDiameter = fac.GetFieldInfoBySystemName("Diameter");
                    if (fiDiameter != null)
                    {
                        int indexDiameter = this._rowInfo.FieldIndex(fiDiameter.Name);
                        if (indexDiameter != -1)
                        {
                            string diaInfo    = "";
                            string coverstyle = "";
                            if (!this._rowInfo.IsNull(indexDiameter) && !string.IsNullOrEmpty(diaInfo = this._rowInfo.GetValue(indexDiameter).ToString()))
                            {
                                DFDataConfig.Class.FieldInfo fiCoverStyle = fac.GetFieldInfoBySystemName("CoverStyle");
                                if (fiCoverStyle != null)
                                {
                                    int indexCoverStyle = this._rowInfo.FieldIndex(fiCoverStyle.Name);
                                    if (indexCoverStyle != -1 && !this._rowInfo.IsNull(indexCoverStyle))
                                    {
                                        coverstyle = this._rowInfo.GetValue(indexCoverStyle).ToString();
                                    }
                                }
                                SplitDiameter(diaInfo, coverstyle, out this._dia1, out this._dia2);
                                if (this._rowInfo.FieldIndex(fiDiameter.Name + "1") != -1)
                                {
                                    this._rowInfo.SetValue(this._rowInfo.FieldIndex(fiDiameter.Name + "1"), this._dia1);
                                }
                                if (this._rowInfo.FieldIndex(fiDiameter.Name + "2") != -1)
                                {
                                    this._rowInfo.SetValue(this._rowInfo.FieldIndex(fiDiameter.Name + "2"), this._dia1);
                                }
                                bHaveDia    = true;
                                this._dia1 *= 0.001;
                                this._dia2 *= 0.001;
                            }
                        }
                    }
                }
                if (!bHaveDia || (this._dia1 < 0.000001 && this._dia2 < 0.000001))
                {
                    this._dia1 = 0.05;
                    this._dia2 = 0.0;
                }
                this._segtype = GetSegType(this._dia1, this._dia2);
                #endregion

                // 设置管线对象二维Shape数据-顶点坐标\高程信息
                IPolyline route = null;
                if ((this._style != null) && (this._style is PipeLineStyleClass))
                {
                    PipeLineStyleClass style = this._style as PipeLineStyleClass;
                    switch (style.HeightParam)
                    {
                    case HeightParam.PipeHeight:
                        DFDataConfig.Class.FieldInfo fiStartHeight = fac.GetFieldInfoBySystemName("StartHeight");
                        if (fiStartHeight != null)
                        {
                            int indexStartHeight = this._rowInfo.FieldIndex(fiStartHeight.Name);
                            if (indexStartHeight != -1)
                            {
                                this._sheight = Fac.GetDouble(base._rowInfo, indexStartHeight);
                                if (double.IsNaN(this._sheight))
                                {
                                    this._sheight = 0.0;
                                }
                            }
                        }
                        DFDataConfig.Class.FieldInfo fiEndHeight = fac.GetFieldInfoBySystemName("EndHeight");
                        if (fiEndHeight != null)
                        {
                            int indexEndHeight = this._rowInfo.FieldIndex(fiEndHeight.Name);
                            if (indexEndHeight != -1)
                            {
                                this._eheight = Fac.GetDouble(base._rowInfo, indexEndHeight);
                            }
                            if (double.IsNaN(this._eheight))
                            {
                                this._eheight = 0.0;
                            }
                        }
                        // 根据管线起始点高程计算中间点高程,并替换设施对象中Shape二维数据

                        if (this.GetPipeLineVertexs(base._geoGroup[2], this._sheight, this._eheight, out route))
                        {
                            base._geoGroup[1] = route;
                            base.SetValue("Shape", base._geoGroup[1]);
                        }
                        break;

                    case HeightParam.LineSurfH2Deep:
                        DFDataConfig.Class.FieldInfo fiStartSurfHeight = fac.GetFieldInfoBySystemName("StartSurfHeight");
                        if (fiStartSurfHeight != null)
                        {
                            int indexStartSurfHeight = this._rowInfo.FieldIndex(fiStartSurfHeight.Name);
                            if (indexStartSurfHeight != -1)
                            {
                                this._ssurfh = Fac.GetDouble(base._rowInfo, indexStartSurfHeight);
                                if (double.IsNaN(this._ssurfh))
                                {
                                    this._ssurfh = 0.0;
                                }
                            }
                        }
                        DFDataConfig.Class.FieldInfo fiStartDepth = fac.GetFieldInfoBySystemName("StartDepth");
                        if (fiStartDepth != null)
                        {
                            int indexStartDepth = this._rowInfo.FieldIndex(fiStartDepth.Name);
                            if (indexStartDepth != -1)
                            {
                                this._sdeep = Fac.GetDouble(base._rowInfo, indexStartDepth);
                                if (double.IsNaN(this._sdeep))
                                {
                                    this._sdeep = 0.0;
                                }
                            }
                        }
                        DFDataConfig.Class.FieldInfo fiEndSurfHeight = fac.GetFieldInfoBySystemName("EndSurfHeight");
                        if (fiEndSurfHeight != null)
                        {
                            int indexEndSurfHeight = this._rowInfo.FieldIndex(fiEndSurfHeight.Name);
                            if (indexEndSurfHeight != -1)
                            {
                                this._esurfh = Fac.GetDouble(base._rowInfo, indexEndSurfHeight);
                                if (double.IsNaN(this._esurfh))
                                {
                                    this._esurfh = 0.0;
                                }
                            }
                        }
                        DFDataConfig.Class.FieldInfo fiEndDepth = fac.GetFieldInfoBySystemName("EndDepth");
                        if (fiEndDepth != null)
                        {
                            int indexEndDepth = this._rowInfo.FieldIndex(fiEndDepth.Name);
                            if (indexEndDepth != -1)
                            {
                                this._edeep = Fac.GetDouble(base._rowInfo, indexEndDepth);
                                if (double.IsNaN(this._edeep))
                                {
                                    this._edeep = 0.0;
                                }
                            }
                        }
                        this._sheight = this._ssurfh - this._sdeep;
                        this._eheight = this._esurfh - this._edeep;
                        // 根据管线起始点高程计算中间点高程,并替换设施对象中Shape二维数据
                        if (this.GetPipeLineVertexs(base._geoGroup[2], this._sheight, this._eheight, out route))
                        {
                            base._geoGroup[1] = route;
                            base.SetValue("Shape", base._geoGroup[1]);
                        }
                        break;

                    case HeightParam.PipeVertexHeight:
                        this.GetPipeLineVertexs(base._geoGroup[1], out route);
                        this._sheight = double.IsNaN(route.StartPoint.Z) ? 0.0 : route.StartPoint.Z;
                        this._eheight = double.IsNaN(route.EndPoint.Z) ? 0.0 : route.EndPoint.Z;
                        // 替换设施对象中缓存行\Shape二维数据
                        base._geoGroup[1] = route;
                        base.SetValue("Shape", route);
                        break;

                    case HeightParam.Unkown:
                        this._sheight = double.IsNaN(route.StartPoint.Z) ? 0.0 : route.StartPoint.Z;
                        this._eheight = double.IsNaN(route.EndPoint.Z) ? 0.0 : route.EndPoint.Z;
                        this.SimplifyPolyline(base._geoGroup[1], out route);
                        // 替换设施对象中缓存行\Shape二维数据
                        base._geoGroup[1] = route;
                        base.SetValue("Shape", route);
                        break;
                    }
                    switch (style.HeightMode)
                    {
                    case HeightMode.Top:
                        this._vPos = VerticalPos.Top;
                        break;

                    case HeightMode.Bottom:
                        this._vPos = VerticalPos.Bottom;
                        break;

                    default:
                        this._vPos = VerticalPos.Center;
                        break;
                    }

                    // 重新设置高程选项,针对同类管线中高程设置不一致的情况
                    DFDataConfig.Class.FieldInfo fiHLB = fac.GetFieldInfoBySystemName("HLB");
                    if (fiHLB != null)
                    {
                        int indexHLB = this._rowInfo.FieldIndex(fiHLB.Name);
                        if (indexHLB != -1)
                        {
                            string hlb = base._rowInfo.GetValue(indexHLB).ToString();
                            if (hlb.Contains("内"))
                            {
                                this._vPos = VerticalPos.Bottom;
                            }
                            else if (hlb.Contains("外"))
                            {
                                this._vPos = VerticalPos.Top;
                            }
                            else
                            {
                                this._vPos = VerticalPos.Center;
                            }
                        }
                    }
                }
            }
            catch (Exception exception)
            {
            }
        }