예제 #1
0
        private void UpdateZxbz()
        {
            var ssdw    = ComBox_SSDW.Text;
            var bzlx    = ComBox_BZLX.Text;
            var bzText  = TXT_BZNR.Text.Trim();
            var dysbfid = TXT_DYSBFID.Tag == null ? string.Empty : TXT_DYSBFID.Tag.ToString();

            if (string.IsNullOrEmpty(dysbfid))
            {
                MessageBox.Show("请选择杂项标注对应的父设备!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (string.IsNullOrEmpty(bzlx))
            {
                MessageBox.Show("标注类型不能为空!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (string.IsNullOrEmpty(bzText))
            {
                return;
            }
            if (entityArgs.ObjId == ObjectId.Null)
            {
                return;
            }
            if (!bzText.Equals(zxbzn.MIF_TEXT))
            {
                SymbolLabel.UpdateDBText(entityArgs.ObjId, bzText);
            }
            var result  = UpdateDBEntity.UpdateZXBZN(bzText, bzlx, ssdw, dysbfid, zxbzn);
            var message = result ? "修改成功!" : "修改失败!";

            PublicMethod.Instance.ShowMessage(message);
        }
예제 #2
0
        private void Btn_Del_Click(object sender, EventArgs e)
        {
            var selectCount = listView1.SelectedItems.Count;

            if (selectCount < 1)
            {
                PublicMethod.Instance.AlertDialog("请选择要删除的标注");
                return;
            }
            if (MessageBox.Show("确定要删除选择的标注吗?", "系统提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
            {
                for (var i = 0; i < selectCount; i++)
                {
                    var index            = listView1.SelectedItems[i].Index;
                    var finderFuncNumber = listView1.Items[index].SubItems[4].Text;
                    var funcNumber       = int.Parse(finderFuncNumber);

                    if (SymbolLabel.DeleteLabel(funcNumber, eventArgs.g3eObject.G3E_FID))
                    {
                        SetItemsStatus(index, "删除成功!");
                        Btn_Del.Enabled = false;
                    }
                    else
                    {
                        SetItemsStatus(index, "删除失败!");
                    }
                }
            }
        }
예제 #3
0
        private void UpdateDBText(long g3e_fid, string newTextString, string oldTextString)
        {
            //获取标注对象
            var values = DBEntityFinder.Instance.GetDBSymbolFinderByFidOrEntityType(g3e_fid, EntityType.Label);

            var objList = values.Select(id => id.Key).ToList();

            //批量更新标注
            foreach (var objectId in objList)
            {
                SymbolLabel.UpdateDBText(objectId, newTextString, oldTextString);
            }
        }
예제 #4
0
        // ** ctor
        public InsertSymbol()
        {
            InitializeComponent();

            _panel.SuspendLayout();
            foreach (string line in Resources.Symbols_tbl.Split('\r'))
            {
                SymbolLabel lbl = new SymbolLabel(toolTip1, line.Trim());
                lbl.Click       += lbl_Click;
                lbl.DoubleClick += _btnInsert_Click;
                _panel.Controls.Add(lbl);
            }
            _panel.ResumeLayout();
        }
예제 #5
0
    public void ShowCardInfo(TD_Card info)
    {
        UITexture   head      = item.mScripts[0] as UITexture;
        SymbolLabel skill1Des = item.mScripts[1] as SymbolLabel;
        SymbolLabel skill2Des = item.mScripts[2] as SymbolLabel;
        UILabel     cardName  = item.mScripts[3] as UILabel;
        UILabel     skillType = item.mScripts[4] as UILabel;
        UISprite    isFight   = item.mScripts[5] as UISprite;

        LoadSprite.LoaderCard(head, info.res);
        isFight.gameObject.SetActive(false);
        cardName.text  = info.name;
        skillType.text = UtilTools.GetSKillTypeName((int)info.type);
        skill1Des.text = "4444444{01}4444";
        skill2Des.text = "4444444{01}4444";
        this.transform.DOLocalMove(new Vector3(-220, 0, 0), 0.1f, false);
        this.transform.DOScale(Vector3.one * 2, 0.1f);
    }
예제 #6
0
        private static void AddZxbzSymbol(XmlDBManager xmlDBManager, ElectronTransferModel.V9_4.Gg_gl_zxbz_n zxbzn)
        {
            var zxbzGeom = DBEntityFinder.Instance.GetZxbzGeomByG3e_fid(xmlDBManager, zxbzn.G3E_FID);

            if (zxbzGeom != null)
            {
                //获取坐标
                var point = new Point3d((zxbzGeom.G3E_GEOMETRY as Multipoint).Points[0].X,
                                        (zxbzGeom.G3E_GEOMETRY as Multipoint).Points[0].Y, 0);
                //获取角度
                var rotateAngle = Math.Atan2((zxbzGeom.G3E_GEOMETRY as Multipoint).Points[1].Y,
                                             (zxbzGeom.G3E_GEOMETRY as Multipoint).Points[1].X);

                //杂项标注图层
                var layerID = DCadApi.addLayer("杂项标注");
                //标注大小
                var lbHeight = 0.35 / MapConfig.Instance.earthscale;
                //标注颜色
                var color = CADColor.FromRgb(0, 0, 0);

                if (!string.IsNullOrEmpty(zxbzn.MIF_TEXT))
                {
                    Entity tEntity;
                    var    lb        = DBEntityFinder.Instance.GetLabel_LB(zxbzGeom);
                    var    alignment = DBEntityFinder.Instance.GetG3eAlignment(lb);
                    if (zxbzn.MIF_TEXT.Contains("\n"))
                    {
                        tEntity = SymbolLabel.Mtext(zxbzn.MIF_TEXT, point, rotateAngle, lbHeight, layerID);
                    }
                    else
                    {
                        tEntity = SymbolLabel.AddText(zxbzn.MIF_TEXT, point, rotateAngle, lbHeight, layerID, color,
                                                      alignment);
                    }
                    DCadApi.AddPinchPoint(tEntity);
                    DCadApi.AddLabelPinchPoint(tEntity);
                    //添加到当前模型中
                    var objectId = PublicMethod.Instance.ToModelSpace(tEntity);
                    zxbzGeom.IsErased   = false;
                    zxbzGeom.EntityType = EntityType.ZxLabel;
                    PublicMethod.Instance.AddDBSymbolFinder(objectId, zxbzGeom);
                }
            }
        }
예제 #7
0
        private void AddSymbolLabel()
        {
            if (listView1.SelectedItems.Count > 0)
            {
                if (!IsInsertLabel)
                {
                    var index          = listView1.SelectedItems[0].Index;
                    var lableClassName = listView1.Items[index].SubItems[2].Text;
                    var g3e_cno        = listView1.Items[index].SubItems[3].Text;
                    var G3e_Fno        = listView1.Items[index].SubItems[4].Text;
                    if (eventArgs.ObjId.IsNull)
                    {
                        return;
                    }

                    var lText = SymbolLabel.GetLabelText(g3e_cno, eventArgs.g3eObject);
                    if (!string.IsNullOrEmpty(lText.lbText))
                    {
                        isInsert        = true;
                        Btn_Add.Enabled = false;
                        ViewHelper.labelManagerPs.KeepFocus = false;
                        //添加标注
                        var result = SymbolLabel.AddLabel(eventArgs.g3eObject, int.Parse(G3e_Fno), lableClassName,
                                                          Convert.ToInt32(g3e_cno), lText);
                        //设置控件状态
                        SetItemsStatus(index, result ? added : adddefeat);
                        ViewHelper.labelManagerPs.KeepFocus = true;
                        isInsert = false;
                    }
                    else
                    {
                        var text        = listView1.Items[index].SubItems[0].Text;
                        var displayName = GenerateHelper.GetDisplayName(eventArgs.g3eObject.G3E_FNO, text);
                        MessageBox.Show(string.Format("【{0}】属性值没有填写!请先填写该属性!", displayName), "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            else
            {
                PublicMethod.Instance.AlertDialog("请选择要添加的标注");
            }
        }
예제 #8
0
    /// <summary>
    /// 刷新卡牌信息
    /// </summary>
    /// <param name="item"></param>
    void UpdateCardGrid(UIGridItem item)
    {
        if (item == null || item.oData == null || item.mScripts == null)
        {
            return;
        }
        TD_Card     info      = item.oData as TD_Card;
        UITexture   head      = item.mScripts[0] as UITexture;
        SymbolLabel skill1Des = item.mScripts[1] as SymbolLabel;
        SymbolLabel skill2Des = item.mScripts[2] as SymbolLabel;
        UILabel     cardName  = item.mScripts[3] as UILabel;
        UILabel     skillType = item.mScripts[4] as UILabel;
        UISprite    isFight   = item.mScripts[5] as UISprite;

        LoadSprite.LoaderCard(head, info.res);
        item.onClick = ShowCardInfoPanel;
        isFight.gameObject.SetActive(info.isFight == 1);
        cardName.text  = info.name;
        skillType.text = UtilTools.GetSKillTypeName((int)info.type);
        skill1Des.text = "4444444{01}4444";
        skill2Des.text = "4444444{01}4444";
    }
예제 #9
0
        private void UpdateGraph(DBEntity dbEntity)
        {
            //存储坐标数据
            if (dbEntity.IsCoordinate)
            {
                var objectId = ObjectId.Null;
                var pt       = dbEntity as ElectronSymbol;
                switch (pt.EntityType)
                {
                case EntityType.None:
                    objectId = DBEntityFinder.Instance.GetObjectIdByFid(pt.G3E_FID, EntityType.None);
                    if (!updateStateGEOMETRY.ContainsKey(objectId))
                    {
                        updateStateGEOMETRY.Add(objectId, pt);
                    }

                    GetGraphG3eFID(dbEntity, pointFidList);
                    break;

                case EntityType.Label:
                    objectId = DBEntityFinder.Instance.GetObjectIdByFid(pt.G3E_FID, EntityType.Label);
                    SymbolLabel.UpdateDBText(pt, objectId);
                    break;

                case EntityType.ZxLabel:
                    objectId = DBEntityFinder.Instance.GetObjectIdByFid(pt.G3E_FID, EntityType.ZxLabel);
                    break;
                }
                //更新缓存
                PublicMethod.Instance.UpdateDBSymbolFinder(objectId, pt);
            }
            else
            {
                GetNotGraphG3eFID(dbEntity, notPointFidList);
            }
        }
예제 #10
0
        /// <summary>
        /// 按表逐个更新属性
        /// </summary>
        /// <param name="CurPropertyObj"></param>
        /// <param name="rdt"></param>
        /// <param name="g3e_fno"></param>
        /// <param name="flag">是否是批量修改公共属性</param>
        private void RefAttribute(XProps CurPropertyObj, RequiredDevTables rdt, int g3e_fno, bool flag)
        {
            var tablename = string.Empty;

            try
            {
                if (rdt.ComObj != null)
                {
                    tablename = rdt.ComObj.GetType().Name;
                    GenerateHelper.PartialCopyFromCAD(CurPropertyObj, rdt.ComObj, g3e_fno);
                    if (GenerateHelper.Atff.com != null && rdt.ComObj.CompareProperties(GenerateHelper.Atff.com).Any())
                    {
                        if (rdt.ComObj.EntityState == EntityState.None)
                        {
                            rdt.ComObj.EntityState = EntityState.Update;
                        }
                        DBManager.Instance.Update(rdt.ComObj);
                    }
                }
                if (!flag)
                {
                    #region  如果是批量修改公共属性表就只针对公共属性表做修改别的表不处理
                    if (rdt.SelfObj != null)
                    {
                        tablename = rdt.SelfObj.GetType().Name;
                        GenerateHelper.PartialCopyFromCAD(CurPropertyObj, rdt.SelfObj, g3e_fno);
                        if (GenerateHelper.Atff.self != null && rdt.SelfObj.CompareProperties(GenerateHelper.Atff.self).Any())
                        {
                            if (rdt.SelfObj.EntityState == EntityState.None)
                            {
                                rdt.SelfObj.EntityState = EntityState.Update;
                            }
                            DBManager.Instance.Update(rdt.SelfObj);
                        }
                    }
                    if (rdt.ConnectObj != null)
                    {
                        tablename = rdt.ConnectObj.GetType().Name;
                        GenerateHelper.PartialCopyFromCAD(CurPropertyObj, rdt.ConnectObj, g3e_fno);
                        if (GenerateHelper.Atff.connectivity != null &&
                            rdt.ConnectObj.CompareProperties(GenerateHelper.Atff.connectivity).Any())
                        {
                            if (rdt.ConnectObj.EntityState == EntityState.None)
                            {
                                rdt.ConnectObj.EntityState = EntityState.Old_Nal_Nal;
                            }
                            DBManager.Instance.Update(rdt.ConnectObj);
                        }
                    }
                    if (rdt.GnwzObj != null)
                    {
                        tablename = rdt.GnwzObj.GetType().Name;
                        GenerateHelper.PartialCopyFromCAD(CurPropertyObj, rdt.GnwzObj, g3e_fno);
                        if (g3e_fno == 199)
                        {
                            rdt.GnwzObj.GNWZ_SSTJ = rdt.ComObj != null ? rdt.ComObj.SBMC : null;
                        }
                        if (g3e_fno == 198)
                        {
                            rdt.GnwzObj.MC = rdt.ComObj != null ? rdt.ComObj.SBMC : null;
                        }
                        if (GenerateHelper.Atff.gnwz != null && rdt.GnwzObj.CompareProperties(GenerateHelper.Atff.gnwz).Any())
                        {
                            if (rdt.GnwzObj.EntityState == EntityState.None)
                            {
                                rdt.GnwzObj.EntityState = EntityState.Update;
                            }
                            DBManager.Instance.Update(rdt.GnwzObj);
                        }
                    }
                    #endregion
                }
                SymbolLabel.ShowSymbolLabel(rdt.Fno, rdt.Fid); //更新的时候自动更新标注
            }
            catch (UpdataArgumentException ee)
            {
                throw new UpdataArgumentException(tablename, ee.FieldName);
            }
            finally
            {
                if (RefreshFeatureAttributeEvent != null)
                {
                    RefreshFeatureAttributeEvent(null, new RefreshAttributeArgs
                    {
                        Rdt = rdt
                    });
                }
            }
        }
        void ReleaseDesignerOutlets()
        {
            if (AboutButton != null)
            {
                AboutButton.Dispose();
                AboutButton = null;
            }

            if (AdditionButton != null)
            {
                AdditionButton.Dispose();
                AdditionButton = null;
            }

            if (ClearButton != null)
            {
                ClearButton.Dispose();
                ClearButton = null;
            }

            if (DisplayLabel != null)
            {
                DisplayLabel.Dispose();
                DisplayLabel = null;
            }

            if (DivisionButton != null)
            {
                DivisionButton.Dispose();
                DivisionButton = null;
            }

            if (EightButton != null)
            {
                EightButton.Dispose();
                EightButton = null;
            }

            if (EqualsButton != null)
            {
                EqualsButton.Dispose();
                EqualsButton = null;
            }

            if (FiveButton != null)
            {
                FiveButton.Dispose();
                FiveButton = null;
            }

            if (FourButton != null)
            {
                FourButton.Dispose();
                FourButton = null;
            }

            if (historyCalcSwipeGesture != null)
            {
                historyCalcSwipeGesture.Dispose();
                historyCalcSwipeGesture = null;
            }

            if (MultiplyButton != null)
            {
                MultiplyButton.Dispose();
                MultiplyButton = null;
            }

            if (NineButton != null)
            {
                NineButton.Dispose();
                NineButton = null;
            }

            if (OneButton != null)
            {
                OneButton.Dispose();
                OneButton = null;
            }

            if (SevenButton != null)
            {
                SevenButton.Dispose();
                SevenButton = null;
            }

            if (SixButton != null)
            {
                SixButton.Dispose();
                SixButton = null;
            }

            if (SubtractButton != null)
            {
                SubtractButton.Dispose();
                SubtractButton = null;
            }

            if (SymbolLabel != null)
            {
                SymbolLabel.Dispose();
                SymbolLabel = null;
            }

            if (ThreeButton != null)
            {
                ThreeButton.Dispose();
                ThreeButton = null;
            }

            if (TwoButton != null)
            {
                TwoButton.Dispose();
                TwoButton = null;
            }

            if (ZeroButton != null)
            {
                ZeroButton.Dispose();
                ZeroButton = null;
            }
        }
예제 #12
0
        private void btSync_Click(object sender, EventArgs e)
        {
            btSync.Enabled = false;
            lbShowSyncData.Refresh();
            LoadNecessarySyncDev();
            if (lbShowSyncData.Items.Count > 0)
            {
                lbShowSyncData.Items.Clear();
            }
            lbShowSyncData.Items.Add("开始同步");
            lbShowSyncData.Refresh();
            WebClient webClient = new WebClient();
            int       index     = 1;//上面已经占用了一个位置

            foreach (var item in recordSyncData)
            {
                try
                {
                    string syncDataUrl    = string.Empty;
                    var    syncDataTables = DevEventHandler.GetDevTables(item.G3E_FNO, item.G3E_FID);
                    if (syncDataTables == null)
                    {
                        var str = string.Format("FID={0}的设备数据获取失败", item.G3E_FID);
                        recorDictionary.Add(index, new ItemOfData()
                        {
                            Fid = item.G3E_FID, Index = index, SyncResult = str, RDT = null
                        });
                        lbShowSyncData.Items.Add(str);
                        continue;
                    }
                    if (CommonHelp.Instance.IsInsertDevice(item.G3E_FNO, item.G3E_FID))
                    {
                        syncDataUrl =
                            string.Format(
                                " http://localhost:9090/emmis/equipGisMappingTemp/cadRestful/synchAttributeToCAD.gis?g3e_fid=a{0}&g3e_fno={1}",
                                item.G3E_FID, item.G3E_FNO);
                    }
                    else
                    {
                        syncDataUrl =
                            string.Format(
                                " http://localhost:9090/emmis/equipGisMappingTemp/cadRestful/synchAttributeToCAD.gis?g3e_fid={0}&g3e_fno={1}",
                                item.G3E_FID, item.G3E_FNO);
                    }
                    byte[] redata = new byte[] { };
                    try
                    {
                        redata = webClient.DownloadData(syncDataUrl);
                    }
                    catch (WebException ex)
                    {
                        lbShowSyncData.Items.Add("下载台账数据失败");
                        return;
                    }
                    string syncRes = System.Text.Encoding.UTF8.GetString(redata);
                    if (string.IsNullOrEmpty(syncRes.Trim()))
                    {
                        var str = string.Format("FID={0}的设备缺少台账录入...", item.G3E_FID);
                        recorDictionary.Add(index, new ItemOfData()
                        {
                            Fid = item.G3E_FID, Index = index, SyncResult = str, RDT = syncDataTables
                        });
                        lbShowSyncData.Items.Add(str);
                        continue;
                    }
                    var tzValues = GetSyncData(syncRes);
                    //开始同步数据
                    if (tzValues.Any())
                    {
                        ShowSyncResultToListBox(index, tzValues, syncDataTables);
                        if (item.G3E_FNO == 148 && syncDataTables.GnwzObj != null)
                        {
                            var azwzValue = GenerateHelper.GetCurrentEntityAzwzByFidAndFno(syncDataTables.Fid, syncDataTables.Fno);
                            if (azwzValue != null && azwzValue.ToString().Equals("台架"))
                            {
                                if (syncDataTables.GnwzObj.HasAttribute("GNWZ_SSTJ"))
                                {
                                    var  tj    = syncDataTables.GnwzObj.GNWZ_SSTJ;
                                    long tjFid = 0;
                                    if (long.TryParse(tj, out tjFid))
                                    {
                                        var value = DevEventHandler.GetDevTables(199, tjFid);
                                        ShowSyncResultToListBox(index, tzValues, value);
                                    }
                                }
                            }
                        }
                    }
                    //更新标注
                    SymbolLabel.ShowSymbolLabel(item.G3E_FNO, item.G3E_FID);
                }
                catch
                {
                }
                finally
                {
                    index++;
                    lbShowSyncData.Refresh();
                }
            }
            lbShowSyncData.Items.Add("同步完成.");
        }
예제 #13
0
 protected virtual Label CreateSymbolLabel(SymbolElement eSymbol)
 {
     SymbolLabel label = new SymbolLabel();
     label.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
     label.BorderStyle = BorderStyle.None;
     label.AutoSize = true;
     label.TextAlign = ContentAlignment.TopCenter;
     SymbolItemEventArgs args = new SymbolItemEventArgs(eSymbol.SymbolValue, eSymbol.Family, eSymbol.Style, eSymbol.EMSize, eSymbol.ForeColor);
     label.SymbolItem = args;
     label.SymbolChanged += new EventHandler(this.lb_symbol_SymbolChanged);
     return label;
 }
예제 #14
0
        private void AddZxbz()
        {
            var ssdw   = ComBox_SSDW.Text;
            var bzlx   = ComBox_BZLX.Text;
            var bzText = TXT_BZNR.Text.Trim();

            if (string.IsNullOrEmpty(bzlx))
            {
                MessageBox.Show("标注类型不能为空!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (!string.IsNullOrEmpty(bzText))
            {
                //if (!DBEntityFinder.Instance.HasZxbz(entityArgs.g3eObject.G3E_FID.ToString()))
                //{
                isInsert        = true;
                Btn_Add.Enabled = false;
                //杂项标注图层
                var layerID = DCadApi.addLayer("杂项标注");
                //标注大小
                var lbHeight = 0.35 / MapConfig.Instance.earthscale;
                //标注颜色
                var color = Autodesk.AutoCAD.Colors.Color.FromRgb(0, 0, 0);
                ViewHelper.zxLabelManagerPs.KeepFocus = false;
                Entity mText;
                if (bzText.Contains("\n"))
                {
                    mText = SymbolLabel.Mtext(bzText, Point3d.Origin, 0, lbHeight, layerID);
                    //if (!PublicMethod.Instance.MultTextStyleId.IsNull)
                    //    ((MText)mText).TextStyleId = PublicMethod.Instance.MultTextStyleId;
                }
                else
                {
                    mText = SymbolLabel.AddText(bzText, Point3d.Origin, 0, lbHeight, layerID, color);
                }
                if (BlockJig.Jig(mText, true))
                {
                    isInsert = false;
                    DCadApi.AddPinchPoint(mText);
                    DCadApi.AddLabelPinchPoint(mText);
                    //添加到当前模型中
                    var objId = PublicMethod.Instance.ToModelSpace(mText);
                    //转换成空间坐标
                    var            mpt = ConvertGeometry.Instance.GetMultipoint(objId);
                    ElectronSymbol pt  = null;
                    //添加杂标数据
                    var result = InsertDBEntity.InsertZXBZ(entityArgs.g3eObject.G3E_FID, bzText, bzlx, ssdw, mpt, ref pt);
                    if (pt != null)
                    {
                        //保存记录
                        DBSymbolFinder.Instance.Add(objId, pt);
                    }
                    var message = result ? "新增成功!" : "新增失败!";
                    ViewHelper.zxLabelManagerPs.KeepFocus = true;
                    PublicMethod.Instance.ShowMessage(message);
                }
                Btn_Add.Enabled = true;
                //}
                //else
                //    MessageBox.Show("杂项标注已添加!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
            else
            {
                TXT_BZNR.Focus();
                MessageBox.Show("标注内容不能为空!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
        }
예제 #15
0
 // ** implementation
 void lbl_Click(object sender, EventArgs e)
 {
     SelectedSymbol = sender as SymbolLabel;
     _focusBox.Focus();
 }