Пример #1
0
        public GeometricRelationship(long _gr_id, string _gr_name, Relation2GeomState _gr_state, Point4D _gr_ids,
                                     Matrix3D _gr_ucs, Matrix3D _gr_trWC2LC, Matrix3D _gr_trLC2WC)
        {
            this.gr_id      = _gr_id;
            this.gr_name    = _gr_name;
            this.gr_state   = _gr_state;
            this.gr_ids     = _gr_ids;
            this.gr_ucs     = _gr_ucs;
            this.gr_trWC2LC = _gr_trWC2LC;
            this.gr_trLC2WC = _gr_trLC2WC;

            this.inst_size     = new List <double>();
            this.inst_nwe_id   = -1L;
            this.inst_nwe_name = "NW_Element";
            this.inst_path     = new List <Point3D>();
        }
Пример #2
0
        public GeometricRelationship(GeometricRelationship _original)
        {
            this.gr_id    = _original.gr_id;
            this.gr_name  = _original.gr_name;
            this.gr_state = new Relation2GeomState {
                Type = _original.gr_state.Type, IsRealized = false
            };
            this.gr_ids     = _original.gr_ids;
            this.gr_ucs     = _original.gr_ucs;
            this.gr_trWC2LC = _original.gr_trWC2LC;
            this.gr_trLC2WC = _original.gr_trLC2WC;

            this.inst_size     = new List <double>(_original.InstSize);
            this.inst_nwe_id   = _original.InstNWeId;
            this.inst_nwe_name = _original.InstNWeName;
            this.inst_path     = new List <Point3D>(_original.InstPath);
        }
Пример #3
0
        public GeometricRelationship(long _gr_id, string _gr_name, Relation2GeomState _gr_state, Point4D _gr_ids,
                                     Matrix3D _gr_ucs, Matrix3D _gr_trWC2LC, Matrix3D _gr_trLC2WC,
                                     List <double> _inst_size, long _inst_nwe_id, string _inst_nwe_name, List <Point3D> _inst_path)
        {
            this.gr_id      = _gr_id;
            this.gr_name    = _gr_name;
            this.gr_state   = _gr_state;
            this.gr_ids     = _gr_ids;
            this.gr_ucs     = _gr_ucs;
            this.gr_trWC2LC = _gr_trWC2LC;
            this.gr_trLC2WC = _gr_trLC2WC;

            this.inst_size     = new List <double>(_inst_size);
            this.inst_nwe_id   = _inst_nwe_id;
            this.inst_nwe_name = (string.IsNullOrEmpty(_inst_nwe_name)) ? "NW_Element" : _inst_nwe_name;
            this.inst_path     = new List <Point3D>(_inst_path);
        }
Пример #4
0
        }                                           // default value = NONE

        public Relation2GeomState(Relation2GeomState _state)
            : this()
        {
            this.IsRealized = _state.IsRealized;
            this.Type       = _state.Type;
        }
Пример #5
0
        private void ParseComponentMessage()
        {
            switch (this.FCode)
            {
            case (int)MessageCode.ENTITY_START:
                // start of entity ... do nothing
                break;

            case (int)MessageCode.MSG_POSITION:
                this.p_msg_pos = ComponentMessage.StringToMessagePositionInSeq(this.FValue);
                break;

            case (int)MessageCode.MSG_COMP_PARENT_ID:
                this.p_comp_parent_id = this.LongValue();
                break;

            case (int)MessageCode.MSG_COMP_REPRESENTATION_ID:
                this.p_comp_repres_id = this.LongValue();
                break;

            case (int)MessageCode.MSG_COMP_REPRESENTATION_PARENT_ID:
                this.p_comp_repres_parent_id = this.LongValue();
                break;

            case (int)MessageCode.MSG_COMP_REF_IDS_SEQUENCE:
                this.nr_comp_ref_ids = this.IntValue();
                break;

            case (int)MessageCode.MSG_COMP_REF_ID:
                if (this.nr_comp_ref_ids > this.nr_comp_ref_ids_read)
                {
                    this.p_comp_ref_ids.Add(this.LongValue());
                    this.nr_comp_ref_ids_read++;
                }
                break;

            case (int)MessageCode.MSG_COMP_ACTION:
                this.p_msg_action_to_take = ComponentMessage.StringToMessageAction(this.FValue);
                break;

            case (int)MessageCode.COMP_ID:
                this.p_comp_id = this.LongValue();
                break;

            case (int)MessageCode.COMP_AUTOM_GEN:
                this.p_comp_autom_gen = (this.IntValue() == 1);
                break;

            case (int)MessageCode.COMP_DESCR:
                this.p_comp_descr = this.FValue;
                break;

            case (int)MessageCode.PARAM_SEQUENCE:
                this.nr_comp_params = this.IntValue();
                break;

            case (int)MessageCode.PARAM_NAME:
                this.param_name = this.FValue;
                break;

            case (int)MessageCode.PARAM_VALUE:
                if (!string.IsNullOrEmpty(this.param_name) && this.nr_comp_params > this.nr_comp_params_read)
                {
                    double param_value = this.DoubleValue();
                    this.p_comp_params.Add(this.param_name, param_value);
                    this.param_name = string.Empty;
                    this.nr_comp_params_read++;
                }
                break;

            case (int)MessageCode.GR_SEQUENCE:
                this.nr_geom_relationships = this.IntValue();
                break;

            case (int)MessageCode.GR_ID:
                this.p_gr_id = this.LongValue();
                break;

            case (int)MessageCode.GR_NAME:
                this.p_gr_name = this.FValue;
                break;

            case (int)MessageCode.GR_STATE_TYPE:
                this.p_gr_state_type = GeometryUtils.StringToRelationship2Geometry(this.FValue);
                break;

            case (int)MessageCode.GR_STATE_ISREALIZED:
                this.p_gr_state_isRealized = (this.IntValue() == 1);
                break;

            case (int)MessageCode.GR_GEOM_IDS_X:
                this.p_gr_ids.X = this.IntValue();
                break;

            case (int)MessageCode.GR_GEOM_IDS_Y:
                this.p_gr_ids.Y = this.IntValue();
                break;

            case (int)MessageCode.GR_GEOM_IDS_Z:
                this.p_gr_ids.Z = this.IntValue();
                break;

            case (int)MessageCode.GR_GEOM_IDS_W:
                this.p_gr_ids.W = this.IntValue();
                break;

            case (int)MessageCode.GR_GEOM_CS:
                this.p_gr_ucs = Matrix3D.Parse(this.FValue);
                break;

            // instance information
            case (int)MessageCode.GR_INST_SIZE:
                this.pp_gr_nr_inst_size = this.IntValue();
                break;

            case (int)MessageCode.GR_INST_NWE_ID:
                this.p_gr_inst_nwe_id = this.LongValue();
                break;

            case (int)MessageCode.GR_INST_NWE_NAME:
                this.p_gr_inst_nwe_name = this.FValue;
                break;

            case (int)MessageCode.GR_INST_PATH:
                this.pp_gr_nr_inst_path = this.IntValue();
                break;

            case (int)MessageCode.GR_INST_VAL_X:
                if (this.pp_gr_nr_inst_size > this.p_gr_inst_size.Count)
                {
                    this.p_gr_inst_size.Add(this.DoubleValue());
                }
                else if (this.pp_gr_nr_inst_path > this.p_gr_inst_path.Count)
                {
                    this.pp_gr_inst_path_current_vertex.X = this.DoubleValue();
                }
                break;

            case (int)MessageCode.GR_INST_VAL_Y:
                if (this.pp_gr_nr_inst_path > this.p_gr_inst_path.Count)
                {
                    this.pp_gr_inst_path_current_vertex.Y = this.DoubleValue();
                }
                break;

            case (int)MessageCode.GR_INST_VAL_Z:
                if (this.pp_gr_nr_inst_path > this.p_gr_inst_path.Count)
                {
                    this.pp_gr_inst_path_current_vertex.Z = this.DoubleValue();
                    this.p_gr_inst_path.Add(this.pp_gr_inst_path_current_vertex);
                    this.pp_gr_inst_path_current_vertex = new Point3D(0, 0, 0);
                }
                break;

            // transforms
            case (int)MessageCode.GR_TRANSF_WC2LC:
                this.p_gr_trWC2LC = Matrix3D.Parse(this.FValue);
                break;

            case (int)MessageCode.GR_TRANSF_LC2WC:
                // should come last for every GeometricRelationship
                this.p_gr_trLC2WC = Matrix3D.Parse(this.FValue);
                if (this.nr_geom_relationships > this.nr_geom_relationships_read)
                {
                    Relation2GeomState gr_state = new Relation2GeomState {
                        Type = this.p_gr_state_type, IsRealized = this.p_gr_state_isRealized
                    };
                    GeometricRelationship gr = new GeometricRelationship(this.p_gr_id, this.p_gr_name, gr_state, this.p_gr_ids,
                                                                         this.p_gr_ucs, this.p_gr_trWC2LC, this.p_gr_trLC2WC,
                                                                         this.p_gr_inst_size, this.p_gr_inst_nwe_id, this.p_gr_inst_nwe_name, this.p_gr_inst_path);
                    this.geom_relationships.Add(gr);
                    this.nr_geom_relationships_read++;
                    this.p_gr_inst_size = new List <double>();
                    this.p_gr_inst_path = new List <Point3D>();
                }
                break;
            }
        }