Information about a region on the grid map
コード例 #1
0
 public void settarget(Vector3 pos,GridRegion region)
 {
     userclicked=true;
     this.entry_simname.Text = region.Name;
     this.spinbutton_x.Value=pos.X;
     this.spinbutton_y.Value=pos.Y;
     this.spinbutton_z.Value=pos.Z;
     target=true;
     targetregion = region;
     validregion = true;
 }
コード例 #2
0
        public RegionSearchResultItem(METAboltInstance instance, GridRegion region, ListBox listBox)
        {
            this.instance = instance;
            //netcom = this.instance.Netcom;
            client = this.instance.Client;
            this.region = region;
            this.listBox = listBox;

            agentCountWorker = new BackgroundWorker();
            agentCountWorker.DoWork += new DoWorkEventHandler(agentCountWorker_DoWork);
            agentCountWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(agentCountWorker_RunWorkerCompleted);

            AddClientEvents();
        }
コード例 #3
0
        /// <summary>
        /// Get grid region information using the region name, this function
        /// will block until it can find the region or gives up
        /// </summary>
        /// <param name="name">Name of sim you're looking for</param>
        /// <param name="layer">Layer that you are requesting</param>
        /// <param name="region">Will contain a GridRegion for the sim you're
        /// looking for if successful, otherwise an empty structure</param>
        /// <returns>True if the GridRegion was successfully fetched, otherwise
        /// false</returns>
        public bool GetGridRegion(string name, GridLayerType layer, out GridRegion region)
        {
            if (String.IsNullOrEmpty(name))
            {
                Logger.Log("GetGridRegion called with a null or empty region name", Helpers.LogLevel.Error, Client);
                region = new GridRegion();
                return(false);
            }

            // All lookups are done using lowercase sim names
            name = name.ToLower();

            if (Regions.ContainsKey(name))
            {
                // We already have this GridRegion structure
                region = Regions[name];
                return(true);
            }
            else
            {
                AutoResetEvent     regionEvent = new AutoResetEvent(false);
                GridRegionCallback callback    =
                    delegate(GridRegion gridRegion)
                {
                    if (gridRegion.Name == name)
                    {
                        regionEvent.Set();
                    }
                };
                OnGridRegion += callback;

                RequestMapRegion(name, layer);
                regionEvent.WaitOne(Client.Settings.MAP_REQUEST_TIMEOUT, false);

                OnGridRegion -= callback;

                if (Regions.ContainsKey(name))
                {
                    // The region was found after our request
                    region = Regions[name];
                    return(true);
                }
                else
                {
                    Logger.Log("Couldn't find region " + name, Helpers.LogLevel.Warning, Client);
                    region = new GridRegion();
                    return(false);
                }
            }
        }
コード例 #4
0
        /// <summary>
        /// Get grid region information using the region name, this function
        /// will block until it can find the region or gives up
        /// </summary>
        /// <param name="name">Name of sim you're looking for</param>
        /// <param name="layer">Layer that you are requesting</param>
        /// <param name="region">Will contain a GridRegion for the sim you're
        /// looking for if successful, otherwise an empty structure</param>
        /// <returns>True if the GridRegion was successfully fetched, otherwise
        /// false</returns>
        public bool GetGridRegion(string name, GridLayerType layer, out GridRegion region)
        {
            if (String.IsNullOrEmpty(name))
            {
                Logger.Log("GetGridRegion called with a null or empty region name", Helpers.LogLevel.Error, Client);
                region = new GridRegion();
                return(false);
            }

            if (Regions.ContainsKey(name))
            {
                // We already have this GridRegion structure
                region = Regions[name];
                return(true);
            }
            else
            {
                AutoResetEvent regionEvent = new AutoResetEvent(false);
                EventHandler <GridRegionEventArgs> callback =
                    delegate(object sender, GridRegionEventArgs e)
                {
                    if (e.Region.Name == name)
                    {
                        regionEvent.Set();
                    }
                };
                GridRegion += callback;

                RequestMapRegion(name, layer);
                regionEvent.WaitOne(Client.Settings.MAP_REQUEST_TIMEOUT, false);

                GridRegion -= callback;

                if (Regions.ContainsKey(name))
                {
                    // The region was found after our request
                    region = Regions[name];
                    return(true);
                }
                else
                {
                    Logger.Log("Couldn't find region " + name, Helpers.LogLevel.Warning, Client);
                    region = new GridRegion();
                    return(false);
                }
            }
        }
コード例 #5
0
        public static OSDMap CrossAgent(GridRegion crossingRegion, Vector3 pos,
                                        Vector3 velocity, AgentCircuitData circuit, AgentData cAgent,
                                        UUID RequestingRegion)
        {
            OSDMap llsdBody = new OSDMap
                                  {
                                      {"Pos", pos},
                                      {"Vel", velocity},
                                      {"Region", crossingRegion.ToOSD()},
                                      {"Circuit", circuit.ToOSD()},
                                      {"AgentData", cAgent.ToOSD()}
                                  };

            return buildEvent("CrossAgent", llsdBody, circuit.AgentID, RequestingRegion);
        }
コード例 #6
0
        void requestnewgridregion()
        {
            cx = 0;
            cy = 0;

            Gtk.Application.Invoke(delegate{

                for (int x = 0; x < 9; x++)
                {
                    regions[x] = new OpenMetaverse.GridRegion();
                    regions[x].Name = "";
                    maps[x].SetAsWater();
                    Gtk.Tooltips name = new Gtk.Tooltips();
                    name.SetTip(maps[x], "Empty", "");
                    name.Enable();
                }

                Logger.Log("Requesting map region for current region",Helpers.LogLevel.Debug);
                requested = true;
                MainClass.client.Grid.RequestMapRegion(MainClass.client.Network.CurrentSim.Name, GridLayerType.Objects);

            });
        }
コード例 #7
0
        void MainClass_onRegister()
        {
            requested = false;

            for (int x = 0; x < 9; x++)
            {
                maps[x].SetAsWater();
                regions[x] = new OpenMetaverse.GridRegion();
                regions[x].Name = "";

                Gtk.Tooltips name = new Gtk.Tooltips();
                name.SetTip(maps[x], "Empty", "");
                name.Enable();
            }

            MainClass.client.Network.SimChanged += new EventHandler<SimChangedEventArgs>(Network_SimChanged);
            MainClass.client.Grid.GridRegion += new EventHandler<GridRegionEventArgs>(Grid_GridRegion);
        }
コード例 #8
0
ファイル: MapControl.cs プロジェクト: nooperation/radegast
 public MapTargetChangedEventArgs(GridRegion region, int x, int y)
 {
     Region = region;
     LocalX = x;
     LocalY = y;
 }
コード例 #9
0
ファイル: MapControl.cs プロジェクト: nooperation/radegast
        private void MapControl_MouseUp(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                dragging = false;
                if (e.X == downX && e.Y == downY) // click
                {
                    targetParcelName = null;
                    double ratio = (float)PixRegS / (float)regionSize;
                    targetX = centerX + (double)(e.X - Width / 2) / ratio;
                    targetY = centerY - (double)(e.Y - Height / 2) / ratio;
                    float localX, localY;
                    ulong handle = Helpers.GlobalPosToRegionHandle((float)targetX, (float)targetY, out localX, out localY);
                    uint regX, regY;
                    Utils.LongToUInts(handle, out regX, out regY);
                    if (regions.ContainsKey(handle))
                    {
                        targetRegion = regions[handle];
                        GetTargetParcel();
                        if (MapTargetChanged != null)
                        {
                            MapTargetChanged(this, new MapTargetChangedEventArgs(targetRegion, (int)localX, (int)localY));
                        }
                    }
                    else
                    {
                        targetRegion = new GridRegion();
                    }
                }
                SafeInvalidate();
            }

        }
コード例 #10
0
ファイル: Map.cs プロジェクト: robincornelius/omvviewer-light
        void update_map_for_region(ulong regionID)
        {
            Logger.Log("Update map for region() handle " + regionID.ToString(),Helpers.LogLevel.Debug);
            if (regionID != this_maps_region_handle)
                return;

            GridRegion region;
            if (MainClass.win.grid_regions.TryGetValue(regionID, out region))
            {
                current_region = region;

                this.objects_map_ID = region.MapImageID;
                Gdk.Pixbuf pb = MainClass.GetResource("trying.png");
                objects_map = new Gtk.Image(pb);
                int size = height < width ? height : width;
                this.scalemap.Pixbuf = this.objects_map.Pixbuf.ScaleSimple(size, size, InterpType.Bilinear);

                this.image.Pixbuf = pb;
                TryGetImage tgi = new TryGetImage(this.objects_map, region.MapImageID, 350, 350, true);
                tgi.OnDecodeComplete += delegate
                {
                    Gtk.Application.Invoke(delegate
                    {
                        this.scalemap = new Gtk.Image();
                        int size2 = height < width ? height : width;
                        if (size2 < 25)
                            size2 = 25; //meh!

                        this.scalemap.Pixbuf = this.objects_map.Pixbuf.ScaleSimple(size2, size, InterpType.Bilinear);
                        drawavs();
                    });
                };

                tgi.go();
            }
            else
            {
                Logger.Log("Failed to find region in region cache", Helpers.LogLevel.Warning);
            }
        }
コード例 #11
0
        protected void MapBlockReplyHandler(object sender, PacketReceivedEventArgs e)
        {
            MapBlockReplyPacket map = (MapBlockReplyPacket) e.Packet;

            foreach (MapBlockReplyPacket.DataBlock block in map.Data)
            {
                if (block.X != 0 || block.Y != 0)
                {
                    GridRegion region = new GridRegion();

                    region.X = block.X;
                    region.Y = block.Y;
                    region.Name = Utils.BytesToString(block.Name);
                    // RegionFlags seems to always be zero here?
                    region.RegionFlags = (RegionFlags) block.RegionFlags;
                    region.WaterHeight = block.WaterHeight;
                    region.Agents = block.Agents;
                    region.Access = (SimAccess) block.Access;
                    region.MapImageID = block.MapImageID;
                    region.RegionHandle = Utils.UIntsToLong((uint) (region.X*256), (uint) (region.Y*256));

                    lock (Regions)
                    {
                        Regions[region.Name] = region;
                        RegionsByHandle[region.RegionHandle] = region;
                    }
                }
            }
        }
コード例 #12
0
        /// <summary>
        /// Get grid region information using the region name, this function
        /// will block until it can find the region or gives up
        /// </summary>
        /// <param name="name">Name of sim you're looking for</param>
        /// <param name="layer">Layer that you are requesting</param>
        /// <param name="region">Will contain a GridRegion for the sim you're
        /// looking for if successful, otherwise an empty structure</param>
        /// <returns>True if the GridRegion was successfully fetched, otherwise
        /// false</returns>
        public bool GetGridRegion(string name, GridLayerType layer, out GridRegion region)
        {
            if (String.IsNullOrEmpty(name))
            {
                Logger.Log("GetGridRegion called with a null or empty region name", Helpers.LogLevel.Error, Client);
                region = new GridRegion();
                return false;
            }

            if (Regions.ContainsKey(name))
            {
                // We already have this GridRegion structure
                region = Regions[name];
                return true;
            }
            else
            {
                AutoResetEvent regionEvent = new AutoResetEvent(false);
                EventHandler<GridRegionEventArgs> callback =
                    delegate(object sender, GridRegionEventArgs e)
                    {
                        if (e.Region.Name == name)
                            regionEvent.Set();
                    };
                GridRegion += callback;

                RequestMapRegion(name, layer);
                regionEvent.WaitOne(Client.Settings.MAP_REQUEST_TIMEOUT, false);

                GridRegion -= callback;

                if (Regions.ContainsKey(name))
                {
                    // The region was found after our request
                    region = Regions[name];
                    return true;
                }
                else
                {
                    Logger.Log("Couldn't find region " + name, Helpers.LogLevel.Warning, Client);
                    region = new GridRegion();
                    return false;
                }
            }
        }
コード例 #13
0
ファイル: Teleport.cs プロジェクト: NullProjects/METAbolt
        private void lbxRegionSearch_DoubleClick(object sender, EventArgs e)
        {
            if (lbxRegionSearch.SelectedItem == null) return;
            RegionSearchResultItem item = (RegionSearchResultItem)lbxRegionSearch.SelectedItem;

            selregion = item.Region;
            txtRegion.Text = item.Region.Name;
            nudX.Value = 128;
            nudY.Value = 128;
            nudZ.Value = 0;
        }
コード例 #14
0
ファイル: Teleport.cs プロジェクト: NullProjects/METAbolt
        //UI thread
        private void RegionSearchResult(GridRegion region)
        {
            if (InvokeRequired)
            {
                BeginInvoke(new MethodInvoker(() => RegionSearchResult(region)));
                return;
            }

            RegionSearchResultItem item = new RegionSearchResultItem(instance, region, lbxRegionSearch);
            int index = lbxRegionSearch.Items.Add(item);
            item.ListIndex = index;
            selregion = item.Region;
        }
コード例 #15
0
        /*
        private bool TestViaLogin(GridRegion r)
        {
            var TheRadegastInstance = Client.TheRadegastInstance;
            Success("Logging out to Test " + r.Name);
            TheRadegastInstance.Netcom.Logout();
            Client.logout();
            Client.Network.Logout();
            var loginParams = TheBotClient.TheRadegastInstance.Netcom.LoginOptions;
            string uri = r.Name + "/128/128/128";
            TheBotClient.BotLoginParams.loginParams.Start = uri;
            loginParams.StartLocationCustom = r.Name;
            loginParams.StartLocation = StartLocationType.Custom;
            TheBotClient.BotLoginParams.Start = uri;
            TheRadegastInstance.Netcom.loginOptions.StartLocationCustom = r.Name;
            TheRadegastInstance.Netcom.loginOptions.StartLocation = StartLocationType.Custom;
            TheBotClient.ExpectConnected = false;
            Thread.Sleep(6000);
            if (TheBotClient.IsLoggedInAndReady)
            {
                Success("Error  IsLoggedInAndReady");
            }
            Client.Network.CurrentSim = null;
            Success("NOW Logging into " + r.Name);
            if (!ClientManager.OneAtATimeQueue.NoExceptionsV(TheRadegastInstance.Netcom.Login))
            {
                TheBotClient.Login(true);
            }
            else
            {
                Thread.Sleep(10000);
            }
            Thread.Sleep(5000);
            //TheRadegastInstance.Reconnect(); 
                       
            Simulator clientNetworkCurrentSim = Client.Network.CurrentSim;
            return clientNetworkCurrentSim != null && clientNetworkCurrentSim.Name.ToLower() == r.Name.ToLower();
            Client.Settings.USE_LLSD_LOGIN = false;
            Client.Settings.LOGIN_TIMEOUT = 60000;
            return Client.Network.Login(loginParams.FirstName, loginParams.LastName, loginParams.Password, "Radegast", r.Name, "1.0");
        }*/

        private bool MiniMapTest(GridRegion r)
        {
            var itemList = Client.Grid.MapItems(r.RegionHandle, OpenMetaverse.GridItemType.AgentLocations,
                                                GridLayerType.Objects, 2000);
            if (itemList == null)
            {
                return false;
            }
            return itemList != null;
        }
コード例 #16
0
 private bool RegionTest(GridRegion r)
 {
     Control.CheckForIllegalCrossThreadCalls = false;
     AddSuccess("Testing: " + r.Name + ": (" + r.X + "," + r.Y + ") " + r.Access);
     //return TestViaLogin(r);
     bool t1 = MiniMapTest(r);
     AddSuccess("MINIMAP " + (t1 ? "PASS" : "FAIL") + ": " + r.Name + ": (" + r.X + "," + r.Y + ") " + r.Access);
     return TeleportTest(r);
 }
コード例 #17
0
 private void DownloadRegionImage(GridRegion region)
 {
     string filename = region.Name + "_" + region.X + "_" + region.Y + ".tga";
     Client.ExecuteCommand("download " + region.MapImageID + " " + AssetType.Texture + " " + filename + " jp2k",
                           Client, WriteLine, CMDFLAGS.Backgrounded);
 }
コード例 #18
0
        public static OSDMap TeleportAgent(int DrawDistance, AgentCircuitData circuit,
                                           AgentData data, uint TeleportFlags,
                                           GridRegion destination, UUID requestingRegion)
        {
            OSDMap llsdBody = new OSDMap
                                  {
                                      {"DrawDistance", DrawDistance},
                                      {"Circuit", circuit.ToOSD()},
                                      {"TeleportFlags", TeleportFlags},
                                      {"AgentData", data.ToOSD()},
                                      {"Region", destination.ToOSD()}
                                  };

            return buildEvent("TeleportAgent", llsdBody, circuit.AgentID, requestingRegion);
        }
コード例 #19
0
ファイル: GridManager.cs プロジェクト: RavenB/gridsearch
 private bool Equals(GridRegion region)
 {
     return (this.X == region.X && this.Y == region.Y);
 }
コード例 #20
0
 private bool Equals(GridRegion region)
 {
     return(this.X == region.X && this.Y == region.Y);
 }
コード例 #21
0
        private bool TeleportTest(GridRegion r)
        {
            bool passfail = false;
            AutoResetEvent are = new AutoResetEvent(false);
            bool eventDead = false;
            EventHandler<TeleportEventArgs> tp = (o, e) =>
                                                     {
                                                         if (eventDead) return;
                                                         switch (e.Status)
                                                         {
                                                             case TeleportStatus.None:
                                                             case TeleportStatus.Start:
                                                             case TeleportStatus.Progress:
                                                                 AddSuccess("status " + e.Status);
                                                                 break;
                                                             case TeleportStatus.Failed:
                                                                 passfail = false;
                                                                 are.Set();
                                                                 break;
                                                             case TeleportStatus.Finished:
                                                                 passfail = true;
                                                                 are.Set();
                                                                 break;
                                                             case TeleportStatus.Cancelled:
                                                                 passfail = false;
                                                                 are.Set();
                                                                 break;
                                                             default:
                                                                 throw new ArgumentOutOfRangeException();
                                                         }
                                                     };
            try
            {
                Client.Self.TeleportProgress += tp;

                bool pass = Client.Self.Teleport(r.RegionHandle, new Vector3(128, 128, 128));
                eventDead = true;
                int ms = Client.Settings.TELEPORT_TIMEOUT;
                if (!are.WaitOne(ms + 1000))
                {
                    AddSuccess("TimeOut: " + r.Name + ": (" + r.X + "," + r.Y + ") " + r.Access);
                    return false;
                }
            }
            finally
            {
                eventDead = true;
                Client.Self.TeleportProgress -= tp;
            }
            Thread.Sleep(2000);
            Simulator clientNetworkCurrentSim = Client.Network.CurrentSim;
            return clientNetworkCurrentSim != null && clientNetworkCurrentSim.Name.ToLower() == r.Name.ToLower();
            //return passfail;
        }
コード例 #22
0
 public GridRegionEventArgs(GridRegion region)
 {
     this.m_Region = region;
 }
コード例 #23
0
ファイル: MapControl.cs プロジェクト: nooperation/radegast
 public void ClearTarget()
 {
     targetRegion = nullRegion;
     targetX = targetY = -5000000000d;
     WorkPool.QueueUserWorkItem(sync =>
         {
             Thread.Sleep(500);
             needRepaint = true;
         }
     );
 }
コード例 #24
0
 public GridRegionEventArgs(GridRegion region)
 {
     this.m_Region = region;
 }
コード例 #25
0
ファイル: MapControl.cs プロジェクト: nooperation/radegast
        public void CenterMap(uint regionX, uint regionY, uint localX, uint localY, bool setTarget)
        {
            centerX = (double)regionX * 256 + (double)localX;
            centerY = (double)regionY * 256 + (double)localY;
            centered = true;

            if (setTarget)
            {
                ulong handle = Utils.UIntsToLong(regionX * 256, regionY * 256);
                if (regions.ContainsKey(handle))
                {
                    targetRegion = regions[handle];
                    GetTargetParcel();
                    if (MapTargetChanged != null)
                    {
                        MapTargetChanged(this, new MapTargetChangedEventArgs(targetRegion, (int)localX, (int)localY));
                    }
                }
                else
                {
                    targetRegion = new GridRegion();
                }
                targetX = centerX;
                targetY = centerY;
            }

            // opensim grids need extra push
            if (Instance.Netcom.Grid.Platform == "OpenSim")
            {
                Client.Grid.RequestMapLayer(GridLayerType.Objects);
            }
            SafeInvalidate();
        }
コード例 #26
0
ファイル: GridManager.cs プロジェクト: RavenB/gridsearch
        /// <summary>
        /// Get grid region information using the region name, this function
        /// will block until it can find the region or gives up
        /// </summary>
        /// <param name="name">Name of sim you're looking for</param>
        /// <param name="layer">Layer that you are requesting</param>
        /// <param name="region">Will contain a GridRegion for the sim you're
        /// looking for if successful, otherwise an empty structure</param>
        /// <returns>True if the GridRegion was successfully fetched, otherwise
        /// false</returns>
        public bool GetGridRegion(string name, GridLayerType layer, out GridRegion region)
        {
            if (String.IsNullOrEmpty(name))
            {
                Logger.Log("GetGridRegion called with a null or empty region name", Helpers.LogLevel.Error, Client);
                region = new GridRegion();
                return false;
            }

            // All lookups are done using lowercase sim names
            name = name.ToLower();

            if (Regions.ContainsKey(name))
            {
                // We already have this GridRegion structure
                region = Regions[name];
                return true;
            }
            else
            {
                AutoResetEvent regionEvent = new AutoResetEvent(false);
                GridRegionCallback callback =
                    delegate(GridRegion gridRegion)
                    {
                        if (gridRegion.Name == name)
                            regionEvent.Set();
                    };
                OnGridRegion += callback;

                RequestMapRegion(name, layer);
                regionEvent.WaitOne(Client.Settings.MAP_REQUEST_TIMEOUT, false);

                OnGridRegion -= callback;

                if (Regions.ContainsKey(name))
                {
                    // The region was found after our request
                    region = Regions[name];
                    return true;
                }
                else
                {
                    Logger.Log("Couldn't find region " + name, Helpers.LogLevel.Warning, Client);
                    region = new GridRegion();
                    return false;
                }
            }
        }
コード例 #27
0
ファイル: frmMapClient.cs プロジェクト: NullProjects/METAbolt
        private void lbxRegionSearch_Click(object sender, EventArgs e)
        {
            try
            {
                if (lbxRegionSearch.SelectedItem == null)
                {
                    button4.Enabled = false;
                    return;
                }

                RegionSearchResultItem item = (RegionSearchResultItem)lbxRegionSearch.SelectedItem;

                button4.Enabled = true;

                selregion = item.Region;
                txtRegion.Text = item.Region.Name;
                nudX1.Value = 128;
                nudY1.Value = 128;
                nudZ1.Value = 0;

                orgmap = item.MapImage;
                selectedmap = item.MapImage;
                //pictureBox2.Image = selectedmap;

                Bitmap bmp = new Bitmap(selectedmap, 256, 256);

                Graphics g = Graphics.FromImage(bmp);

                Rectangle rect = new Rectangle();

                foreach (MapItem itm in item.AgentLocations)
                {
                    // Draw avatar location icons
                    int x = (int)itm.LocalX + 7;
                    int y = 255 - (int)itm.LocalY - 16;

                    rect = new Rectangle(x, y, 7, 7);

                    g.FillEllipse(Brushes.LightGreen, rect);
                    g.DrawEllipse(new Pen(Brushes.Green, 1), rect);
                }

                g.DrawImage(bmp, 0, 0);
                pictureBox2.Image = bmp;

                g.Dispose();
            }
            catch { ; }
        }