示例#1
0
        public WritePolygonNodes(ESRIData.Dataset dataset, TempData.TempFile pTempFile, VCTFile pVCTFile, int nNewEntityID)
        {
            m_dataset      = dataset;
            m_pTempFile    = pTempFile;
            m_VCTFile      = pVCTFile;
            m_nNewEntityID = nNewEntityID;
            m_nLayerCount  = m_dataset.GetLayerCount();

            //WriteCommplete = null;
        }
示例#2
0
        public VCT2MDB(string strVCTFilePahtName, string strMDBFilePahtName,string strDataSetName,ArcDataType pDatatype)
        {
            m_strDataSetName = strDataSetName;
            m_VCTFile = new VCTFile(true, strVCTFilePahtName);

            if (pDatatype== ArcDataType.MDB)
                m_MDBFile = new MDBFile(false, strMDBFilePahtName);
            else
                m_MDBFile = new FGDBFile(false, strMDBFilePahtName);
		}
示例#3
0
        //{
        //    get
        //    {
        //        return m_dY;
        //    }
        //    set
        //    {
        //        m_dY = value;
        //    }
        //}
        //private double m_dY;


        ///// <summary>
        ///// 构造函数
        ///// </summary>
        //public PointInfoNode()
        //{

        //}

        /// <summary>
        /// 构造函数,根据字符串构造
        /// </summary>
        public PointInfoNode(string strLine)
        {
            string[] arrTemp = strLine.Split(HeadNode.Separator);
            if (arrTemp.Length != 2)
                return;
            double dValue=-1;
            if (VCTFile.ConvertToDouble(arrTemp[0],out dValue))
                this.X = dValue;
            if (VCTFile.ConvertToDouble(arrTemp[1], out dValue))
                this.Y = dValue;
        }
示例#4
0
文件: MDB2VCT.cs 项目: zj8487/HyDM
        //public event WriteCommpleteEventHandler WriteCommplete;

        /// <summary>
        /// mdb转vct控制类构造函数
        /// </summary>
        /// <param name="strMDBFilePahtName">mdb文件路径</param>
        /// <param name="strVCTFilePahtName">vct文件路径</param>
        /// <param name="pDataType">数据源类型</param>
        public MDB2VCT(string strMDBFilePahtName, string strVCTFilePahtName,ArcDataType pDataType)
        {
            if (pDataType == ArcDataType.MDB)
                m_MDBFile = new MDBFile(true, strMDBFilePahtName);
            else
                m_MDBFile = new FGDBFile(true, strMDBFilePahtName);
            m_VCTFile = new VCTFile(false, strVCTFilePahtName);

            m_pTempFile = new DIST.DGP.DataExchange.VCT.TempData.TempFile(strVCTFilePahtName + ".tmp.mdb");

            //WriteCommplete = null;
        }
示例#5
0
 public RecordNode(string strLine)
 {
     string[] arrFieldValue = strLine.Split(HeadNode.Separator);
     int nEntityID = -1;
     for (int i = 0; i < arrFieldValue.Length; i++)
     {
         if (i == 0)
         {
             if (VCTFile.ConvertToInt32(arrFieldValue[0],out nEntityID))
                 this.m_nEntityID = nEntityID;
         }
         this.m_arrFieldValue.Add(arrFieldValue[i]);
     }
 }
示例#6
0
        public FieldNode(string strLine)
        {
            string[] arrTemp = strLine.Split(HeadNode.Separator);

            if (arrTemp.Length > 0)
                this.m_strFieldName = arrTemp[0];
            if (arrTemp.Length > 1)
                this.m_strFieldType = arrTemp[1];
            int nLength = -1;
            if (arrTemp.Length > 2)
            {
                if (VCTFile.ConvertToInt32(arrTemp[2],out nLength))
                    this.m_nFieldLength = nLength;
            }
            if (arrTemp.Length > 3)
            {
                if (VCTFile.ConvertToInt32(arrTemp[3], out nLength))
                    this.m_nFieldPrecision = nLength;
            }
        }
示例#7
0
文件: MDB2VCT.cs 项目: zj8487/HyDM
        public virtual void Dispose()
        {
            if (m_VCTFile != null)
                m_VCTFile.CloseFile();
            m_VCTFile = null;

            Metadata.MetaDataFile.Dispose();

            if (m_pTempFile != null)
                m_pTempFile.Close();
            m_pTempFile = null;

            if (m_dataset != null)
                m_dataset.Dispose();
            m_dataset = null;
            
            if (m_MDBFile != null)
                m_MDBFile.Dispose();
            m_MDBFile = null;
            GC.Collect();
        }
示例#8
0
        /// <summary>
        /// 获取表中的字段信息(没有做版本判断)
        /// </summary>
        /// <param name="pFieldAtrrCollection"></param>
        /// <returns></returns>
        private MetaDataField GetMetaTableFieldByXMLAtr(XmlAttributeCollection pFieldAtrrCollection)
        {
            if (pFieldAtrrCollection == null || pFieldAtrrCollection.Count <= 0)
            {
                return(null);
            }
            MetaDataField pMetaDataField = new MetaDataField();

            ///获取表名称
            XmlAttribute pAttribute = pFieldAtrrCollection["Name"];

            if (pAttribute != null)
            {
                pMetaDataField.Name = pAttribute.Value;
            }

            ///获取要素代码
            pAttribute = pFieldAtrrCollection["Code"];
            if (pAttribute != null)
            {
                pMetaDataField.Code = pAttribute.Value;
            }

            ///获取字段类型
            pAttribute = pFieldAtrrCollection["Type"];
            if (pAttribute != null)
            {
                pMetaDataField.Type = pAttribute.Value;
            }

            ///获取字段长度
            pAttribute = pFieldAtrrCollection["Length"];
            if (pAttribute != null)
            {
                if (pAttribute.Value != "" && pAttribute.Value != null)
                {
                    int nLength = -1;
                    if (VCTFile.ConvertToInt32(pAttribute.Value, out nLength))
                    {
                        pMetaDataField.Length = nLength;
                    }
                }
            }

            ///获取字段精度
            pAttribute = pFieldAtrrCollection["Precision"];
            if (pAttribute != null)
            {
                int nPresion = -1;
                if (pAttribute.Value != "" && pAttribute.Value != null)
                {
                    if (VCTFile.ConvertToInt32(pAttribute.Value, out nPresion))
                    {
                        pMetaDataField.Presion = nPresion;
                    }
                }
            }

            ///获取要素代码字段
            pAttribute = pFieldAtrrCollection["FieldType"];
            if (pAttribute != null)
            {
                EnumFieldType pEnumType = EnumFieldType.Other;
                switch (pAttribute.Value)
                {
                case "bsm":
                    pEnumType = EnumFieldType.EntityID;
                    break;

                case "ysdm":
                    pEnumType = EnumFieldType.YSDM;
                    break;

                case "other":
                    pEnumType = EnumFieldType.Other;
                    break;

                default:
                    break;
                }
                pMetaDataField.FiledType = pEnumType;
            }

            ///获取约束条件 与值域 对照表 暂时不需要
            return(pMetaDataField);
        }
示例#9
0
文件: HeadNode.cs 项目: zj8487/HyDM
 public bool SetValue(string strVariantName, string strValue)
 {
     strVariantName = Metadata.MetaDataFile.HeadConfig.GetHeadMark(strVariantName).ToLower();
     int nValue = -1;
    strValue= strValue.Trim();
     switch (strVariantName)
     {
         case "datamark":
             {
                 this.m_strDatamark = strValue;
                 break;
             }
         case "version":
             {
                 this.m_strVersion = strValue;
                 break;
             }
         case "coordinatesystemType":
             {
                 this.m_strCoordinateSystemType = strValue;
                 break;
             }
         case "dim":
             {
                 if (VCTFile.ConvertToInt32(strValue,out nValue))
                     this.m_nDim = nValue;
                 break;
             }
         case "xaxisdirection":
             {
                 this.m_strXAxisDirection = strValue;
                 break;
             }
         case "yaxisdirection":
             {
                 this.m_strYAxisDirection = strValue;
                 break;
             }
         case "unit":
             {
                 this.m_strUnit = strValue;
                 break;
             }
         case "projection":
             {
                 this.m_strProjection = strValue;
                 break;
             }
         case "spheroid":
             {
                 this.m_strSpheroid = strValue;
                 break;
             }
         case "primemeridian":
             {
                 this.m_strPrimeMeridian = strValue;
                 break;
             }
         case "parameters":
             {
                 GetParameter( strValue);
                 break;
             }
         case "vertical":
             {
                 this.m_strVertical = strValue;
                 break;
             }
         case "temporalreferencesystem":
             {
                 this.m_strTemporalReferenceSystem = strValue;
                 break;
             }
         case "majormin":
             {
                 this.m_MajorMin = new PointInfoNode(strValue);
                 break;
             }
         case "majormax":
             {
                 this.m_MajorMax = new PointInfoNode(strValue);
                 break;
             }
         case "scale":
             {
                 m_strScale = strValue;
                 break;
             }
         case "excursion":
             {
                 this.m_strExcursion = strValue;
                 break;
             }
         case "date":
             {
                 this.m_strDate = strValue;
                 break;
             }
         case "separator":
             {
                 HeadNode.m_cSeparator = strValue[0];
                 break;
             }
     }
     
     return true;
 }
示例#10
0
        /// <summary>
        /// 写入多边形节点
        /// </summary>
        /// <param name="pVCTFile">VCT文件对象</param>
        public void WritePolygonNodes(VCTFile pVCTFile)
        {
            if (this.m_pOleDbConnection != null && m_pOleDbConnection.State == ConnectionState.Open)
            {
                PolygonNodeTable pPolygonNodeTable = new PolygonNodeTable(m_pOleDbConnection);
                LineNodeExTable pLineNodeExTable = new LineNodeExTable(m_pOleDbConnection);

                //按面标识码
                string strPolygonNodeOrderBy = pPolygonNodeTable.FieldName_EntityID;
                DataTable dataTablePolygon = pPolygonNodeTable.GetRecords("", "", strPolygonNodeOrderBy);

                //按面标识码、在面的边界线集合中的索引排序
                string strLineNodeExOrderBy = pLineNodeExTable.FieldName_PolygonID + "," + pLineNodeExTable.FieldName_LineIndex;
                DataTable dataTableLine = pLineNodeExTable.GetRecords(pLineNodeExTable.FieldName_PolygonID + ",-" + pLineNodeExTable.FieldName_EntityID + "*" + pLineNodeExTable.FieldName_IsReverse, "", "", strLineNodeExOrderBy);

                PolygonNodeSimple polygonNode = null;
                //LineNodeEx lineNode = null;
                //LineNodeEx lineNodeUp = null;
                int nPolygonID = -1;
                int nEntityID = -1;
                int nEntityIDUp = -1;
                int j = 0;
                while (dataTablePolygon.Rows.Count > 0)
                {
                    for (int i = 0; i < dataTablePolygon.Rows.Count; i++)
                    {
                        polygonNode = new PolygonNodeSimple();
                        pPolygonNodeTable.GetEntityNodeByDataRow(dataTablePolygon.Rows[i], ref polygonNode);

                        while (dataTableLine.Rows.Count > 0)
                        {
                            for (; j < dataTableLine.Rows.Count; j++)
                            {
                                //lineNodeUp = null;
                                //lineNode = new LineNodeEx();
                                //pLineNodeExTable.GetLineNodeByDataRow(dataTableLine.Rows[j], ref lineNode, false);
                                nPolygonID = Convert.ToInt32(dataTableLine.Rows[j][0]);
                                nEntityID = Convert.ToInt32(dataTableLine.Rows[j][1]);

                                if (nPolygonID == polygonNode.EntityID)
                                {
                                    if (nEntityIDUp != -1)
                                    {
                                        if (nEntityIDUp == nEntityID)
                                        {
                                            continue;
                                        }
                                    }
                                    polygonNode.LineNodes.Add(nEntityID);
                                }
                                else
                                {
                                    break;
                                }
                                nEntityIDUp = nEntityID;
                            }

                            if (j == dataTableLine.Rows.Count)
                            {
                                if (dataTableLine.Rows.Count < pLineNodeExTable.MaxRecordCount)
                                    break;
                                dataTableLine = pLineNodeExTable.GetNextRecords();
                                j = 0;
                            }
                            else
                                break;
                        }

                        pVCTFile.WritePolygonNode(polygonNode);
                    }
                    if (dataTablePolygon.Rows.Count < pPolygonNodeTable.MaxRecordCount)
                        break;
                    dataTablePolygon = pPolygonNodeTable.GetNextRecords();

                }

            }
        }
示例#11
0
        /// <summary>
        /// 写入多边形线节点(非引用线图层)
        /// </summary>
        /// <param name="pVCTFile">VCT文件对象</param>
        public void WritePolygonLineNodes(VCTFile pVCTFile)
        {
            if (this.m_pOleDbConnection != null && m_pOleDbConnection.State == ConnectionState.Open)
            {
                LineNodeExTable pLineNodeExTable = new LineNodeExTable(m_pOleDbConnection);

                //只写入正向线节点
                string strWhere = pLineNodeExTable.FieldName_IsFromLine + "=-1 And "
                    + pLineNodeExTable.FieldName_IsReverse + "=-1 And " + pLineNodeExTable.FieldName_EntityID + "<>0";
                //按标识码、在面的边界线集合中的索引排序
                string strLineNodeExOrderBy = pLineNodeExTable.FieldName_PolygonID + "," + pLineNodeExTable.FieldName_LineIndex;
                DataTable dataTable = pLineNodeExTable.GetRecords(strWhere, "", strLineNodeExOrderBy);

                LineNodeEx lineNode = null;
                LineNodeEx lineNodeCurrent = null;
                LineNodeEx lineNodeUp = null;

                //for (int i = 0; i < dataTable.Rows.Count; i++)
                while (dataTable.Rows.Count > 0)
                {
                    for (int i = 0; i < dataTable.Rows.Count; i++)
                    {

                        lineNodeCurrent = new LineNodeEx();
                        //LineNode lineNodeTemp = lineNodeCurrent as LineNode;
                        pLineNodeExTable.GetLineNodeByDataRow(dataTable.Rows[i], ref lineNodeCurrent, false);

                        if (lineNode == null)
                        {
                            lineNode = lineNodeCurrent;
                        }
                        else
                        {
                            //判断当前线节点与上一线节点是否属于同一个面
                            if (lineNodeCurrent.PolygonID != lineNodeUp.PolygonID)
                            {
                                pVCTFile.WritePolygonLineNode(lineNode);
                                lineNode = lineNodeCurrent;
                            }
                            else
                            {
                                if (lineNodeCurrent.EntityID == lineNode.EntityID)
                                {
                                    lineNode.SegmentNodes.AddRange(lineNodeCurrent.SegmentNodes);
                                }
                                else
                                {
                                    pVCTFile.WritePolygonLineNode(lineNode);
                                    lineNode = lineNodeCurrent;
                                }
                            }
                        }
                        lineNodeUp = lineNodeCurrent;
                    }

                    if (dataTable.Rows.Count < pLineNodeExTable.MaxRecordCount)
                        break;
                    dataTable = pLineNodeExTable.GetNextRecords();

                }
                if (lineNode != null)
                    pVCTFile.WritePolygonLineNode(lineNode);

            }
        }