コード例 #1
0
        private void SetAssociatedSource(TargetSource value)
        {
            if (associatedSource != value)
            {
                associatedSource = value;

                if (associatedSource == TargetSource.DataSourceValue)
                {
                    AssociatedTarget = new Dynamics365DataSourceValue(this);
                }
                else if (associatedSource == TargetSource.LookupValue)
                {
                    AssociatedTarget = new Dynamics365LookupValue(this);
                }
                else if (associatedSource == TargetSource.UserProvidedValue)
                {
                    AssociatedTarget = new Dynamics365UserProvidedValue(this);
                }
                else
                {
                    AssociatedTarget = default(FieldValue);
                }

                RefreshBrowsableFields();
                OnPropertyChanged(nameof(AssociatedSource));
            }
        }
コード例 #2
0
        protected virtual void SaveTargetObjects(List <IDataObject> targetObjects)
        {
            try
            {
                TraceLine($"Saving {targetObjects.Count} objects...");
                var newObjectsCount = targetObjects.Count(i => i.IsNew);

                if (newObjectsCount > 0)
                {
                    TraceLine($"New objects: {newObjectsCount}");
                }

                var stopWath = new Stopwatch();
                stopWath.Start();

                TargetSource.SaveObjects(targetObjects);
                stopWath.Stop();

                TraceLine($"Saved {targetObjects.Count} objects, time: {stopWath.Elapsed.TotalMinutes} min");
            }
            catch (Exception ex)
            {
                var objectsInfo = targetObjects.Select(i => i.GetInfo()).Join("\n===========================\n");
                TraceLine("=====Error while saving transitted objects: " + ex + objectsInfo);
                throw;
            }

            targetObjects.Clear();
        }
コード例 #3
0
        /// <summary>
        /// Sets the TargetSource value and makes the appropriate properties browsable.
        /// </summary>
        /// <param name="value"></param>
        protected virtual void SetTargetSource(TargetSource value)
        {
            if (targetSource != value)
            {
                targetSource = value;

                if (targetSource == TargetSource.DataSourceValue)
                {
                    Target = new Dynamics365DataSourceValue(this);
                    CoreUtility.SetBrowsable(this, nameof(Target), true);
                }
                else if (targetSource == TargetSource.LookupValue)
                {
                    Target = new Dynamics365LookupValue(this);
                    CoreUtility.SetBrowsable(this, nameof(Target), true);
                }
                else if (targetSource == TargetSource.UserProvidedValue)
                {
                    Target = new Dynamics365UserProvidedValue(this);
                    CoreUtility.SetBrowsable(this, nameof(Target), true);
                }
                else
                {
                    Target = default(FieldValue);
                    CoreUtility.SetBrowsable(this, nameof(Target), false);
                }

                RefreshBrowsableFields();
                OnPropertyChanged(nameof(TargetSource));
                RefreshName();
                // todo - events if properties within target source change
            }
        }
コード例 #4
0
ファイル: Target.cs プロジェクト: armorunicorn/YimaWF
 public Target(int id, double course, float speed, TargetSource source = TargetSource.Radar)
 {
     Source     = source;
     ID         = id;
     Course     = course;
     Speed      = speed;
     Type       = TargetType.Unknow;
     ShowStatus = true;
 }
コード例 #5
0
        public override IValueHolder Calculate()
        {
            if (!TargetSource.Contains(Name))
            {
                throw new Exception($"Variable {Name} does not exist in current context. " +
                                    $"If the set is dependent, merge it with another set or declare a variable {Name}.");
            }

            return(new ValueHolder(TargetSource[Name].LastValue));
        }
コード例 #6
0
        public void SetValue(float value, TargetSource source) //source of value
        {
            //Keep previous values in history before changing
            PreviousTarget = new Target {
                Value = this.Value, Source = this.Source
            };

            //set new values
            this.Value  = value;
            this.Source = source;
        }
コード例 #7
0
ファイル: RelativeTarget.cs プロジェクト: venotp/tranquire
        /// <inheritdoc />
        public IWebElement ResolveFor(ISearchContext searchContext)
        {
            if (searchContext == null)
            {
                throw new System.ArgumentNullException(nameof(searchContext));
            }

            var element = TargetSource.ResolveFor(searchContext);

            return(Target.ResolveFor(element));
        }
コード例 #8
0
ファイル: RelativeTarget.cs プロジェクト: venotp/tranquire
        /// <inheritdoc />
        public ImmutableArray <IWebElement> ResolveAllFor(ISearchContext searchContext)
        {
            if (searchContext == null)
            {
                throw new System.ArgumentNullException(nameof(searchContext));
            }

            var elements = TargetSource.ResolveAllFor(searchContext);

            return(elements.SelectMany(e => Target.ResolveAllFor(e)).ToImmutableArray());
        }
コード例 #9
0
        private void UpdateTargetFromSource(SerializedProperty property, TargetSource esrc)
        {
            switch (esrc)
            {
            case TargetSource.Arg:
            {
                property.objectReferenceValue = null;
            }
            break;

            case TargetSource.Self:
            {
                UnityEngine.Object obj = property.serializedObject.targetObject;
                if (this.TargetType != null)
                {
                    obj = ObjUtil.GetAsFromSource(this.TargetType, obj) as UnityEngine.Object;
                }
                property.objectReferenceValue = obj;
            }
            break;

            case TargetSource.Root:
            {
                UnityEngine.Object obj = property.serializedObject.targetObject;
                var go = GameObjectUtil.GetGameObjectFromSource(obj);
                if (go != null)
                {
                    obj = go.FindRoot();
                }

                if (this.TargetType != null)
                {
                    obj = ObjUtil.GetAsFromSource(this.TargetType, obj) as UnityEngine.Object;
                }
                property.objectReferenceValue = obj;
            }
            break;

            case TargetSource.Config:
            {
                if (this.DefaultFromSelf && property.objectReferenceValue == null)
                {
                    UnityEngine.Object obj = property.serializedObject.targetObject;
                    if (this.TargetType != null)
                    {
                        obj = ObjUtil.GetAsFromSource(this.TargetType, obj) as UnityEngine.Object;
                    }
                    property.objectReferenceValue = obj;
                }
            }
            break;
            }
        }
コード例 #10
0
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            TargetSource source = (TargetSource)value;

            switch (source)
            {
            case TargetSource.AIS:
                return("AIS");

            case TargetSource.Merge:
                return("融合");

            case TargetSource.Radar:
                return("雷达");

            default:
                break;
            }

            return(null);
        }
        private static void UpdateTargetFromSource(SerializedProperty property, TargetSource esrc, System.Type targetType)
        {
            switch(esrc)
            {
                case TargetSource.Arg:
                    {
                        property.objectReferenceValue = null;
                    }
                    break;
                case TargetSource.Self:
                    {
                        UnityEngine.Object obj = property.serializedObject.targetObject;
                        if (targetType != null)
                            obj = ObjUtil.GetAsFromSource(targetType, obj) as UnityEngine.Object;
                        property.objectReferenceValue = obj;
                    }
                    break;
                case TargetSource.Root:
                    {
                        UnityEngine.Object obj = property.serializedObject.targetObject;
                        var go = GameObjectUtil.GetGameObjectFromSource(obj);
                        if (go != null)
                            obj = go.FindRoot();

                        if (targetType != null)
                            obj = ObjUtil.GetAsFromSource(targetType, obj) as UnityEngine.Object;
                        property.objectReferenceValue = obj;
                    }
                    break;
                case TargetSource.Config:
                    {
                        if(property.objectReferenceValue == null)
                        {
                            UnityEngine.Object obj = property.serializedObject.targetObject;
                            if (targetType != null)
                                obj = ObjUtil.GetAsFromSource(targetType, obj) as UnityEngine.Object;
                            property.objectReferenceValue = obj;
                        }
                    }
                    break;
            }
        }
コード例 #12
0
        protected virtual DMesh3 compute_sharp_edge_flow()
        {
            DMesh3   sourceMesh   = MeshSource.GetDMeshUnsafe();
            ISpatial inputSpatial = MeshSource.GetSpatial();

            DMesh3   targetMesh    = TargetSource.GetDMeshUnsafe();
            ISpatial targetSpatial = TargetSource.GetSpatial();

            DMesh3 meshIn = new DMesh3(sourceMesh);

            if (is_invalidated())
            {
                return(null);
            }

            RemesherPro remesher = new RemesherPro(meshIn);

            remesher.SetTargetEdgeLength(TargetEdgeLength);
            remesher.PreventNormalFlips = this.PreventNormalFlips;
            remesher.EnableFlips        = this.EnableFlips;
            remesher.EnableSplits       = this.EnableSplits;
            remesher.EnableCollapses    = this.EnableCollapses;
            remesher.EnableSmoothing    = this.EnableSmoothing;
            remesher.SmoothSpeedT       = this.SmoothingSpeed;

            TransformedMeshProjectionTarget target =
                new TransformedMeshProjectionTarget(targetMesh, targetSpatial)
            {
                SourceToTargetXForm = source_to_target,
                TargetToSourceXForm = target_to_source
            };

            remesher.SetProjectionTarget(target);

            if (sourceMesh.CachedIsClosed == false)
            {
                if (remesher.Constraints == null)
                {
                    remesher.SetExternalConstraints(new MeshConstraints());
                }

                if (BoundaryMode == BoundaryModes.FreeBoundaries)
                {
                    MeshConstraintUtil.PreserveBoundaryLoops(remesher.Constraints, meshIn);
                }
                else if (BoundaryMode == BoundaryModes.FixedBoundaries)
                {
                    MeshConstraintUtil.FixAllBoundaryEdges(remesher.Constraints, meshIn);
                }
                else if (BoundaryMode == BoundaryModes.ConstrainedBoundaries)
                {
                    MeshConstraintUtil.FixAllBoundaryEdges_AllowSplit(remesher.Constraints, meshIn, 0);
                }
            }
            if (is_invalidated())
            {
                return(null);
            }

            remesher.Progress = new ProgressCancel(is_invalidated);
            remesher.SharpEdgeReprojectionRemesh(RemeshRounds, ProjectionRounds);

            if (is_invalidated())
            {
                return(null);
            }
            return(meshIn);
        }
コード例 #13
0
        protected virtual DMesh3 compute_bounded_distance()
        {
            DMesh3   sourceMesh   = MeshSource.GetDMeshUnsafe();
            ISpatial inputSpatial = MeshSource.GetSpatial();

            DMesh3   targetMesh    = TargetSource.GetDMeshUnsafe();
            ISpatial targetSpatial = TargetSource.GetSpatial();

            double max_dist = (TargetMaxDistance == double.MaxValue) ? double.MaxValue : TargetMaxDistance;

            DMesh3 meshIn = new DMesh3(sourceMesh);

            bool target_closed           = targetMesh.IsClosed();
            MeshVertexSelection roiV     = new MeshVertexSelection(meshIn);
            SpinLock            roi_lock = new SpinLock();

            gParallel.ForEach(meshIn.VertexIndices(), (vid) => {
                Vector3d pos       = meshIn.GetVertex(vid);
                Vector3d posTarget = TransformToTarget.TransformP(pos);
                double dist        = MeshQueries.NearestPointDistance(targetMesh, targetSpatial, posTarget, max_dist);
                bool inside        = (target_closed && targetSpatial.IsInside(posTarget));
                if (dist < max_dist || inside)
                {
                    bool taken = false;
                    roi_lock.Enter(ref taken);
                    roiV.Select(vid);
                    roi_lock.Exit();
                }
            });
            if (is_invalidated())
            {
                return(null);
            }

            MeshFaceSelection roi_faces = new MeshFaceSelection(meshIn, roiV, 1);

            roi_faces.ExpandToOneRingNeighbours(3);
            roi_faces.LocalOptimize();
            if (is_invalidated())
            {
                return(null);
            }

            RegionOperator op      = new RegionOperator(meshIn, roi_faces);
            DMesh3         meshROI = op.Region.SubMesh;

            if (is_invalidated())
            {
                return(null);
            }

            RemesherPro remesher = new RemesherPro(meshROI);

            remesher.SetTargetEdgeLength(TargetEdgeLength);
            remesher.PreventNormalFlips = this.PreventNormalFlips;
            remesher.EnableFlips        = this.EnableFlips;
            remesher.EnableSplits       = this.EnableSplits;
            remesher.EnableCollapses    = this.EnableCollapses;
            remesher.EnableSmoothing    = this.EnableSmoothing;
            remesher.SmoothSpeedT       = this.SmoothingSpeed;

            BoundedProjectionTarget target = new BoundedProjectionTarget()
            {
                Source = sourceMesh, SourceSpatial = inputSpatial,
                Target = targetMesh, TargetSpatial = targetSpatial,
                SourceToTargetXForm = source_to_target,
                TargetToSourceXForm = target_to_source,
                MaxDistance         = max_dist,
                Smoothness          = transition_smoothness
            };

            remesher.SetProjectionTarget(target);

            if (remesher.Constraints == null)
            {
                remesher.SetExternalConstraints(new MeshConstraints());
            }
            MeshConstraintUtil.FixAllBoundaryEdges(remesher.Constraints, meshROI);
            if (is_invalidated())
            {
                return(null);
            }

            remesher.Progress = new ProgressCancel(is_invalidated);
            remesher.FastestRemesh(RemeshRounds);
            if (is_invalidated())
            {
                return(null);
            }

            op.BackPropropagate();

            return(meshIn);
        }
コード例 #14
0
    public override void DrawnNodeProperties(GUISkin skin)
    {
        base.DrawnNodeProperties(skin);
        FieldInspectorHelper.StartSection();

        targetSource = (TargetSource)FieldInspectorHelper.ShowEnumField("Target Source", targetSource, skin);


        FieldInspectorHelper.EndSection();

        switch (targetSource)
        {
        case TargetSource.SkillControl:
            break;

        case TargetSource.MouseToWorld:
        {
            FieldInspectorHelper.ShowTitle("Mouse To World", skin, false);
            FieldInspectorHelper.StartSection();
            mouseLayerMask = FieldInspectorHelper.ShowMaskField("Layer Mask", mouseLayerMask, skin);
            CameraType oldCamType = cameraType;
            cameraType = (CameraType)FieldInspectorHelper.ShowEnumField("Camera Type", cameraType, skin);
            switch (cameraType)
            {
            case CameraType.ByTag:
                cameraTag      = FieldInspectorHelper.ShowTextField("Camera Tag", cameraTag, skin);
                customMouseCam = null;
                break;

            case CameraType.ByName:
                cameraName     = FieldInspectorHelper.ShowTextField("Camera Name", cameraName, skin);
                customMouseCam = null;
                break;

            default:
                break;
            }
            FieldInspectorHelper.EndSection();
        }
        break;

        default:
            break;
        }
        switch (targetSource)
        {
            //case SpawnLocationMode.Random:
            //    break;
            //case SpawnLocationMode.LoopByTimeRatio:
            //    break;
            //case SpawnLocationMode.LoopByCount:
            //    {
            //        FieldInspectorHelper.ShowTitle("Loop By Count", skin, false);
            //        FieldInspectorHelper.StartSection();
            //        bUseSpawnTotalCount = FieldInspectorHelper.ShowBoolField("Spawn Count", bUseSpawnTotalCount, skin);
            //        if (!bUseSpawnTotalCount)
            //            unitPerLoop = FieldInspectorHelper.ShowIntField("Unit Per Loop", unitPerLoop, skin);
            //        FieldInspectorHelper.EndSection();
            //    }
            //    break;
            //case SpawnLocationMode.LoopByBrust:
            //    {

            //    }
            //    break;
            //default:
            //    break;
        }
    }