コード例 #1
0
        void ZoneDisp_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            ZoneGroupDisplay zgd = sender as ZoneGroupDisplay;

            if (zgd != null)
            {
                if (e != null && e.PropertyName == "PickedZonedVolume")
                {
                    if (this.comp_waiting_to_be_assoc_w_volume != null && this.comp_waiting_for_picked_volume)
                    {
                        // complete command OnAssociateCompRepWZonedVolumeCommand()
                        zgd.EManager.ReAssociateZonedVolumeWComp(this.comp_waiting_to_be_assoc_w_volume);

                        this.viewPort.SwitchActionModeCmd.Execute("SPACES_OPENINGS");
                        if (this.CompDisp != null)
                        {
                            this.CompDisp.CompRepMANAGER.UpdateFlatRecord();
                            this.CompDisp.UpdateCompRepList();
                        }
                        // this.viewPort.SendDataToCompBuilder(this.comp_waiting_to_be_assoc_w_volume); // not necessary, call is performed from the CompRep class
                        this.comp_waiting_for_picked_volume = false;
                    }
                    else if (this.comp_waiting_to_be_aligned_w_volume_wall != null && this.comp_waiting_for_alignment_w_picked_volume_wall)
                    {
                        // complete command OnAlignCompRepWZonedVolumeCommand()
                        ZonedVolume selected_vol = zgd.EManager.SelectedVolume;
                        CompRepContainedIn_Instance selected_comp = this.comp_waiting_to_be_aligned_w_volume_wall as CompRepContainedIn_Instance;
                        if (selected_vol != null && selected_comp != null && selected_comp.GR_Relationships[0].GrIds.X == selected_vol.ID)
                        {
                            bool    successful_wall_hit = false;
                            Vector3 new_X_Axis          = selected_vol.GetHorizontalAxisOfHitWall(zgd.HitPointOnVolumeMesh.ToVector3(), out successful_wall_hit);
                            if (successful_wall_hit)
                            {
                                selected_comp.AlignPlacement(new_X_Axis.ToVector3D());
                            }
                            this.viewPort.SwitchActionModeCmd.Execute("SPACES_OPENINGS");
                            if (this.CompDisp != null)
                            {
                                this.CompDisp.CompRepMANAGER.UpdateFlatRecord();
                                this.CompDisp.UpdateCompRepList();
                            }
                        }

                        this.comp_waiting_for_alignment_w_picked_volume_wall = false;
                    }
                }
            }
        }
コード例 #2
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;
            }
        }