public static string Relationship2GeometryToString(Relation2GeomType _rel)
        {
            switch (_rel)
            {
            case Relation2GeomType.DESCRIBES:
                return("DESCRIBES");

            case Relation2GeomType.DESCRIBES_3D:
                return("DESCRIBES_3D");

            case Relation2GeomType.DESCRIBES_2DorLESS:
                return("DESCRIBES_2DorLESS");

            case Relation2GeomType.ALIGNED_WITH:
                return("ALIGNED_WITH");

            case Relation2GeomType.CONTAINED_IN:
                return("CONTAINED_IN");

            case Relation2GeomType.CONNECTS:
                return("CONNECTS");

            case Relation2GeomType.GROUPS:
                return("GROUPS");

            default:
                return("NONE");
            }
        }
        public static string Relationship2GeometryToDescrDE(Relation2GeomType _rel)
        {
            switch (_rel)
            {
            case Relation2GeomType.DESCRIBES:
                return("Beschreibt Raum");

            case Relation2GeomType.DESCRIBES_3D:
                return("Beschreibt Volumen");

            case Relation2GeomType.DESCRIBES_2DorLESS:
                return("Beschreibt Fläche / Kante");

            case Relation2GeomType.ALIGNED_WITH:
                return("Begrenzend");

            case Relation2GeomType.CONTAINED_IN:
                return("Verortet");

            case Relation2GeomType.CONNECTS:
                return("Verbindend");

            case Relation2GeomType.GROUPS:
                return("Gruppierend");

            default:
                return("keine Geometrie");
            }
        }
예제 #3
0
        public static string Relationship2GeometryToCompNameDE(Relation2GeomType _rel)
        {
            switch (_rel)
            {
            case Relation2GeomType.DESCRIBES:
                return("Raum");

            case Relation2GeomType.DESCRIBES_3D:
                return("Volumen");

            case Relation2GeomType.DESCRIBES_2DorLESS:
                return("Fläche");

            case Relation2GeomType.ALIGNED_WITH:
                return("Aufbau");

            case Relation2GeomType.CONTAINED_IN:
                return("Verortung");

            case Relation2GeomType.CONNECTS:
                return("Verbindung");

            case Relation2GeomType.GROUPS:
                return("Gruppe");

            default:
                return("---");
            }
        }
예제 #4
0
        public static Dictionary <string, double> GetReservedParamDictionary(Relation2GeomType _type)
        {
            Dictionary <string, double> output = new Dictionary <string, double>();

            switch (_type)
            {
            case Relation2GeomType.DESCRIBES_3D:
            case Relation2GeomType.GROUPS:
                output.Add(RP_K_FOK, 0.0);
                output.Add(RP_K_FOK_ROH, 0.0);
                output.Add(RP_K_F_AXES, 0.0);
                output.Add(RP_K_DUK, 0.0);
                output.Add(RP_K_DUK_ROH, 0.0);
                output.Add(RP_K_D_AXES, 0.0);
                output.Add(RP_H_NET, 0.0);
                output.Add(RP_H_GROSS, 0.0);
                output.Add(RP_H_AXES, 0.0);
                output.Add(RP_L_PERIMETER, 0.0);
                output.Add(RP_AREA_BGF, 0.0);
                output.Add(RP_AREA_NGF, 0.0);
                output.Add(RP_AREA_NF, 0.0);
                output.Add(RP_AREA_AXES, 0.0);
                output.Add(RP_VOLUME_BRI, 0.0);
                output.Add(RP_VOLUME_NRI, 0.0);
                output.Add(RP_VOLUME_NRI_NF, 0.0);
                output.Add(RP_VOLUME_AXES, 0.0);
                break;

            case Relation2GeomType.DESCRIBES_2DorLESS:
                output.Add(RP_AREA, 0.0);
                output.Add(RP_AREA_MIN, 0.0);
                output.Add(RP_AREA_MAX, 0.0);
                output.Add(RP_WIDTH, 0.0);
                output.Add(RP_WIDTH_MIN, 0.0);
                output.Add(RP_WIDTH_MAX, 0.0);
                output.Add(RP_HEIGHT, 0.0);
                output.Add(RP_HEIGHT_MIN, 0.0);
                output.Add(RP_HEIGHT_MAX, 0.0);
                break;

            case Relation2GeomType.ALIGNED_WITH:
                output.Add(RP_AREA, 0.0);
                output.Add(RP_MATERIAL_COMPOSITE_D_OUT, 0.0);
                output.Add(RP_MATERIAL_COMPOSITE_D_IN, 0.0);
                output.Add(RP_COUNT, 0.0);
                break;

            case Relation2GeomType.CONTAINED_IN:
            case Relation2GeomType.CONNECTS:
            default:
                break;
            }

            return(output);
        }
예제 #5
0
        public static ComponentMessage AssembleComponentMessage(Component _comp, MessagePositionInSeq _pos, long _parent_id)
        {
            if (_comp == null)
            {
                return(null);
            }
            if (_comp.R2GInstances == null || _comp.R2GInstances.Count == 0)
            {
                return(null);
            }

            List <ComponentMessage> messages = new List <ComponentMessage>();

            // translate Pt.1
            // translate the geometry type(s)
            Relation2GeomType gr_type_main = Relation2GeomType.NONE;
            List <InterProcCommunication.Specific.GeometricRelationship> translated_geom_relationships = new List <InterProcCommunication.Specific.GeometricRelationship>();

            foreach (ParameterStructure.Geometry.GeometricRelationship gr in _comp.R2GInstances)
            {
                Relation2GeomType gr_type = InterProcCommunication.Specific.GeometryUtils.StringToRelationship2Geometry(ParameterStructure.Geometry.GeometryUtils.Relationship2GeometryToString(gr.State.Type));
                if (gr_type_main == Relation2GeomType.NONE)
                {
                    gr_type_main = gr_type;
                }
                Relation2GeomState gr_state = new Relation2GeomState {
                    Type = gr_type, IsRealized = gr.State.IsRealized
                };
                InterProcCommunication.Specific.GeometricRelationship gr_translated = new InterProcCommunication.Specific.GeometricRelationship(gr.ID, gr.Name, gr_state, gr.GeomIDs, gr.GeomCS, gr.TRm_WC2LC, gr.TRm_LC2WC,
                                                                                                                                                gr.InstanceSize, gr.InstanceNWElementID, gr.InstanceNWElementName, gr.InstancePath);
                translated_geom_relationships.Add(gr_translated);
            }

            // translate Pt.2
            // assemble the parameter dictionary according to geometry relationship type
            Dictionary <string, double> guide  = Comp2GeomCommunication.GetReservedParamDictionary(gr_type_main);
            Dictionary <string, double> p_dict = Comp2GeomCommunication.GetReservedParamDictionary(gr_type_main);

            foreach (var entry in guide)
            {
                Parameter p = _comp.ContainedParameters.Values.FirstOrDefault(x => x.Name == entry.Key);
                if (p != null)
                {
                    p_dict[entry.Key] = p.ValueCurrent;
                }
            }

            // done
            return(new ComponentMessage(_pos, _parent_id, _comp.ID, _comp.IsAutomaticallyGenerated, _comp.CurrentSlot + " " + _comp.Name + " " + _comp.Description,
                                        _comp.GetIdsOfAllReferencedComponents(), p_dict, translated_geom_relationships, -1L, -1L, MessageAction.NONE));
        }
예제 #6
0
        private void Reset()
        {
            // parsed message STRUCTURE
            this.p_msg_pos               = MessagePositionInSeq.UNKNOWN;
            this.p_comp_parent_id        = -1;
            this.p_comp_repres_id        = -1;
            this.p_comp_repres_parent_id = -1;

            this.nr_comp_ref_ids      = 0;
            this.nr_comp_ref_ids_read = 0;
            this.p_comp_ref_ids       = new List <long>();

            this.p_msg_action_to_take = MessageAction.NONE;

            // parsed message CONTENT
            this.p_comp_id        = -1;
            this.p_comp_autom_gen = false;
            this.p_comp_descr     = "ComponentMessage";
            this.p_comp_params    = new Dictionary <string, double>();

            this.nr_comp_params      = 0;
            this.nr_comp_params_read = 0;
            this.param_name          = string.Empty;

            this.nr_geom_relationships      = 0;
            this.nr_geom_relationships_read = 0;

            this.p_gr_id               = -1;
            this.p_gr_name             = "Geometric Relationship";
            this.p_gr_state_type       = Relation2GeomType.NONE;
            this.p_gr_state_isRealized = false;
            this.p_gr_ids              = new Point4D(-1, -1, -1, -1);
            this.p_gr_ucs              = Matrix3D.Identity;
            this.p_gr_trWC2LC          = Matrix3D.Identity;
            this.p_gr_trLC2WC          = Matrix3D.Identity;

            this.p_gr_inst_size                 = new List <double>();
            this.pp_gr_nr_inst_size             = 0;
            this.p_gr_inst_nwe_id               = -1L;
            this.p_gr_inst_nwe_name             = "NW_Element";
            this.p_gr_inst_path                 = new List <Point3D>();
            this.pp_gr_nr_inst_path             = 0;
            this.pp_gr_inst_path_current_vertex = new Point3D(0, 0, 0);

            this.geom_relationships = new List <GeometricRelationship>();
        }
        public string GenerateSlotFor(Relation2GeomType _type, bool _for_subcomponents)
        {
            int    slot_counter    = 0;
            int    iteration_guard = 100;
            string slot            = ComponentUtils.Relation2GeomTypeToSlot(_type) +
                                     ComponentUtils.COMP_SLOT_DELIMITER + "AG" + slot_counter.ToString();

            // check if the component already has such a slot
            if (_for_subcomponents)
            {
                while (this.ContainedComponents.ContainsKey(slot) && slot_counter < iteration_guard)
                {
                    slot_counter++;
                    slot = ComponentUtils.Relation2GeomTypeToSlot(_type) +
                           ComponentUtils.COMP_SLOT_DELIMITER + "AG" + slot_counter.ToString();
                }
                if (this.ContainedComponents.ContainsKey(slot))
                {
                    return(null); // something went very wrong!
                }
            }
            else
            {
                while (this.ReferencedComponents.ContainsKey(slot) && slot_counter < iteration_guard)
                {
                    slot_counter++;
                    slot = ComponentUtils.Relation2GeomTypeToSlot(_type) +
                           ComponentUtils.COMP_SLOT_DELIMITER + "AG" + slot_counter.ToString();
                }
                if (this.ReferencedComponents.ContainsKey(slot))
                {
                    return(null); // something went very wrong!
                }
            }

            return(slot);
        }
        }                                           // default value = NONE

        public Relation2GeomState(Relation2GeomState _state)
            : this()
        {
            this.IsRealized = _state.IsRealized;
            this.Type       = _state.Type;
        }
예제 #9
0
 public int GetNrOfLoaded(Relation2GeomType _type)
 {
     return(this.comp_rep_record_flat.Where(x => x is CompRepInfo).Select(x => x as CompRepInfo).Count(x => x.GR_State.Type == _type));
 }
예제 #10
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;
            }
        }