public ComponentRepWindow(ComponentRepWindowMode _mode, CompRepDescirbes _comp)
 {
     InitializeComponent();
     this.format              = new System.Globalization.NumberFormatInfo();
     this.mode                = _mode;
     this.comp_current        = _comp;
     this.tb_NamePreview.Text = (_comp == null) ? string.Empty : _comp.Comp_Description;
     SetControls();
 }
Exemple #2
0
        public void OpenComponentViewerForInfo(CompRepDescirbes _comp)
        {
            if (_comp == null)
            {
                return;
            }

            this.compViewer      = new ComponentRepWindow(ComponentRepWindowMode.INFO, _comp);
            this.compViewer.Zone = _comp.Geom_Zone;
            this.compViewer.ShowDialog();
        }
Exemple #3
0
        public void ReAssociateZonedVolumeWComp(CompRepInfo _comp)
        {
            if (_comp == null)
            {
                return;
            }

            if (this.SelectedVolume != null)
            {
                this.SelectedVolume.EditModeType = ZonedVolumeEditModeType.ISBEING_REASSOCIATED;
            }

            switch (_comp.GR_State.Type)
            {
            case InterProcCommunication.Specific.Relation2GeomType.DESCRIBES:
                CompRepDescirbes crd = _comp as CompRepDescirbes;
                if (crd != null)
                {
                    // if the Volume is NULL, the relationship turns to 'not realized'
                    // (see CompRepDescirbes.Geom_Zone setter)
                    crd.Geom_Zone = this.SelectedVolume;
                }
                break;

            case InterProcCommunication.Specific.Relation2GeomType.CONTAINED_IN:
                CompRepContainedIn_Instance crci = _comp as CompRepContainedIn_Instance;
                if (crci != null)
                {
                    // if the Volume is NULL, nothing happens
                    crci.PlaceIn(this.SelectedVolume);
                }
                break;

            default:
                break;
            }
        }
Exemple #4
0
        private void OnSwitchFromCompRepToZonedVolumeCommand(object _o)
        {
            CompRepInfo comp = _o as CompRepInfo;

            if (comp == null)
            {
                return;
            }

            this.viewPort.SwitchActionModeCmd.Execute("BUILDING_PHYSICS");
            switch (comp.GR_State.Type)
            {
            case InterProcCommunication.Specific.Relation2GeomType.DESCRIBES:
                CompRepDescirbes crd = comp as CompRepDescirbes;
                if (crd != null)
                {
                    this.ZoneDisp.SelectedEntity = crd.Geom_Zone;
                }
                break;

            default:
                break;
            }
        }
Exemple #5
0
        // for a sequence of messages
        public void AddCompReps(List <ComponentMessage> _cmsgs)
        {
            if (_cmsgs == null)
            {
                return;
            }
            if (_cmsgs.Count == 0)
            {
                return;
            }

            // add all
            List <CompRep> added = new List <CompRep>();

            foreach (ComponentMessage cmsg in _cmsgs)
            {
                CompRep cr_new = AddCompRep(cmsg);
                if (cr_new != null)
                {
                    added.Add(cr_new);
                }
            }
            if (added.Count == 0)
            {
                // updates only of Component Ids, if any
                this.RecordChanged = false;
                this.RecordChanged = true;
                return;
            }

            // establish the relationships btw the component representations:
            // assign the parent ID
            // assing the representations of sub-components
            foreach (CompRep cr in added)
            {
                CompRepInfo cri = cr as CompRepInfo;
                if (cri == null)
                {
                    continue;
                }

                if (cri.Comp_Parent > -1)
                {
                    CompRepInfo parent = this.FindByCompId(cri.Comp_Parent);
                    if (parent != null)
                    {
                        cri.CR_Parent = parent.CR_ID;
                        parent.AddSubCompRep(cri);
                        this.comp_rep_record.Remove(cri);
                    }
                }
            }
            this.UpdateFlatRecord();

            // establish connectivity
            List <CompRepContainedIn> connection_nodes =
                this.comp_rep_record_flat.Where(x => x is CompRepContainedIn).Select(x => x as CompRepContainedIn).ToList();

            if (connection_nodes.Count > 0)
            {
                foreach (CompRep cr in this.comp_rep_record_flat)
                {
                    if (cr is CompRepConnects)
                    {
                        CompRepConnects connection_edge = cr as CompRepConnects;
                        connection_edge.RetrieveConnectionPoints(connection_nodes);
                    }
                }
            }

            // re-associate with existing geometry (this causes information flow back to the ComponentBuilder)
            // NOTE: after the hierarchy has been established in the previous step
            foreach (CompRep cr in this.comp_rep_record_flat)
            {
                if (cr is CompRepDescirbes)
                {
                    CompRepDescirbes crd = cr as CompRepDescirbes;
                    if (crd.GR_State.IsRealized)
                    {
                        this.communcation_manager.ConnectCompRepToZonedVolume(crd);
                    }
                }
                else if (cr is CompRepAlignedWith)
                {
                    CompRepAlignedWith cra = cr as CompRepAlignedWith;
                    this.communcation_manager.ConnectCompRepToMaterial(cra);
                }
            }

            // done
            this.RecordChanged = false;
            this.RecordChanged = true;
        }
Exemple #6
0
        public CompRep AddCompRep(ComponentMessage _cmsg)
        {
            if (_cmsg == null)
            {
                return(null);
            }
            if (this.communcation_manager == null)
            {
                return(null);                                   // unable to communicate...
            }
            // check for duplicate COMPONENT representations
            CompRep same_comp_id = this.FindByCompId(_cmsg.CompID);

            if (same_comp_id != null)
            {
                return(same_comp_id);
            }

            // check for component representations with duplicate content -> take the one with the VALID COMPONENT ID
            CompRepInfo same_comp_content = this.FindSameStructureNoCompId(_cmsg);

            if (same_comp_content != null)
            {
                // just transfer the comp id
                same_comp_content.AdoptCompId(_cmsg);
                return(null);
            }

            // creates a representation of a component that has been here before and looks for the referenced geometry
            // OR...
            // creates a representation of a component that is here for the first time
            switch (_cmsg.GeomType)
            {
            case InterProcCommunication.Specific.Relation2GeomType.DESCRIBES:
                CompRepDescirbes created_D = new CompRepDescirbes(_cmsg, this.communcation_manager);
                this.AddCompRepToRecord(created_D);
                return(created_D);

            case InterProcCommunication.Specific.Relation2GeomType.DESCRIBES_3D:
                CompRepDescirbes3D created_D3d = new CompRepDescirbes3D(_cmsg, this.communcation_manager);
                this.AddCompRepToRecord(created_D3d);
                return(created_D3d);

            case InterProcCommunication.Specific.Relation2GeomType.DESCRIBES_2DorLESS:
                CompRepDescribes2DorLess created_D2d = new CompRepDescribes2DorLess(_cmsg, this.communcation_manager);
                this.AddCompRepToRecord(created_D2d);
                return(created_D2d);

            case InterProcCommunication.Specific.Relation2GeomType.GROUPS:
                return(null);

            case InterProcCommunication.Specific.Relation2GeomType.CONTAINED_IN:
                CompRepContainedIn created_CI = new CompRepContainedIn(_cmsg, this.communcation_manager);
                this.AddCompRepToRecord(created_CI);
                return(created_CI);

            case InterProcCommunication.Specific.Relation2GeomType.CONNECTS:
                CompRepConnects created_CO = new CompRepConnects(_cmsg, this.communcation_manager);
                this.AddCompRepToRecord(created_CO);
                return(created_CO);

            case InterProcCommunication.Specific.Relation2GeomType.ALIGNED_WITH:
                CompRepAlignedWith created_A = new CompRepAlignedWith(_cmsg, this.communcation_manager);
                this.AddCompRepToRecord(created_A);
                return(created_A);

            case InterProcCommunication.Specific.Relation2GeomType.NONE:
                // this is for the parent of a geometry containing component
                CompRepInfo created_N = new CompRepInfo(_cmsg, this.communcation_manager);
                this.AddCompRepToRecord(created_N);
                return(created_N);

            default:
                return(null);
            }
        }