Exemplo n.º 1
0
        public void Accept(BCOM.Element Element, ref BCOM.Point3d Point, BCOM.View View)
        {
            BCOM.Element oEle = Element;

            ECInstanceList oECInstancelist = Tag.oECAdaptor.ReadInstancesFromElement(oEle, false);

            foreach (ECInstance oEC in oECInstancelist)
            {
                if (oEC.ClassDefinition.Name == "Embankment" || oEC.ClassDefinition.Name == "RetainWall" ||
                    oEC.ClassDefinition.Name == "Pond" || oEC.ClassDefinition.Name == "Road" ||
                    oEC.ClassDefinition.Name == "OpenChannel" || oEC.ClassDefinition.Name == "Dike")
                {
                    Commons.UpdateUIBasedOnFunctionCode(Tag.s_current, oEC.ClassDefinition.Name);
                    Commons.PopulateGeoTagForm(Tag.s_current, oEC);

                    //WS: select the element.
                    AddInMain.ComApp.ActiveModelReference.SelectElement(oEle, true);

                    AddInMain.ComApp.ShowCommand("");
                    AddInMain.ComApp.ShowPrompt("Old Tag Data Retrived.");
                    break;
                }
            }
        }
Exemplo n.º 2
0
        private bool ApplyTagFromUI2Selection(string strFunctionCode)
        {
            bool retVal = false;

            try
            {
                GeoTagDataBase oGeoTagDataBase = null;

                string strClassName = Commons.MapFunctionCode2ClassName(strFunctionCode);

                if (strFunctionCode == "PND")
                {
                    oGeoTagDataBase = new Pond();
                }
                else if (strFunctionCode == "ROAD")
                {
                    oGeoTagDataBase = new Road();
                }
                else if (strFunctionCode == "CHN")
                {
                    oGeoTagDataBase = new OpenChannel();
                }
                else if (strFunctionCode == "EMB")
                {
                    oGeoTagDataBase = new Embankment();
                }
                else if (strFunctionCode == "DIKE")
                {
                    oGeoTagDataBase = new Dike();
                }
                else if (strFunctionCode == "RW")
                {
                    oGeoTagDataBase = new RetainWall();
                }

                oGeoTagDataBase.Tag_Number = this.lblTagValue.Text;

                oGeoTagDataBase.Tag_Status          = this.cmbTagStatus.Text;
                oGeoTagDataBase.Location            = this.txtLocation.Text;
                oGeoTagDataBase.Service_Description = this.txtSerDesc.Text;
                oGeoTagDataBase.Type = this.cmbType.Text;
                oGeoTagDataBase.Plot_Plan_Document_Number      = this.txtPlotPlan.Text;
                oGeoTagDataBase.Detail_Drawing_Document_Number = this.txtDetailDwg.Text;
                oGeoTagDataBase.Construction_Month             = this.dateTimePickerMon.Text;
                oGeoTagDataBase.Construction_Year            = this.dateTimePickerYear.Text;
                oGeoTagDataBase.Originating_Contractor       = this.txtOriContractor.Text;
                oGeoTagDataBase.Document_Number              = this.txtDocNo.Text;
                oGeoTagDataBase.Material_Main                = this.cmbMaterial.Text;
                oGeoTagDataBase.Procument_Package_Number     = this.txtProcumentPkg.Text;
                oGeoTagDataBase.Contract_Package_Number      = this.txtContractPkgNo.Text;
                oGeoTagDataBase.Construction_Contractor_Name = this.txtConstrContractor.Text;
                oGeoTagDataBase.Construction_Specification_Document_Number = this.txtConstrSpec.Text;

                if (oGeoTagDataBase is Pond)
                {
                    (oGeoTagDataBase as Pond).Supplier_Name     = this.txt17.Text;
                    (oGeoTagDataBase as Pond).Design_Capacity   = this.txt19.Text;
                    (oGeoTagDataBase as Pond).Fluid_Description = this.txt16.Text;
                    (oGeoTagDataBase as Pond).Max_Fluid_Level   = this.txt20.Text;
                    (oGeoTagDataBase as Pond).Supplier_Reference_Drawing_Doc_Number = this.txt18.Text;
                }

                if (oGeoTagDataBase is Road)
                {
                    (oGeoTagDataBase as Road).Number_of_Lanes = this.txt16.Text;
                }

                if (oGeoTagDataBase is OpenChannel)
                {
                    (oGeoTagDataBase as OpenChannel).Fluid_Description = this.txt16.Text;
                }

                BCOM.CellElement oCel = null;

                BCOM.ElementEnumerator oEnum = AddInMain.ComApp.ActiveModelReference.GetSelectedElements();

                BCOM.Element[] oEleSet = oEnum.BuildArrayFromContents();

                if (oEleSet.Length < 1)
                {
                    return(false);
                }

                //WS: if a tagged celll is selected.
                if (oEleSet.Length == 1)
                {
                    if (oEleSet[0].IsCellElement())
                    {
                        if (oEleSet[0].AsCellElement().Name == "Embankment" || oEleSet[0].AsCellElement().Name == "RetainWall" ||
                            oEleSet[0].AsCellElement().Name == "Pond" || oEleSet[0].AsCellElement().Name == "Road" ||
                            oEleSet[0].AsCellElement().Name == "OpenChannel" || oEleSet[0].AsCellElement().Name == "Dike")
                        {
                            oCel = oEleSet[0].AsCellElement();
                        }
                    }
                }
                else //WS: when more than 1 elements selected.
                {
                    oCel = GroupGeoTagCell(strClassName);
                }

                if (oCel == null)
                {
                    return(false);
                }

                AttachInstanceAndValues(oCel, strClassName, oGeoTagDataBase);

                retVal = true;
            }
            catch (Exception)
            {
                throw new Exception("Unexpected error:  GeoTag.ApplyTagFromUI2Selection");
            }

            return(retVal);
        }