public override int GetHashCode()
        {
            int hashCode = 671208328;

            hashCode = hashCode * -1521134295 + Id.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <TouristicSpot> .Default.GetHashCode(Spot);

            hashCode = hashCode * -1521134295 + SpotId.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(_name);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Name);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(_address);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Address);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(_contactNumber);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(ContactNumber);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(_information);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Information);

            hashCode = hashCode * -1521134295 + _pricePerNight.GetHashCode();
            hashCode = hashCode * -1521134295 + PricePerNight.GetHashCode();
            hashCode = hashCode * -1521134295 + Full.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <List <Booking> > .Default.GetHashCode(Bookings);

            hashCode = hashCode * -1521134295 + EqualityComparer <List <AccommodationImage> > .Default.GetHashCode(Images);

            return(hashCode);
        }
示例#2
0
        private void NewGroupResolvingEnded(SpotId spotId, List <DesignBodySpotModification> spotDatas, GroupWaitingToBePlanted info,
                                            GrassGroupId groupId)
        {
            MyProfiler.BeginSample("GrassGroupsPlanter. NewGroupResolvingEnded");
            var template = _templatesDictionary[info.Type];

            var unplantedInstances = _grassDetailInstancer.Initialize(spotDatas.Count, template);

            var outAspectsList = new List <Grass2Aspect>(spotDatas.Count);

            for (int i = 0; i < spotDatas.Count; i++)
            {
                var unplantedInstance = unplantedInstances[i];
                var flatPosition      = _repositioner.Move(info.FlatPositions[i]);
                var aspects           = _aspectsGenerator.GenerateAspect(unplantedInstance, flatPosition);
                outAspectsList.Add(aspects);
            }

            _groupsAspectInfos[groupId] = outAspectsList;
            _groupsContainer.AddGroup(
                Enumerable.Range(0, outAspectsList.Count)
                .SelectMany(i => PositionEntitiesFromAspect(outAspectsList[i], spotDatas[i])).ToList(),
                groupId);
            MyProfiler.EndSample();
        }
示例#3
0
        public string NameSpotId()
        {
            string result = "";

            result = SpotName + "-Surf-Report" + "-" + SpotId.ToString();
            return(result);
        }
示例#4
0
        public void GrassGroupSpotChanged(SpotId spotId, List <DesignBodySpotModification> spotDatas)
        {
            MyProfiler.BeginSample("GrassGroupsPlanter. GrassGroupSpotChanged");
            var groupId = _spotIdToGrassGroupId.Get(spotId);

            if (!_groupsAspectInfos.ContainsKey(groupId))
            {
                var info = _groupsWaitingToBePlanted[spotId];
                _groupsWaitingToBePlanted.Remove(spotId);
                NewGroupResolvingEnded(spotId, spotDatas, info, groupId);
            }
            else
            {
                GroupMovingEnded(spotDatas, groupId);
            }
            MyProfiler.EndSample();
        }
        public Task RegisterDesignBodiesGroupAsync(SpotId id, List <Vector2> bodiesPositions)
        {
            if (!bodiesPositions.Any())
            {
                _spotIdToGroupElevationIdDict = new Dictionary <SpotId, List <EPropElevationPointer> >();
                return(TaskUtils.EmptyCompleted());
            }
            var repositionedBodiesPositions = bodiesPositions.Select(c => _repositioner.Move(c)).ToList();
            var mins = new Vector2(repositionedBodiesPositions.Select(c => c.x).Min(), repositionedBodiesPositions.Select(c => c.y).Min());
            var maxs = new Vector2(repositionedBodiesPositions.Select(c => c.x).Max(), repositionedBodiesPositions.Select(c => c.y).Max());

            var minimalAlignmentLength = 32f;
            var minimumQuantIndex      = new IntVector2(Mathf.FloorToInt(mins.x / minimalAlignmentLength), Mathf.FloorToInt(mins.y / minimalAlignmentLength));
            var maximumQuantIndex      = new IntVector2(Mathf.FloorToInt(maxs.x / minimalAlignmentLength), Mathf.FloorToInt(maxs.y / minimalAlignmentLength));

            var perAlignmentBuckets = new Dictionary <IntVector2, List <Vector2> >();

            foreach (var aPosition in repositionedBodiesPositions)
            {
                var alignedBucketPosition = new IntVector2(Mathf.FloorToInt(aPosition.x / minimalAlignmentLength), Mathf.FloorToInt(aPosition.y / minimalAlignmentLength));
                if (!perAlignmentBuckets.ContainsKey(alignedBucketPosition))
                {
                    perAlignmentBuckets[alignedBucketPosition] = new List <Vector2>();
                }
                perAlignmentBuckets[alignedBucketPosition].Add(aPosition);
            }

            var pointers = perAlignmentBuckets.Values.Where(c => c.Any()).SelectMany(c => _elevationManager.RegisterPropsGroup(c)).ToList();

            _spotIdToGroupElevationIdDict[id] = pointers;
            _changesListener.SpotGroupsWereChanged(new Dictionary <SpotId, List <DesignBodySpotModification> >()
            {
                [id] = pointers.Select(c => new DesignBodySpotModification()
                {
                    Uniforms = CreatePackWithPointerUniform(c)
                }).ToList()
            });
            return(TaskUtils.EmptyCompleted());
        }
示例#6
0
        WriteXML(XmlWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }

            writer.WriteStartElement(
                XpsS0Markup.SignatureDefinition,
                XpsS0Markup.SignatureDefinitionNamespace
                );

            //Spot ID, Signer Name and xml:lang are attributes of SignatureDefinition
            //Spot ID is required.  If it is not specified, then we throw.
            if (SpotId != null)
            {
                writer.WriteAttributeString(XpsS0Markup.SpotId, XmlConvert.EncodeName(SpotId.ToString()));
            }
            else
            {
                throw new XpsPackagingException(SR.Get(SRID.ReachPackaging_SpotIDRequiredAttribute));
            }

            if (RequestedSigner != null)
            {
                writer.WriteAttributeString(XpsS0Markup.RequestedSigner, RequestedSigner);
            }

            if (Culture != null)
            {
                XmlLanguage language = XmlLanguage.GetLanguage(Culture.Name);
                writer.WriteAttributeString(XpsS0Markup.XmlLang, language.ToString());
            }

            //SpotLocation, Intent, Signby, and Signing Location are elements of SignatureDefinition
            if (SpotLocation != null)
            {
                writer.WriteStartElement(XpsS0Markup.SpotLocation);

                Uri    pageUri         = new Uri(SpotLocation.PageUri.GetComponents(UriComponents.SerializationInfoString, UriFormat.SafeUnescaped), UriKind.RelativeOrAbsolute);
                string pageUriAsString = pageUri.GetComponents(UriComponents.SerializationInfoString, UriFormat.UriEscaped);

                writer.WriteAttributeString(XpsS0Markup.PageUri, pageUriAsString);
                writer.WriteAttributeString(XpsS0Markup.StartX, SpotLocation.StartX.ToString(System.Globalization.CultureInfo.InvariantCulture));
                writer.WriteAttributeString(XpsS0Markup.StartY, SpotLocation.StartY.ToString(System.Globalization.CultureInfo.InvariantCulture));
                writer.WriteEndElement();
            }

            if (Intent != null)
            {
                writer.WriteStartElement(XpsS0Markup.Intent);
                writer.WriteString(Intent);
                writer.WriteEndElement();
            }

            if (SignBy != null)
            {
                writer.WriteStartElement(XpsS0Markup.SignBy);
                writer.WriteString(((DateTime)SignBy).ToUniversalTime().ToString("s", DateTimeFormatInfo.InvariantInfo) + "Z");
                writer.WriteEndElement();
            }

            if (SigningLocale != null)
            {
                writer.WriteStartElement(XpsS0Markup.SigningLocale);
                writer.WriteString(SigningLocale);
                writer.WriteEndElement();
            }

            //
            //Signature Definition
            //
            writer.WriteEndElement();
            _hasBeenModified = false;
        }