示例#1
0
文件: VCTFile.cs 项目: hy1314200/HyDM
        /// <summary>
        /// ��ȡVCTע��ʵ��ڵ�
        /// </summary>
        private AnnotationNode ReadAnnotationNode()
        {
            if (this.m_streamReader != null)
            {
                string strLine = "";    //��ȡ�������ֻ���

                if (m_bFoundAnnotationBegin == false)
                {
                    strLine = this.ReadLine(true);
                    //����ע��ʵ��ڵ�Ŀ�ʼ��ǡ�AnnotationBegin��
                    if (strLine.IndexOf("AnnotationBegin", System.StringComparison.OrdinalIgnoreCase) > -1)
                    {
                        m_bFoundAnnotationBegin = true;
                    }
                }
                if (m_bFoundAnnotationBegin == true)
                {
                    strLine = this.ReadLine(true);
                    //����ע��ʵ��ڵ�Ľ�����ǡ�AnnotationEnd��
                    if (strLine.IndexOf("AnnotationEnd", System.StringComparison.OrdinalIgnoreCase) > -1)
                        return null;
                    else
                    {
                        AnnotationNode annotationNode = new AnnotationNode();
                        //�Ȼ�ȡע��ʵ���ʶ��
                        int nEntityID = -1;
                        if (VCTFile.ConvertToInt32(strLine,out nEntityID))
                            annotationNode.EntityID = nEntityID;
                        else
                        {
                            LogAPI.WriteLog("��ȡע��ʵ��ı�ʶ��ʧ�ܣ����������Ƿ���ϱ�׼��");
                            LogAPI.WriteLog("��ȡ���������������" + m_nReadLineCount + "��");
                            return null;
                        }
                        //�ٻ�ȡҪ�ر���
                        annotationNode.FeatureCode = this.ReadLine(false);
                        //��ȡͼ�α��ֱ���
                        annotationNode.Representation = this.ReadLine(false);
                        //��ȡע�ǵ���������
                        int nAnnotationType = -1;
                        if (VCTFile.ConvertToInt32(this.ReadLine(false),out nAnnotationType))
                            annotationNode.AnnotationType = nAnnotationType;
                        else
                        {
                            LogAPI.WriteLog("��ȡע��ʵ�����������ʧ�ܣ����������Ƿ���ϱ�׼��");
                            LogAPI.WriteLog("��ȡ���������������" + m_nReadLineCount + "��");
                            return null;
                        }
                        //��ȡע�ǵ�����
                        annotationNode.Text = this.ReadLine(false);
                        //��ȡע�ǵ�����ͽǶ�
                        strLine = this.ReadLine(false);
                        int nIndex = strLine.LastIndexOf(HeadNode.Separator);
                        if (nIndex > 0 && nIndex < strLine.Length)
                        {
                            annotationNode.PointLocation = new PointInfoNode(strLine.Substring(0,nIndex));
                            //��ȡע�ǵ�
                            double nAngle = 0;
                            if (VCTFile.ConvertToDouble(strLine.Substring(nIndex + 1),out nAngle))
                                annotationNode.Angle = nAngle;
                            return annotationNode;
                        }
                    }
                }

            }
            return null;
        }
示例#2
0
文件: VCTFile.cs 项目: hy1314200/HyDM
 /// <summary>
 /// д��VCTע��ʵ��ڵ�
 /// </summary>
 /// <param name="annotationNode">VCTע��ʵ��ڵ�</param>
 public bool WriteAnnotationNode(AnnotationNode annotationNode)
 {
     if (this.m_streamWriter != null)
     {
         if (this.m_bFoundAnnotationBegin == false)
         {
             if (this.m_bFoundPolygonBegin == false)
             {
                 if (this.m_bFoundLineBegin == false)
                 {
                     if (this.m_bFoundPointBegin == false)
                     {
                         this.m_streamWriter.WriteLine("PointBegin");
                         this.m_bFoundPointBegin = true;
                     }
                     this.m_streamWriter.WriteLine("PointEnd");
                     this.m_streamWriter.WriteLine("LineBegin");
                     this.m_bFoundLineBegin = true;
                 }
                 this.m_streamWriter.StreamWriterTemp.WriteLine("LineEnd");
                 this.m_streamWriter.StreamWriterTemp.WriteLine("PolygonBegin");
                 this.m_bFoundPolygonBegin = true;
             }
             this.m_streamWriter.StreamWriterTemp.WriteLine("PolygonEnd");
             this.m_streamWriter.StreamWriterTemp.WriteLine("AnnotationBegin");
             this.m_bFoundAnnotationBegin = true;
         }
         this.m_streamWriter.StreamWriterTemp.WriteLine(annotationNode);
         this.m_streamWriter.StreamWriterTemp.Flush();
         return true;
     }
     return false;
 }
示例#3
0
        /// <summary>
        /// ��ȡVCTע��ʵ��ڵ�
        /// </summary>
        public override EntityNode GetEntityNode()
        {
            try
            {
                AnnotationNode pAnnotationNode = new AnnotationNode();

                //��������ͳһ����Ϊ����ע��
                pAnnotationNode.AnnotationType = Convert.ToInt32(Metadata.MetaDataFile.GraphConfig.GetGraphSymbol("ANNOTATIONFEATURETYPE", "SingPointAnnotation"));
                IFeature pFeature = this.Feature as IFeature;
                if (pFeature != null)
                {
                    ///��ʶ�븳ֵ
                    int dBSMIndex = -1;
                    dBSMIndex = this.Feature.Fields.FindField(m_strEntityIDFiled);
                    if (dBSMIndex != -1)
                        pAnnotationNode.EntityID = Convert.ToInt32(this.Feature.get_Value(dBSMIndex));

                    ///Ҫ�ش��븳ֵ
                        pAnnotationNode.FeatureCode = this.FeatureCode;

                    ///ͼ�α��ָ�ֵ
                     //pAnnotationNode.Representation = pFeature.Class.AliasName;

                    ///ע�����긳ֵ

                     IGeometry5 pArea = pFeature.Shape as IGeometry5;
                     if (pArea != null)
                     {
                         PointInfoNode pPTInfoNode = new PointInfoNode(pArea.CentroidEx.X, pArea.CentroidEx.Y);
                         pAnnotationNode.PointLocation = pPTInfoNode;
                     }
                    m_AnnotationNode = pAnnotationNode;
                    return pAnnotationNode;
                }
                return null;
            }
            catch (Exception ex)
            {
                LogAPI.WriteErrorLog(ex);
                return null;
            }
        }