Example #1
0
        public void CalculateMinimumProximity_TreatStandardNonScriptureCharactersAsDistinct_ExtraBiblicalResultsInZeroProximityWithChapterNumber()
        {
            var project = TestProject.CreateTestProject(TestProject.TestBook.MRK);

            project.UseDefaultForUnresolvedMultipleChoiceCharacters();

            project.DramatizationPreferences.BookTitleAndChapterDramatization = ExtraBiblicalMaterialSpeakerOption.MaleActor;
            project.DramatizationPreferences.SectionHeadDramatization         = ExtraBiblicalMaterialSpeakerOption.ActorOfEitherGender;
            project.DramatizationPreferences.BookIntroductionsDramatization   = ExtraBiblicalMaterialSpeakerOption.FemaleActor;

            var proximity = new Proximity(project);

            var characterIds = new HashSet <string>
            {
                CharacterVerseData.GetStandardCharacterId("MRK", CharacterVerseData.StandardCharacter.BookOrChapter),
                CharacterVerseData.GetStandardCharacterId("MRK", CharacterVerseData.StandardCharacter.ExtraBiblical),
                CharacterVerseData.GetStandardCharacterId("MRK", CharacterVerseData.StandardCharacter.Intro)
            };


            MinimumProximity minProximity = proximity.CalculateMinimumProximity(characterIds);

            Assert.AreEqual(0, minProximity.NumberOfBlocks);
            Assert.AreEqual(CharacterVerseData.GetStandardCharacterId("MRK", CharacterVerseData.StandardCharacter.BookOrChapter), minProximity.FirstCharacterId);
            Assert.AreEqual(CharacterVerseData.GetStandardCharacterId("MRK", CharacterVerseData.StandardCharacter.ExtraBiblical), minProximity.SecondCharacterId);
            Assert.AreEqual("MRK 1:0", minProximity.FirstReference);
            Assert.AreEqual("MRK 1:0", minProximity.SecondReference);
        }
Example #2
0
    private void Awake()
    {
        proximitySensor = GetComponent<Proximity>();

        proximityRun = new Utility.IntervalRun(0.2f, (deltaTime) =>
        {
            proximitySensor.Detect(OnProximityDetect);
        });
        proximityRun.Start();
        isUsed = false;
        tracker = GetComponent<Tracker>();

        parentRoom = GetComponentInParent<Room>();
        if (parentRoom != null)
        {
            parentRoom.OnVisibilityChange += OnRoomChangeVisibility;
            if (parentRoom.IsPlayerInRoom)
            {
                enabled = true;
            }
            else
            {
                enabled = false;
            }
        }
    }
Example #3
0
        /// <inheritdoc />
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Mesh   mesh = null;
            double tol  = 0.0;

            if (!DA.GetData(0, ref mesh))
            {
                return;
            }
            if (!DA.GetData(1, ref tol))
            {
                return;
            }

            var verts  = mesh.Vertices;
            var points = verts.Select(p => (Vector3d)p).ToArray();

            Proximity.Consolidate(points, tol, 3);
            //Message = (points.Consolidate(tol)) ? "Converged" : "Not converged";

            for (int i = 0; i < verts.Count; i++)
            {
                verts[i] = (Point3f)points[i];
            }

            DA.SetData(0, new GH_Mesh(mesh));
        }
Example #4
0
        public void CalculateMinimumProximity_NonStrictAdherenceToNarratorPrefs_AllStandardCharactersAndBookAuthorResultsInMaxProximity()
        {
            var project = TestProject.CreateTestProject(TestProject.TestBook.JOS);             // Using Joshua because the test data for Joshua has into material

            project.UseDefaultForUnresolvedMultipleChoiceCharacters();

            project.CharacterGroupGenerationPreferences.NarratorsOption = NarratorsOption.SingleNarrator;
            // By making theses all different, we force the CharacterGroupGenerator (which we aren't calling here) to put each
            // type of standard character in a different group, but with "not strict" proximity, we still consider it legit to
            // manually put them in the same group.
            project.DramatizationPreferences.BookTitleAndChapterDramatization = ExtraBiblicalMaterialSpeakerOption.ActorOfEitherGender;
            project.DramatizationPreferences.BookIntroductionsDramatization   = ExtraBiblicalMaterialSpeakerOption.FemaleActor;
            project.DramatizationPreferences.SectionHeadDramatization         = ExtraBiblicalMaterialSpeakerOption.MaleActor;

            var proximity = new Proximity(project, false);

            var characterIds = new HashSet <string>
            {
                CharacterVerseData.GetStandardCharacterId("JOS", CharacterVerseData.StandardCharacter.Narrator),
                CharacterVerseData.GetStandardCharacterId("JOS", CharacterVerseData.StandardCharacter.ExtraBiblical),
                CharacterVerseData.GetStandardCharacterId("JOS", CharacterVerseData.StandardCharacter.Intro),
                CharacterVerseData.GetStandardCharacterId("JOS", CharacterVerseData.StandardCharacter.BookOrChapter),
            };

            MinimumProximity minProximity = proximity.CalculateMinimumProximity(characterIds);

            Assert.AreEqual(Int32.MaxValue, minProximity.NumberOfBlocks);
        }
Example #5
0
        string GetEnumString(Proximity prox)
        {
            string result = "";

            switch (prox)
            {
            case Proximity.Unknown:
                result = "Unknown";
                break;

            case Proximity.Far:
                result = "Far";
                break;

            case Proximity.Near:
                result = "Near";
                break;

            case Proximity.Immediate:
                result = "Immediate";
                break;

            case Proximity.All:
                result = "All";
                break;

            default:
                result = "Unknown";
                break;
            }
            return(result);
        }
        public void Process(ICollection<Ghost> ghosts, Player player)
        {
            double minDistance = Double.PositiveInfinity;
            foreach (Ghost g in ghosts)
            {
                minDistance = Math.Min(minDistance, g.DistanceToPlayer);
            }

            try
            {
                if (minDistance < (double) _proximity)
                {
                    if (minDistance < (double)Proximity.Close)
                    {
                        _proximity = Proximity.NextTo;
                        _vibrator.Start(new TimeSpan(0, 0, 0, 0, 1000));
                    }
                    else if (minDistance < (double)Proximity.Nearby)
                    {
                        _proximity = Proximity.Close;
                        _vibrator.Start(new TimeSpan(0, 0, 0, 0, 500));
                    }
                    else if (minDistance < (double)Proximity.Far)
                    {
                        _proximity = Proximity.Nearby;
                        _vibrator.Start(new TimeSpan(0, 0, 0, 0, 100));
                    }
                }
            }
            catch (ArgumentOutOfRangeException)
            {
                System.Diagnostics.Debug.WriteLine("Invalid vibration duration");
            }
        }
Example #7
0
        public void CalculateMinimumProximity_NarrationByAuthor_NonStrictAdherenceToNarratorPrefs_AllStandardCharactersAndBookAuthorResultsInMaxProximity()
        {
            var project = TestProject.CreateTestProject(TestProject.TestBook.GAL);

            project.UseDefaultForUnresolvedMultipleChoiceCharacters();
            var idPaul = BiblicalAuthors.GetAuthorOfBook("GAL").Name;

            foreach (var block in project.IncludedBooks[0].GetBlocksForVerse(2, 15))
            {
                block.CharacterId = idPaul;
            }

            project.CharacterGroupGenerationPreferences.NarratorsOption = NarratorsOption.NarrationByAuthor;
            // The following can be anything but omitted, but by making them all different, we prove that
            // non-strict adherence to the the narrator prefs is really happening.
            project.DramatizationPreferences.BookTitleAndChapterDramatization = ExtraBiblicalMaterialSpeakerOption.ActorOfEitherGender;
            project.DramatizationPreferences.BookIntroductionsDramatization   = ExtraBiblicalMaterialSpeakerOption.FemaleActor;
            project.DramatizationPreferences.SectionHeadDramatization         = ExtraBiblicalMaterialSpeakerOption.MaleActor;

            var proximity = new Proximity(project, false);

            var characterIds = new HashSet <string>
            {
                CharacterVerseData.GetStandardCharacterId("GAL", CharacterVerseData.StandardCharacter.Narrator),
                CharacterVerseData.GetStandardCharacterId("GAL", CharacterVerseData.StandardCharacter.ExtraBiblical),
                CharacterVerseData.GetStandardCharacterId("GAL", CharacterVerseData.StandardCharacter.Intro),                 // Not actually used in GAL test data
                CharacterVerseData.GetStandardCharacterId("GAL", CharacterVerseData.StandardCharacter.BookOrChapter),
                idPaul
            };

            MinimumProximity minProximity = proximity.CalculateMinimumProximity(characterIds);

            Assert.AreEqual(Int32.MaxValue, minProximity.NumberOfBlocks);
        }
 public HttpResponseMessage PutProximity(int id, [FromBody] Proximity proximity)
 {
     try {
         var entity = entities.Proximities.FirstOrDefault(x => x.AssetName == id);
         if (entity == null)
         {
             return(Request.CreateErrorResponse(HttpStatusCode.NotFound, id.ToString()));
         }
         else
         {
             entity.AssetName       = proximity.AssetName;
             entity.RailwayStation  = proximity.RailwayStation;
             entity.BusStation      = proximity.BusStation;
             entity.Airport         = proximity.Airport;
             entity.MetroStation    = proximity.MetroStation;
             entity.SchoolorCollege = proximity.SchoolorCollege;
             entity.Hospital        = proximity.Hospital;
             entity.Market          = proximity.Market;
             entity.Temple          = proximity.Temple;
             entity.Hotel           = proximity.Hotel;
             entities.SaveChanges();
             return(Request.CreateResponse(HttpStatusCode.OK, entity));
         }
     } catch (Exception ex) {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
     }
 }
        void SetProximity(IBeacon source, BeaconItem dest)
        {
            Proximity p = Proximity.Unknown;

            switch ((ProximityType)source.Proximity)
            {
            case ProximityType.Immediate:
                p = Proximity.Immediate;
                break;

            case ProximityType.Near:
                p = Proximity.Near;
                break;

            case ProximityType.Far:
                p = Proximity.Far;
                break;
            }

            if (p > dest.Proximity || p < dest.Proximity)
            {
                dest.ProximityChangeTimestamp = DateTime.Now;
            }

            dest.Proximity = p;
        }
Example #10
0
 public Beacon(Guid uuid, ushort major, ushort minor, Proximity proximity)
 {
     this.Uuid      = uuid;
     this.Major     = major;
     this.Minor     = minor;
     this.Proximity = proximity;
 }
Example #11
0
 public LAC(Set set, Proximity diss)
     : base(set, diss)
 {
     H             = 9;
     Name          = "Locally Adaptive Clustering";
     ProximityType = ProximityType.None;
 }
Example #12
0
 public Flexible_LanceAndWilliams(Set set, Proximity diss)
     : base(set, diss)
 {
     Beta          = 0.5;
     Name          = "Flexible (Lance and Williams) ";
     ProximityType = ProximityType.Dissimilarity;
 }
Example #13
0
 protected AbstractBeacon(string uuid, Proximity proximity, ushort major, ushort minor)
 {
     this.Uuid      = uuid;
     this.Proximity = proximity;
     this.Major     = major;
     this.Minor     = minor;
 }
Example #14
0
 public void Dispose()
 {
     if (Proximity != null)
     {
         Proximity.Dispose();
     }
 }
Example #15
0
 protected AbstractBeacon(string uuid, Proximity proximity, ushort major, ushort minor)
 {
     this.Uuid = uuid;
     this.Proximity = proximity;
     this.Major = major;
     this.Minor = minor;
 }
Example #16
0
	void Awake ()
	{
		// Setting up the references.
		anim = GetComponent<Animator>();
		proximity = GetComponent<Proximity> ();
		audioManager = GameObject.FindGameObjectWithTag ("Sound").GetComponent<AudioManager> ();
	}
Example #17
0
 void Start()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Example #18
0
        public void CalculateMinimumProximity_NarrationByAuthor_CharacterSpeakingInBookHeNarratesResultsInMaxProximity()
        {
            var project = TestProject.CreateTestProject(TestProject.TestBook.GAL);

            project.UseDefaultForUnresolvedMultipleChoiceCharacters();
            var idPaul = BiblicalAuthors.GetAuthorOfBook("GAL").Name;

            foreach (var block in project.IncludedBooks[0].GetBlocksForVerse(2, 15))
            {
                block.CharacterId = idPaul;
            }

            project.CharacterGroupGenerationPreferences.NarratorsOption       = NarratorsOption.NarrationByAuthor;
            project.DramatizationPreferences.BookTitleAndChapterDramatization = ExtraBiblicalMaterialSpeakerOption.Narrator;
            project.CharacterGroupGenerationPreferences.NumberOfMaleNarrators = 1;

            var proximity = new Proximity(project);

            var characterIds = new HashSet <string>
            {
                CharacterVerseData.GetStandardCharacterId("GAL", CharacterVerseData.StandardCharacter.Narrator),
                CharacterVerseData.GetStandardCharacterId("GAL", CharacterVerseData.StandardCharacter.BookOrChapter),
                idPaul
            };

            MinimumProximity minProximity = proximity.CalculateMinimumProximity(characterIds);

            Assert.AreEqual(Int32.MaxValue, minProximity.NumberOfBlocks);
        }
Example #19
0
 public Beacon(Guid uuid, ushort major, ushort minor, double accuracy, Proximity proximity)
 {
     this.Uuid      = uuid;
     this.Major     = major;
     this.Minor     = minor;
     this.Accuracy  = accuracy;
     this.Proximity = proximity;
 }
Example #20
0
 public ClusterAlgorithm(Set set, Proximity diss)
 {
     if (set == null || diss == null)
     {
         throw new ArgumentNullException("Parametro Incorrecto en el constructor de la clase ClusterAlgorithm");
     }
     this.Set       = set;
     this.Proximity = diss;
 }
        public bool MoveCharactersToGroup(IList <string> characterIds, CharacterGroup destGroup, bool warnUserAboutProximity = false)
        {
            CharacterGroup sourceGroup = GetSourceGroupForMove(characterIds, destGroup);

            if (sourceGroup == null)
            {
                return(false);
            }

            if (destGroup != null && warnUserAboutProximity && destGroup.CharacterIds.Count > 0)
            {
                var proximity = new Proximity(m_project.IncludedBooks, m_project.DramatizationPreferences);

                var testGroup       = new CharacterIdHashSet(destGroup.CharacterIds);
                var resultsBefore   = proximity.CalculateMinimumProximity(testGroup);
                int proximityBefore = resultsBefore.NumberOfBlocks;

                testGroup.AddRange(characterIds);
                var resultsAfter   = proximity.CalculateMinimumProximity(testGroup);
                int proximityAfter = resultsAfter.NumberOfBlocks;

                if (proximityBefore > proximityAfter && proximityAfter <= Proximity.kDefaultMinimumProximity)
                {
                    var firstReference  = resultsAfter.FirstReference;
                    var secondReference = resultsAfter.SecondReference;

                    var dlgMessageFormat1 = (firstReference == secondReference) ?
                                            LocalizationManager.GetString("DialogBoxes.VoiceActorAssignmentDlg.MoveCharacterDialog.Message.Part1",
                                                                          "This move will result in a group with a minimum proximity of {0} blocks between [{1}] and [{2}] in {3}.") :
                                            LocalizationManager.GetString("DialogBoxes.VoiceActorAssignmentDlg.MoveCharacterDialog.Message.Part1",
                                                                          "This move will result in a group with a minimum proximity of {0} blocks between [{1}] in {3} and [{2}] in {4}.");
                    dlgMessageFormat1 = string.Format(dlgMessageFormat1,
                                                      resultsAfter.NumberOfBlocks,
                                                      CharacterVerseData.GetCharacterNameForUi(resultsAfter.FirstCharacterId),
                                                      CharacterVerseData.GetCharacterNameForUi(resultsAfter.SecondCharacterId),
                                                      firstReference, secondReference);
                    var dlgMessageFormat2 =
                        LocalizationManager.GetString("DialogBoxes.VoiceActorAssignmentDlg.MoveCharacterDialog.Message.Part2",
                                                      "Do you want to continue with this move?");

                    var dlgMessage = string.Format(dlgMessageFormat1 + Environment.NewLine + Environment.NewLine + dlgMessageFormat2);
                    var dlgTitle   = LocalizationManager.GetString("DialogBoxes.VoiceActorAssignmentDlg.MoveCharacterDialog.Title",
                                                                   "Confirm");

                    if (MessageBox.Show(dlgMessage, dlgTitle, MessageBoxButtons.YesNo) != DialogResult.Yes)
                    {
                        return(false);
                    }
                }
            }

            m_undoStack.Push(new MoveCharactersToGroupUndoAction(m_project, sourceGroup, destGroup, characterIds));

            Save();

            return(true);
        }
        // Get Relation With Becon ID

        public Relation GetRelationWithBeaconId(Guid beaconId, string proximity)
        {
            Proximity prox        = (Proximity)Enum.Parse(typeof(Proximity), proximity, true);
            var       GetRelation = Table.Where(p => p.Beacon.Id == beaconId && p.Proximity == prox)
                                    .Include(p => p.Content)
                                    .Include(p => p.Artifact)
                                    .FirstOrDefault();

            return(GetRelation);
        }
Example #23
0
        private static IntPtr CreateHandle(TrafficType traffic, bool isMultiPoint, Proximity proximity, Transport transports)
        {
            var handle = alljoyn_sessionopts_create((byte)traffic, isMultiPoint.ToQccBool(), (byte)proximity, (ushort)transports);

            if (handle == IntPtr.Zero)
            {
                throw new InvalidOperationException("Could not create session options");
            }
            return(handle);
        }
 public HttpResponseMessage PostProximity(Proximity proximity)
 {
     try {
         entities.Proximities.Add(proximity);
         entities.SaveChanges();
         var message = Request.CreateResponse(HttpStatusCode.Created, proximity);
         return(message);
     }catch (Exception ex) {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
     }
 }
    /// <summary>
    /// Method called by Android via UnitySendMessage
    /// </summary>
    /// <param name="nearMessage">Contains "near" if the proximity is near </param>
    void OnSensorChanged(string nearMessage)
    {
        //if the message is "near" then set near proximity
        Proximity newProximity = (nearMessage == "true" ? Proximity.NEAR : Proximity.FAR);

        if (newProximity != proximity)
        {
            proximity = newProximity;
            OnProximityChange(proximity);
        }
    }
 /// <summary>
 /// Raises the proximity change event.
 /// </summary>
 /// <param name="newProximity">New proximity.</param>
 private void OnProximityChange(Proximity newProximity)
 {
     if (onProximityChange != null)
     {
         onProximityChange(newProximity);
     }
     if (messageReceiver != null)
     {
         messageReceiver.SendMessage("OnProximityChange", newProximity, SendMessageOptions.DontRequireReceiver);
     }
 }
Example #27
0
        public List <Proximity> GetProximities()
        {
            List <Proximity> result = new List <Proximity>();

            foreach (var item in dissimilarities)
            {
                Proximity id = (Proximity)assembly.CreateInstance(item.FullName);
                result.Add(id);
            }
            return(result);
        }
        /// <summary>
        /// Este metodo esta engachado al evento que lanza el AttributesVisualizer, cuando se chequea o se deschequea algun atributo
        /// para que este mismo control se actualice sobre las Disimilitud que debe mostrar, que coincida su tipo con la de los atributos chequeados
        /// </summary>
        public void CheckAttributes(object sender, CheckAttributeEnventArgs e)
        {
            try
            {
                List <Proximity> _dissTemp = LoadProximities();

                ElementType _elementType = Proximity.GetAttributesType(e.SelectedAttributes);

                List <Proximity> _source = new List <Proximity>();

                //en el caso que le ponga de ItemsSource (al listView de atributes en el control AttributesVisualizer) NULL, entonces e.SelectedAttributes esta vacio
                //por tanto en el metodo Proximity.GetAttributesType va retornar Numeric, porque como la lista esta vacia no hay ninguno que no sea numeric, y eso
                //esta mal, verificar el metodo Proximity.GetAttributesType para ver lo que acabo de decir, cuando la lista que le paso esta vacia
                if (e.SelectedAttributes.Count > 0)
                {
                    foreach (Proximity _prox in _dissTemp)
                    {
                        if (_prox.AdmissibleElementType == ElementType.Mixt || _prox.AdmissibleElementType == _elementType)
                        {
                            _source.Add(_prox);
                        }
                    }
                }

                //Esto es lo que se utiliza en UpdateProximities, ya que ahora ademas de cumplir las restricciones de los attributes,
                //tambien hay que verificar que el algoritmo que se seleccione pueda trabajar con esa proximidad
                CurrentProximities = _source;

                this.cb_Proximities.ItemsSource       = null;
                this.cb_Proximities.ItemsSource       = _source;
                this.cb_Proximities.DisplayMemberPath = "Name";
                if (_source.Count > 0)
                {
                    this.cb_Proximities.SelectedIndex = 0;
                }
                else
                {
                    Enviroment.Proximity = null;
                }

                //Esto es porque si se me queda seleccionado el algoritmo Metis, cuando se actualizan las proximidades
                //(si se selecciona o deseleccion un attribute)
                //se me quedan para el algoritmo Metis todas las que se puedan cargar, esto es porque no se selecciono un algoritmo,
                //entonces para que se actualicen debo seleccionar otro algoritmo.
                //this.tv_ClusterAlgs.ItemsSource = null;
                //this.tv_ClusterAlgs.ItemsSource = new ListClusterTree();
                this.tv_ClusterAlgs_SelectedItemChanged(null, null);
            }
            catch (Exception _ex)
            {
                GeneralTools.Tools.WriteToLog(_ex);
            }
        }
        private async void OnRanging(object sender, BeaconManager.RangingEventArgs e)
        {
            Log.Debug("demo", "IN Ranging " + e.Beacons.Count);
            if (e.Beacons.Count > 0)
            {
                Log.Debug("demo", "List > 0");

                foreach (Beacon beacon in e.Beacons)
                {
                    _proximity = ComputeProximity(beacon);

                    if (_proximity != Proximity.Unknown)
                    {
                        _distance = ComputeAccuracy(beacon);

                        //If distance is valid and (less than current distance or current beacon is null) update current beacon
                        if (_distance > -1 && ((_distance < _currentBeaconDistance) || _currentBeacon == null))
                        {
                            _currentBeaconDistance = _distance;

                            _currentBeacon = beacon;

                            switch (beacon.Major)
                            {
                            case 1564:
                                _lastActiveTimeRegion1 = DateTime.Now.Ticks;
                                break;

                            case 15212:
                                _lastActiveTimeRegion2 = DateTime.Now.Ticks;
                                break;

                            case 26535:
                                _lastActiveTimeRegion3 = DateTime.Now.Ticks;
                                break;
                            }
                        }
                        //If distance is valid and beacon major is same as current beacon's major, update current beacon distance
                        if (_distance > -1 && (beacon.Major == _currentBeacon.Major))
                        {
                            _currentBeaconDistance = _distance;
                            Log.Debug(Constants.TAG, "updating current beacon");

                            if (!isUnlockInProgress)
                            {
                                await UnLockMessagesAsync(_currentBeacon.Major).ConfigureAwait(false);
                            }
                        }
                    }
                }
            }
        }
    /// <summary>
    /// Fetchs the proximity from android
    /// </summary>
    void FetchProximity()
    {
#if UNITY_ANDROID && !UNITY_EDITOR
        if (paProximity != null)
        {
            Proximity prox = paProximity.Call <bool>("getProximity") ? Proximity.NEAR : Proximity.FAR;
            if (prox != proximity)
            {
                proximity = prox;
                OnProximityChange(proximity);
            }
        }
#endif
    }
        public VoiceActorAssignmentViewModel(Project project)
        {
            m_project        = project;
            ProjectProximity = new Proximity(m_project, false);

            CharacterGroupAttribute <CharacterGender> .GetUiStringForValue = GetUiStringForCharacterGender;
            CharacterGroupAttribute <CharacterAge> .GetUiStringForValue    = GetUiStringForCharacterAge;

            LogAndOutputToDebugConsole("Group".PadRight(7) + ": " + MinimumProximity.ReportHeader + Environment.NewLine +
                                       "-".PadRight(100, '-'));
            foreach (var group in CharacterGroups.OrderBy(g => g.GroupIdForUiDisplay))
            {
                LogAndOutputToDebugConsole(group.GroupIdForUiDisplay.PadRight(7) + ": " + ProjectProximity.CalculateMinimumProximity(group.CharacterIds));
            }
        }
        public VoiceActorAssignmentViewModel(Project project)
        {
            m_project = project;

            CharacterGroupAttribute <CharacterGender> .GetUiStringForValue = GetUiStringForCharacterGender;
            CharacterGroupAttribute <CharacterAge> .GetUiStringForValue    = GetUiStringForCharacterAge;

#if DEBUG
            var p = new Proximity(m_project.IncludedBooks, m_project.DramatizationPreferences);
            foreach (var group in CharacterGroups.OrderBy(g => g.GroupIdForUiDisplay))
            {
                Debug.WriteLine(group.GroupIdForUiDisplay + ": " + p.CalculateMinimumProximity(group.CharacterIds));
            }
#endif
        }
Example #33
0
        //Dado un elemento y una lista de clusters devuelve la posicion del cluster mas similar
        private int ClusterProcessedElement(Element e, List <Cluster> l)
        {
            //Esto es asi ya que estamos tratando con dissimilitud, es decir mientras mas pequeno mas cerca estan
            double minDist     = double.MaxValue;
            int    bestCluster = 0;

            for (int i = 0; i < ClustersCount; i++)
            {
                double dist = Proximity.CalculateProximity(e, l[i].Centroid);
                if (dist < minDist)
                {
                    minDist     = dist;
                    bestCluster = i;
                }
            }
            return(bestCluster);
        }
Example #34
0
        public VoiceActorAssignmentViewModel(Project project, Dictionary <string, int> keyStrokesByCharacterId = null)
        {
            m_project = project;

            m_keyStrokesByCharacterId = keyStrokesByCharacterId ?? m_project.GetKeyStrokesByCharacterId();

            CharacterGroupAttribute <CharacterGender> .GetUiStringForValue = GetUiStringForCharacterGender;
            CharacterGroupAttribute <CharacterAge> .GetUiStringForValue    = GetUiStringForCharacterAge;
            m_project.CharacterGroupList.PopulateEstimatedHours(m_keyStrokesByCharacterId);

#if DEBUG
            var p = new Proximity(m_project);
            foreach (var group in CharacterGroups.OrderBy(g => g.GroupNumber))
            {
                Debug.WriteLine(group.GroupNumber + ": " + p.CalculateMinimumProximity(group.CharacterIds));
            }
#endif
        }
Example #35
0
        private void btnAccept_Click(object sender, EventArgs e)
        {
            if (txtName.Text != string.Empty)
            {
                _datastore.ID = txtName.Text;
                _datastore.Proximities.Clear();
                Proximity p1 = new Proximity();
                p1.Range = nndRange_1.Value;
                p1.Effects.Add(new Effect(nudIntensity_1_1.Value, nudProbability_1_1.Value));
                p1.Effects.Add(new Effect(nudIntensity_1_2.Value, nudProbability_1_2.Value));
                _datastore.Add(p1);
                Proximity p2 = new Proximity();
                p2.Range = nndRange_2.Value;
                p2.Effects.Add(new Effect(nudIntensity_2_1.Value, nudProbability_2_1.Value));
                p2.Effects.Add(new Effect(nudIntensity_2_2.Value, nudProbability_2_2.Value));
                _datastore.Add(p2);

   
                Notify((object)_datastore);
            }

        }
Example #36
0
    private void Awake()
    {
        meshRenderer = GetComponentInChildren<MeshRenderer>();
        redLight = GetComponentInChildren<Light>();
        rBody = GetComponent<Rigidbody>();
        myCollider = GetComponentInChildren<Collider>();

        proximitySensor = GetComponent<Proximity>();

        proximityRun = new Utility.IntervalRun(0.2f, (deltaTime) =>
        {
            proximitySensor.Detect(OnProximityDetect);
        });

        Stop();

        timeStyle = new GUIStyle
        {
            alignment = TextAnchor.MiddleCenter,
            normal = { textColor = Color.yellow }
        };
    }
Example #37
0
    private void Awake()
    {
        proximitySensor = GetComponent<Proximity>();
        audioSource = GetComponent<AudioSource>();
        proximityRun = new Utility.IntervalRun(0.2f, (deltaTime) =>
        {
            proximitySensor.Detect(OnProximityDetect);
        });
        proximityRun.Start();
        State = DoorState.Closed;
        lastState = State;

        // Left Door
        openPosition = new Vector3(-MoveDistance, 0f, 0f);
        closedPosition = new Vector3(0f, 0f, 0f);

        foreach (var room in PositiveDisableObjects)
        {
            room.Doors.Add(this);
        }
        foreach (var room in NegativeDisableObjects)
        {
            room.Doors.Add(this);
        }

        HideShowDoor();
        Initialize();
    }
    /// <summary>
    /// Runs the code example.
    /// </summary>
    /// <param name="user">The AdWords user.</param>
    /// <param name="businessId">The AdWords Express business id.</param>
    public void Run(AdWordsUser user, long businessId) {
      // Get the ExpressBusinessService.
      ExpressBusinessService businessService = (ExpressBusinessService)
          user.GetService(AdWordsService.v201509.ExpressBusinessService);

      // Get the PromotionService
      PromotionService promotionService = (PromotionService)
          user.GetService(AdWordsService.v201509.PromotionService);

      // Get the business for the businessId. We will need its geo point to
      // create a Proximity criterion for the new Promotion.
      Selector businessSelector = new Selector() {
        fields = new string[] {
          ExpressBusiness.Fields.Id, ExpressBusiness.Fields.GeoPoint
        },
        predicates = new Predicate[] {
          Predicate.Equals(ExpressBusiness.Fields.Id, businessId.ToString())
        }
      };

      ExpressBusinessPage businessPage = businessService.get(businessSelector);

      if (businessPage == null || businessPage.entries == null ||
          businessPage.entries.Length == 0) {
        Console.WriteLine("No business was found.");
        return;
      }

      // Set the business ID to the service.
      promotionService.RequestHeader.expressBusinessId = businessId;

      // First promotion
      Promotion marsTourPromotion = new Promotion();
      Money budget = new Money();
      budget.microAmount = 1000000L;
      marsTourPromotion.name = "Mars Tour Promotion " + ExampleUtilities.GetShortRandomString();
      marsTourPromotion.status = PromotionStatus.PAUSED;
      marsTourPromotion.destinationUrl = "http://www.example.com";
      marsTourPromotion.budget = budget;
      marsTourPromotion.callTrackingEnabled = true;

      // Criteria

      // Criterion - Travel Agency product service
      ProductService productService = new ProductService();
      productService.text = "Travel Agency";

      // Criterion - English language
      // The ID can be found in the documentation:
      // https://developers.google.com/adwords/api/docs/appendix/languagecodes
      Language language = new Language();
      language.id = 1000L;

      // Criterion - Within 15 miles
      Proximity proximity = new Proximity();
      proximity.geoPoint = businessPage.entries[0].geoPoint;
      proximity.radiusDistanceUnits = ProximityDistanceUnits.MILES;
      proximity.radiusInUnits = 15;

      marsTourPromotion.criteria = new Criterion[] { productService, language, proximity };

      // Creative
      Creative creative = new Creative();
      creative.headline = "Standard Mars Trip";
      creative.line1 = "Fly coach to Mars";
      creative.line2 = "Free in-flight pretzels";

      marsTourPromotion.creatives = new Creative[] { creative };

      PromotionOperation operation = new PromotionOperation();
      operation.@operator = Operator.ADD;
      operation.operand = marsTourPromotion;

      try {
        Promotion[] addedPromotions = promotionService.mutate(
            new PromotionOperation[] { operation });

        Console.WriteLine("Added promotion ID {0} with name {1} to business ID {2}.",
        addedPromotions[0].id, addedPromotions[0].name, businessId);
      } catch (Exception e) {
        throw new System.ApplicationException("Failed to add promotions.", e);
      }
    }
 public ProximitySensor()
 {
     _vibrator = VibrateController.Default;
     _proximity = Proximity.Infinity;
 }
 public ProximityTestResult(Proximity proximity)
 {
     Proximity = proximity;
     DistanceToClosestObject = double.NaN;
 }