コード例 #1
0
        //---------------Interest Data Server function----------------

        public IEnumerable <Interest> getAllint()
        {
            InterestList interestList = InterestList.getInstance();

            return(interestList);
        }
コード例 #2
0
ファイル: ViewerControl.cs プロジェクト: gabilic/Oplan
        private void PaintGraphics(PaintSpecification e, LatLonZoom llz)
        {
            this.tilesRequired  = 0;
            this.tilesAvailable = 0;
            this.asyncRequestGeneration++;
            if (this.baseLayer == null)
            {
                return;
            }
            InterestList interestList = this.activeTiles;

            this.activeTiles = new InterestList();
            e.ResetClip();
            e.Graphics.FillRectangle(new SolidBrush(Color.LightPink), new Rectangle(new Point(0, 0), e.Size));
            List <ViewerControl.PaintKit> list = new List <ViewerControl.PaintKit>();

            list.AddRange(this.AssembleLayer(e, llz, this.baseLayer, 0));
            int num = 1;

            foreach (IDisplayableSource current in this.alphaLayers)
            {
                list.AddRange(this.AssembleLayer(e, llz, current, num));
                num++;
            }
            this.activeTiles.Activate();
            this.PaintKits(e.Graphics, list);
            e.ResetClip();
            if (this.userRegionViewController != null)
            {
                e.ResetClip();
                this.userRegionViewController.Paint(e, llz, base.Size);
            }
            if (MapDrawingOption.IsEnabled(this.ShowCrosshairs))
            {
                Pen   pen   = new Pen(Color.Yellow);
                Pen[] array = new Pen[]
                {
                    pen,
                    new Pen(Color.Black)
                    {
                        DashStyle = DashStyle.Dash
                    }
                };
                for (int i = 0; i < array.Length; i++)
                {
                    Pen pen2 = array[i];
                    e.Graphics.DrawLine(pen2, 0, base.Size.Height / 2, base.Size.Width, base.Size.Height / 2);
                    e.Graphics.DrawLine(pen2, base.Size.Width / 2, 0, base.Size.Width / 2, base.Size.Height);
                }
            }
            if (MapDrawingOption.IsEnabled(this.ShowPushPins) && this.pinList != null)
            {
                List <PositionAssociationView> list2 = new List <PositionAssociationView>();
                list2.AddRange(this.pinList);
                list2.Sort(delegate(PositionAssociationView p0, PositionAssociationView p1)
                {
                    double num2 = p1.position.pinPosition.lat - p0.position.pinPosition.lat;
                    if (num2 != 0.0)
                    {
                        if (num2 <= 0.0)
                        {
                            return(-1);
                        }
                        return(1);
                    }
                    else
                    {
                        double num3 = p1.position.pinPosition.lon - p0.position.pinPosition.lon;
                        if (num3 == 0.0)
                        {
                            return(0);
                        }
                        if (num3 <= 0.0)
                        {
                            return(-1);
                        }
                        return(1);
                    }
                });
                foreach (PositionAssociationView current2 in list2)
                {
                    this.DrawMarker(current2, e);
                }
            }
            if (interestList != null)
            {
                interestList.Dispose();
            }
            if (this.tilesRequired == 0 || this.tilesAvailable == this.tilesRequired)
            {
                this.displayProgressBar.Visible = false;
                return;
            }
            this.displayProgressBar.Visible = true;
            this.displayProgressBar.Minimum = 0;
            this.displayProgressBar.Maximum = this.tilesRequired;
            this.displayProgressBar.Value   = this.tilesAvailable;
        }
コード例 #3
0
        /// <summary>
        /// Gets the people install data.
        /// </summary>
        /// <returns>
        /// Collection of persons for install data.
        /// </returns>
        public static IEnumerable <Person> GetDefaultPeople()
        {
            //// FYI - this is a hack for the demo
            var codeBase  = typeof(SeedDataHelper).Assembly.CodeBase;
            var uri       = new Uri(codeBase);
            var path      = uri.LocalPath;
            var pathToBin = Path.GetDirectoryName(path);

            // find the \\src
            var basePath = pathToBin.Substring(0, pathToBin.IndexOf("\\src", StringComparison.Ordinal));

            var file = $"{basePath}\\data\\seed-demo-data.json";

            var json = string.Empty;

            if (File.Exists(file))
            {
                json = File.ReadAllText(file);
            }

            if (json.IsNullOrWhiteSpace())
            {
                return(Enumerable.Empty <Person>());
            }

            var jobj   = JsonConvert.DeserializeObject <JObject>(json);
            var values = jobj.SelectToken("data").Children().ToList();

            var imports = new List <Person>();

            foreach (var p in values.OrderBy(x => Guid.NewGuid()))
            {
                var props = p.Values <string>().ToArray();

                var now    = DateTime.UtcNow;
                var person = new Person
                {
                    FirstName  = props[0],
                    LastName   = props[1],
                    Birthday   = DateTime.Parse(props[2]),
                    Slug       = $"{props[0]}-{props[1]}".ToLowerInvariant(),
                    UpdateDate = now,
                    CreateDate = now
                };

                var address = new Address
                {
                    Name        = "Default Address",
                    Address1    = props[3],
                    Locality    = props[4],
                    Region      = props[5],
                    PostalCode  = props[6],
                    CountryCode = props[7],
                    UpdateDate  = now,
                    CreateDate  = now
                };
                person.Addresses.Add(address);

                imports.Add(person);
            }

            // me
            var me = new Person {
                FirstName = "Rusty", LastName = "Swayne", Birthday = DateTime.Parse("8/6/1971"), Slug = "rusty-swayne", Watch = true, CreateDate = DateTime.UtcNow, UpdateDate = DateTime.UtcNow.AddSeconds(25)
            };
            var adr = new Address {
                Name = "Space Needle", Address1 = "400 Broad St", Locality = "Seattle", Region = "WA", PostalCode = "98109", CountryCode = "US", CreateDate = DateTime.UtcNow, UpdateDate = DateTime.UtcNow
            };

            me.Addresses.Add(adr);

            var interestValue = new InterestList
            {
                // "Family", "Travel", "Movies", "Skiing", "SCUBA Diving", "Food"
                Values = new List <Interest>
                {
                    new Interest {
                        Title = "Family", Url = string.Empty
                    },
                    new Interest {
                        Title = "Skiing", Url = "https://www.mtbaker.us/"
                    },
                    new Interest {
                        Title = "Travel", Url = string.Empty
                    },
                    new Interest {
                        Title = "SCUBA Diving", Url = string.Empty
                    },
                    new Interest {
                        Title = "Cooking", Url = string.Empty
                    }
                }
            };

            // PROPERTIES (concept)

            var interest = new ExtendedProperty
            {
                ConverterAlias = Constants.ExtendedProperties.InterestListConverterAlias,
                UpdateDate     = DateTime.UtcNow,
                CreateDate     = DateTime.UtcNow
            };

            interest.Converter().SetValue(interestValue);


            var socialValue = new SocialLinks
            {
                Facebook = "https://www.facebook.com/rustyswayne",
                Twitter  = "https://twitter.com/rustyswayne",
                LinkedIn = "https://www.linkedin.com/in/rustyswayne/"
            };

            var social = new ExtendedProperty
            {
                ConverterAlias = Constants.ExtendedProperties.SocialLinksConverterAlias,
                UpdateDate     = DateTime.UtcNow,
                CreateDate     = DateTime.UtcNow
            };

            social.Converter().SetValue(socialValue);



            //// TODO remove hard coded ref to .Web proj
            var photoVal = new Photo {
                Src = "/media/placeholders/rss.jpg"
            };

            var photo = new ExtendedProperty
            {
                ConverterAlias = Constants.ExtendedProperties.PhotoConverterAlias,
                UpdateDate     = DateTime.UtcNow,
                CreateDate     = DateTime.UtcNow
            };

            photo.Converter().SetValue(photoVal);


            me.Properties.Add(interest);
            me.Properties.Add(social);
            me.Properties.Add(photo);

            imports.Add(me);

            return(imports);
        }
コード例 #4
0
ファイル: WSAgent.cs プロジェクト: osgrid/openmetaverse
        /// <summary>
        /// Default constructor
        /// </summary>
        public WSAgent(WebSockets server, TokenBucket parentThrottle, ThrottleRates rates,
            UUID agentID, UUID sessionID, Socket socket, bool isChildAgent)
        {
            m_id = agentID;
            m_server = server;
            m_interestList = new InterestList(this, 200);

            IsChildPresence = isChildAgent;

            m_localID = m_server.Scene.CreateLocalID();

            //TextureEntry = new Primitive.TextureEntry(DEFAULT_AVATAR_TEXTURE);

            SessionID = sessionID;
            Socket = socket;

            // Create a token bucket throttle for this client that has the scene token bucket as a parent
            m_throttle = new TokenBucket(parentThrottle, rates.ClientTotalLimit, rates.ClientTotal);
            // Create an array of token buckets for this clients different throttle categories
            m_throttleCategories = new TokenBucket[THROTTLE_CATEGORY_COUNT];

            for (int i = 0; i < THROTTLE_CATEGORY_COUNT; i++)
            {
                ThrottleCategory type = (ThrottleCategory)i;

                // Initialize the message outboxes, where messages sit while they are waiting for tokens
                m_messageOutboxes[i] = new LocklessQueue<OutgoingMessage>();
                // Initialize the token buckets that control the throttling for each category
                m_throttleCategories[i] = new TokenBucket(m_throttle, rates.GetLimit(type), rates.GetRate(type));
            }

            // Initialize this to a sane value to prevent early disconnects
            TickLastMessageReceived = Environment.TickCount & Int32.MaxValue;
        }
コード例 #5
0
ファイル: LLAgent.cs プロジェクト: thoys/simian
        /// <summary>
        /// Default constructor
        /// </summary>
        /// <param name="server">Reference to the UDP server this client is connected to</param>
        /// <param name="rates">Default throttling rates and maximum throttle limits</param>
        /// <param name="parentThrottle">Parent HTB (hierarchical token bucket)
        /// that the child throttles will be governed by</param>
        /// <param name="circuitCode">Circuit code for this connection</param>
        /// <param name="agentID">AgentID for the connected agent</param>
        /// <param name="sessionID">SessionID for the connected agent</param>
        /// <param name="secureSessionID">SecureSessionID for the connected agent</param>
        /// <param name="defaultRTO">Default retransmission timeout, in milliseconds</param>
        /// <param name="maxRTO">Maximum retransmission timeout, in milliseconds</param>
        /// <param name="remoteEndPoint">Remote endpoint for this connection</param>
        /// <param name="isChildAgent">True if this agent is currently simulated by
        /// another simulator, otherwise false</param>
        public LLAgent(LLUDPServer server, ThrottleRates rates, TokenBucket parentThrottle,
            uint circuitCode, UUID agentID, UUID sessionID, UUID secureSessionID, IPEndPoint remoteEndPoint,
            int defaultRTO, int maxRTO, bool isChildAgent)
        {
            m_id = agentID;
            m_udpServer = server;
            m_scene = m_udpServer.Scene;

            PacketArchive = new IncomingPacketHistoryCollection(200);
            NeedAcks = new UnackedPacketCollection();
            PendingAcks = new LocklessQueue<uint>();
            EventQueue = new LLEventQueue();

            m_nextOnQueueEmpty = 1;
            m_defaultRTO = 1000 * 3;
            m_maxRTO = 1000 * 60;

            m_packetOutboxes = new LocklessQueue<OutgoingPacket>[THROTTLE_CATEGORY_COUNT];
            m_nextPackets = new OutgoingPacket[THROTTLE_CATEGORY_COUNT];
            m_interestList = new InterestList(this, 200);

            IsChildPresence = isChildAgent;

            m_localID = m_scene.CreateLocalID();

            TextureEntry = new Primitive.TextureEntry(DEFAULT_AVATAR_TEXTURE);

            SessionID = sessionID;
            SecureSessionID = secureSessionID;
            RemoteEndPoint = remoteEndPoint;
            CircuitCode = circuitCode;

            if (defaultRTO != 0)
                m_defaultRTO = defaultRTO;
            if (maxRTO != 0)
                m_maxRTO = maxRTO;

            // Create a token bucket throttle for this client that has the scene token bucket as a parent
            m_throttle = new TokenBucket(parentThrottle, rates.ClientTotalLimit, rates.ClientTotal);
            // Create an array of token buckets for this clients different throttle categories
            m_throttleCategories = new TokenBucket[THROTTLE_CATEGORY_COUNT];

            for (int i = 0; i < THROTTLE_CATEGORY_COUNT; i++)
            {
                ThrottleCategory type = (ThrottleCategory)i;

                // Initialize the packet outboxes, where packets sit while they are waiting for tokens
                m_packetOutboxes[i] = new LocklessQueue<OutgoingPacket>();
                // Initialize the token buckets that control the throttling for each category
                m_throttleCategories[i] = new TokenBucket(m_throttle, rates.GetLimit(type), rates.GetRate(type));
            }

            // Default the retransmission timeout to three seconds
            RTO = m_defaultRTO;

            // Initialize this to a sane value to prevent early disconnects
            TickLastPacketReceived = Util.TickCount();

            IsConnected = true;
        }
コード例 #6
0
ファイル: LLAgent.cs プロジェクト: jhurliman/simian
        /// <summary>
        /// Default constructor
        /// </summary>
        /// <param name="server">Reference to the UDP server this client is connected to</param>
        /// <param name="rates">Default throttling rates and maximum throttle limits</param>
        /// <param name="parentThrottle">Parent HTB (hierarchical token bucket)
        /// that the child throttles will be governed by</param>
        /// <param name="circuitCode">Circuit code for this connection</param>
        /// <param name="agentID">AgentID for the connected agent</param>
        /// <param name="sessionID">SessionID for the connected agent</param>
        /// <param name="secureSessionID">SecureSessionID for the connected agent</param>
        /// <param name="defaultRTO">Default retransmission timeout, in milliseconds</param>
        /// <param name="maxRTO">Maximum retransmission timeout, in milliseconds</param>
        /// <param name="remoteEndPoint">Remote endpoint for this connection</param>
        /// <param name="isChildAgent">True if this agent is currently simulated by
        /// another simulator, otherwise false</param>
        public LLAgent(LLUDPServer server, ThrottleRates rates, TokenBucket parentThrottle,
                       uint circuitCode, UUID agentID, UUID sessionID, UUID secureSessionID, IPEndPoint remoteEndPoint,
                       int defaultRTO, int maxRTO, bool isChildAgent)
        {
            m_id        = agentID;
            m_udpServer = server;
            m_scene     = m_udpServer.Scene;

            PacketArchive = new IncomingPacketHistoryCollection(200);
            NeedAcks      = new UnackedPacketCollection();
            PendingAcks   = new LocklessQueue <uint>();
            EventQueue    = new LLEventQueue();

            m_nextOnQueueEmpty = 1;
            m_defaultRTO       = 1000 * 3;
            m_maxRTO           = 1000 * 60;

            m_packetOutboxes = new LocklessQueue <OutgoingPacket> [THROTTLE_CATEGORY_COUNT];
            m_nextPackets    = new OutgoingPacket[THROTTLE_CATEGORY_COUNT];
            m_interestList   = new InterestList(this, 200);

            IsChildPresence = isChildAgent;

            m_localID = m_scene.CreateLocalID();

            TextureEntry = new Primitive.TextureEntry(DEFAULT_AVATAR_TEXTURE);

            SessionID       = sessionID;
            SecureSessionID = secureSessionID;
            RemoteEndPoint  = remoteEndPoint;
            CircuitCode     = circuitCode;

            if (defaultRTO != 0)
            {
                m_defaultRTO = defaultRTO;
            }
            if (maxRTO != 0)
            {
                m_maxRTO = maxRTO;
            }

            // Create a token bucket throttle for this client that has the scene token bucket as a parent
            m_throttle = new TokenBucket(parentThrottle, rates.ClientTotalLimit, rates.ClientTotal);
            // Create an array of token buckets for this clients different throttle categories
            m_throttleCategories = new TokenBucket[THROTTLE_CATEGORY_COUNT];

            for (int i = 0; i < THROTTLE_CATEGORY_COUNT; i++)
            {
                ThrottleCategory type = (ThrottleCategory)i;

                // Initialize the packet outboxes, where packets sit while they are waiting for tokens
                m_packetOutboxes[i] = new LocklessQueue <OutgoingPacket>();
                // Initialize the token buckets that control the throttling for each category
                m_throttleCategories[i] = new TokenBucket(m_throttle, rates.GetLimit(type), rates.GetRate(type));
            }

            // Default the retransmission timeout to three seconds
            RTO = m_defaultRTO;

            // Initialize this to a sane value to prevent early disconnects
            TickLastPacketReceived = Util.TickCount();

            IsConnected = true;
        }