Exemple #1
0
        internal void PlaceInFlowNetworkElement(Component.FlNetElement _nwe, System.Windows.Point _offset, double _scale, List <double> _sizes, Dictionary <string, double> _params)
        {
            if (this.State.IsRealized)
            {
                return;
            }

            if (_nwe == null || _sizes == null || _params == null)
            {
                return;
            }
            if (_sizes.Count < 6)
            {
                return;
            }

            List <Point3D> gr_path;
            Matrix3D       gr_ucs;

            GeometricRelationship.DeriveGeomPositionOutOfPlacementIn(_nwe, _offset, _scale, out gr_ucs, out gr_path);
            this.GeomCS = gr_ucs;
            if (this.State.Type == Relation2GeomType.CONNECTS)
            {
                this.InstancePath = gr_path;
            }

            this.InstanceNWElementID             = _nwe.ID;
            this.InstanceNWElementName           = _nwe.Name;
            this.InstanceSize                    = new List <double>(_sizes);
            this.instance_size_transfer_settings = new List <GeomSizeTransferDef>(); // per default NONE (i.e. direct user input into the InstanceSize list)
            this.InstanceParamValues             = new Dictionary <string, double>(_params);
        }
Exemple #2
0
        internal static GeometricRelationship CreateAndPlaceInFlowNetworkElement(Component.FlNetElement _nwe, System.Windows.Point _offset, double _scale, Dictionary <string, double> _params)
        {
            if (_nwe == null)
            {
                return(null);
            }

            Relation2GeomState gr_state = new Relation2GeomState
            {
                IsRealized = false,
                Type       = (_nwe is Component.FlNetEdge) ? Relation2GeomType.CONNECTS : Relation2GeomType.CONTAINED_IN
            };

            List <Point3D> gr_path;
            Matrix3D       gr_ucs;

            GeometricRelationship.DeriveGeomPositionOutOfPlacementIn(_nwe, _offset, _scale, out gr_ucs, out gr_path);

            GeometricRelationship gr_placement = new GeometricRelationship("placement", gr_state, new Point4D(-1, -1, -1, -1),
                                                                           gr_ucs, Matrix3D.Identity, Matrix3D.Identity); // todo: adjust the transforms...

            gr_placement.instance_size = new List <double> {
                0, 0, 0, 0, 0, 0
            };
            gr_placement.instance_size_transfer_settings = new List <GeomSizeTransferDef>();
            gr_placement.instance_nwe_id     = _nwe.ID;
            gr_placement.instance_nwe_name   = _nwe.Name;
            gr_placement.InstancePath        = gr_path;
            gr_placement.InstanceParamValues = (_params == null) ? new Dictionary <string, double>() : new Dictionary <string, double>(_params);

            return(gr_placement);
        }
Exemple #3
0
        /// <summary>
        /// <para>Updates the local coordinate system if _nwe is a node.</para>
        /// <para>If _nwe is an edge, it also updates the path. If the geometric relationship is already realized nothing changes.</para>
        /// </summary>
        internal void UpdatePositionFrom(Component.FlNetElement _nwe, System.Windows.Point _offset, double _scale)
        {
            if (this.State.IsRealized)
            {
                return;
            }
            if (_nwe == null)
            {
                return;
            }

            List <Point3D> gr_path;
            Matrix3D       gr_ucs;

            GeometricRelationship.DeriveGeomPositionOutOfPlacementIn(_nwe, _offset, _scale, out gr_ucs, out gr_path);

            this.GeomCS = gr_ucs;
            if (this.State.Type == Relation2GeomType.CONNECTS)
            {
                this.InstancePath = gr_path;
            }
        }