Example #1
0
        private void FillByXMRK(IXMRK pXMRK)
        {
            m_XMRK       = pXMRK;
            TxbLABH.Text = pXMRK.LXBH;
            TxbXMMC.Text = pXMRK.XMMC;
            DTLASJ.Value = pXMRK.LASJ;

            /*
             * string SavePath = HR.Utility.CommonConstString.STR_TempPath + string.Format("\\{0}.dwg", pXMRK.TZBH);
             * try
             * {
             *   if (!File.Exists(SavePath))
             *   pXMRK.DownloadAD(SavePath);
             *   AcadApp.Documents.Open(SavePath, null, null);
             *
             *   if (pXMRK.SoucePoints != null)
             *   {
             *       for (int j = 0; j < pXMRK.SoucePoints.PointCount; j++)
             *       {
             *           ISTPoint pSTPoint = pXMRK.SoucePoints.GetSTPoint(j);
             *           superGridControlCoords.PrimaryGrid.Rows.Add(new DevComponents.DotNetBar.SuperGrid.GridRow(new object[] {j+1,
             *               pSTPoint.X.ToString("0.000"), pSTPoint.Y.ToString("0.000") }));
             *       }
             *   }
             * }
             * finally
             * { }*/
        }
Example #2
0
        private void UploadCurCAD(AcadApplication AcadApp, IXMRK pXMRK)
        {
            AcadDocument AcadDoc = AcadApp.ActiveDocument;

            Microsoft.VisualBasic.Interaction.AppActivate(AcadApp.Caption);
            AcadDoc.Save();

            string path        = AcadDoc.Path;
            string DocmantPath = AcadDoc.FullName;
            //string strPath = HR.Utility.CommonConstString.STR_TempPath + "\\" + pXMRK.ID + ".dwg";
            string TempstrPath = HR.Utility.CommonConstString.STR_TempPath + pXMRK.TZBH + ".dwg";

            AcadDoc.SaveAs(TempstrPath, AcSaveAsType.ac2000_dwg, null);
            AcadDoc = AcadApp.ActiveDocument;
            AcadDoc.Close();
            Application.DoEvents();

            /* if (System.IO.File.Exists(strPath))
             * {
             *   System.IO.File.Delete(strPath);
             * }
             * System.IO.File.Copy(TempstrPath, strPath);*/

            pXMRK.UploadCAD(TempstrPath);
        }
Example #3
0
        public override void Execute(DevComponents.DotNetBar.ICommandSource commandSource)
        {
            XMManagerControl pXMManagerControl = commandSource.CommandParameter as XMManagerControl;
            IXMRK            pXMRK             = pXMManagerControl.GetXMRK();
            bool             IsNewXMYD         = pXMRK.ID == -1;

            if (pXMRK.GetIsGeoCange() && !IsNewXMYD)
            {
                AcadApplication AcadApp = pXMManagerControl.AcadApp;
                UploadCurCAD(AcadApp, pXMRK);
            }
            try
            {
                pXMRK.Save();
                if (IsNewXMYD)
                {
                    AcadApplication AcadApp = pXMManagerControl.AcadApp;
                    UploadCurCAD(AcadApp, pXMRK);
                }
                ISTPoint MinPoint = pXMRK.STGeometry.GetMinPoint();
                ISTPoint MaxPoint = pXMRK.STGeometry.GetMaxPoint();
                pXMRK.UpdateMapServerCache(MinPoint.X, MinPoint.Y, MaxPoint.X, MaxPoint.Y);
                MessageBox.Show("保存成功", "消息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "保存出错", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public override void Execute(DevComponents.DotNetBar.ICommandSource commandSource)
        {
            XMManagerControl pXMManagerControl = commandSource.CommandParameter as XMManagerControl;
            IXMRK            pXMRK             = pXMManagerControl.XMRK;

            if (pXMRK != null && pXMRK.ID != -1)
            {
                if (MessageBox.Show(string.Format("是否删除项目{0}", pXMRK.XMBH), "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question)
                    == DialogResult.Cancel)
                {
                    return;
                }
                ISTPointCollection pSTPointCollection = pXMRK.SoucePoints;
                ISTPoint           MinPoint           = pSTPointCollection.GetMinPoint();
                ISTPoint           MaxPoint           = pSTPointCollection.GetMaxPoint();
                pXMRK.Delete();
                pXMRK.UpdateMapServerCache(MinPoint.X, MinPoint.Y, MaxPoint.X, MaxPoint.Y);
                MessageBox.Show("删除成功", "消息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }
Example #5
0
        public IXMRK GetXMRK()
        {
            if (m_XMRK == null)
            {
                m_XMRK = new XMRKClass();
            }
            //添加获取属性信息代码


            if (GeoChange)//如果重新设置了图形
            {
                AcadObject pAcadObject = superGridControlCoords.Tag as AcadObject;
                if (m_XMRK.ID == -1 && pAcadObject == null)
                {
                    throw new Exception("未获取入库图形");
                }
                m_XMRK.STGeometry = ConvertDBObject(pAcadObject);
                //m_XMRK.STGeometry.SRID = 300000;
                //if (!m_XMRK.STGeometry.IsSimplify())
                //{
                m_XMRK.STGeometry = m_XMRK.STGeometry.Simplify();
                //   m_XMRK.CADPath=
                //}

                ISTPointCollection pSTPointCollection = new STPointCollectionClass();
                double[]           AdlwpPoint         = (double[])(pAcadObject as AcadLWPolyline).Coordinates;
                int PointCount = AdlwpPoint.Length / 2;
                for (int j = 0; j < PointCount; j++)
                {
                    ISTPoint pSTPoint = new STPointClass()
                    {
                        X = AdlwpPoint[j * 2], Y = AdlwpPoint[j * 2 + 1]
                    };
                    pSTPointCollection.AddPoint(pSTPoint);
                }
                m_XMRK.SoucePoints = pSTPointCollection;
            }
            return(m_XMRK);
        }
Example #6
0
        /*
         * public static IXMRK GetXMRKByTZBH(string TZBH)
         * {
         *  string sql = string.Format("select ObjectID,XMMC,XMBH,DM,BLC,to_char(CLSJ,'yyyy-mm-dd') CLSJ,"
         + "to_char(CTSJ,'yyyy-mm-dd') CTSJ,CLGS,CadPath,XMMJ,ZDMJ,TZBH,round(t.Shape.area,2) as Area  from xmyd t where TZBH='{0}'", TZBH);
         +  IDataBase pDataBase = HR.Utility.SysDBConfig.GetInstance().GetOleDataBase("SdeOrclConn");
         +  DataTable ptable = pDataBase.ExecuteQuery(sql).Tables[0];
         +  if (ptable.Rows.Count == 0) return null;
         +
         +  IXMRK pXMRK = new XMRKClass();
         +  (pXMRK as XMRKClass).FillByRow(ptable.Rows[0]);
         +  return pXMRK;
         + }*/
        public static IXMRK[] GetXMRKByXMBH(string XMBH)
        {
            string sql = string.Format("select ObjectID,XMMC,XMBH,DM,BLC,to_char(CLSJ,'yyyy-mm-dd') CLSJ,"
                                       + "to_char(CTSJ,'yyyy-mm-dd') CTSJ,CLGS,CadPath,XMMJ,ZDMJ,TZBH,round(t.Shape.area,2) as Area  from xmyd t where XMBH  like '{0}%' or XMBH='{0}'", XMBH);
            IDataBase pDataBase = HR.Utility.SysDBConfig.GetInstance().GetOleDataBase("SdeOrclConn");
            DataTable ptable    = pDataBase.ExecuteQuery(sql).Tables[0];

            if (ptable.Rows.Count == 0)
            {
                return(null);
            }

            IXMRK[] XMRKs = new IXMRK[ptable.Rows.Count];
            int     i     = 0;

            foreach (DataRow pRow in ptable.Rows)
            {
                IXMRK pXMRK = new XMRKClass();
                (pXMRK as XMRKClass).FillByRow(ptable.Rows[0]);
                XMRKs[i] = pXMRK;
                i++;
            }
            return(XMRKs);
        }
Example #7
0
        private void pXMTreeview_XMTreeViewOperEvent(object sender, XMTreeViewEventArgs e)
        {
            IXMRK pXMRK = XMRKClass.GetXMRKByID(e.XMID);

            FillByXMRK(pXMRK);
        }