示例#1
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));
        }
        public override GridRegion HelloNeighbour(ulong regionHandle, RegionInfo thisRegion)
        {
            GridRegion region = m_LocalService.HelloNeighbour(regionHandle, thisRegion);

            if (region != null)
            {
                return(region);
            }

            return(base.HelloNeighbour(regionHandle, thisRegion));
        }
示例#3
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);
        }
示例#4
0
 public void ClearTarget()
 {
     targetRegion = nullRegion;
     targetX      = targetY = -5000000000d;
     WorkPool.QueueUserWorkItem(sync =>
     {
         Thread.Sleep(500);
         needRepaint = true;
     }
                                );
 }
示例#5
0
        public bool IsAuthorizedForRegion(GridRegion region, AgentCircuitData agent, bool isRootAgent, out string reason)
        {
            ISceneManager manager = m_registry.RequestModuleInterface <ISceneManager>();

            if (manager != null && manager.Scene != null && manager.Scene.RegionInfo.RegionID == region.RegionID)
            {
                //Found the region, check permissions
                return(manager.Scene.Permissions.AllowedIncomingAgent(agent, isRootAgent, out reason));
            }
            reason = "Not Authorized as region does not exist.";
            return(false);
        }
示例#6
0
        private void lbxRegionSearch_Click(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;
        }
示例#7
0
        //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;
        }
        public RegionSearchResultItem(RadegastInstance 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();
        }
示例#9
0
        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 {; }
        }
        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));
        }
        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));
        }
示例#12
0
        public override string Execute(string[] args, LLUUID fromAgentID)
        {
            if (args.Length < 1)
            {
                return("Usage: findsim [Simulator Name]");
            }

            string simName = string.Empty;

            for (int i = 0; i < args.Length; i++)
            {
                simName += args[i] + " ";
            }
            simName = simName.TrimEnd().ToLower();

            if (!GridDataCached.ContainsKey(Client))
            {
                GridDataCached[Client] = false;
            }

            if (!GridDataCached[Client])
            {
                Client.Grid.AddAllSims();
                System.Threading.Thread.Sleep(5000);
                GridDataCached[Client] = true;
            }

            int        attempts = 0;
            GridRegion region   = null;

            while (region == null && attempts++ < 5)
            {
                region = Client.Grid.GetGridRegion(simName);
            }

            if (region != null)
            {
                return("Found " + region.Name + ": handle=" + region.RegionHandle +
                       "(" + region.X + "," + region.Y + ")");
            }
            else
            {
                return("Lookup of " + simName + " failed");
            }
        }
示例#13
0
        /*
         * private void HandleQuit(string module, string[] cmd)
         * {
         *  m_console.Warn("DANGER", "This should only be used to quit the program if you've already used the shutdown command and the program hasn't quit");
         *  Environment.Exit(0);
         * }
         */
//
//        private void HandleAddBots(string module, string[] cmd)
//        {
//            int newbots = 0;
//
//            if (cmd.Length > 2)
//            {
//                Int32.TryParse(cmd[2], out newbots);
//            }
//            if (newbots > 0)
//                addbots(newbots);
//        }

        internal void Grid_GridRegion(object o, GridRegionEventArgs args)
        {
            lock (RegionsKnown)
            {
                GridRegion newRegion = args.Region;

                if (RegionsKnown.ContainsKey(newRegion.RegionHandle))
                {
                    return;
                }
                else
                {
                    m_log.DebugFormat(
                        "[BOT MANAGER]: Adding {0} {1} to known regions", newRegion.Name, newRegion.RegionHandle);
                    RegionsKnown[newRegion.RegionHandle] = newRegion;
                }
            }
        }
示例#14
0
    protected override void Awake()
    {
        base.Awake();

        for (int i = 0; i < horizontalCell; i++)
        {
            for (int j = 0; j < VerticalCell; j++)
            {
                grid[i, j] = new GridRegion();
            }
        }

        if (BottomLeftBorder && TopRightBorder)
        {
            worldWidth  = Mathf.Abs(TopRightBorder.transform.position.x - BottomLeftBorder.transform.position.x);
            worldHeight = Mathf.Abs(TopRightBorder.transform.position.y - BottomLeftBorder.transform.position.y);

            horizontalOffset = Mathf.Min(TopRightBorder.transform.position.x, BottomLeftBorder.transform.position.x);
            verticalOffset   = Mathf.Min(TopRightBorder.transform.position.y, BottomLeftBorder.transform.position.y);
        }
    }
示例#15
0
        private IEnumerable <bool[]> GetSides(IDefinedSizeGrid <bool> grid)
        {
            var size   = grid.Region().Width;
            var region = new GridRegion(GridPoint.Origin, size, 1);

            yield return(grid.Windowed(region).AllCells().ToArray());

            yield return(grid.Windowed(region).AllCells().Reverse().ToArray());

            grid = grid.RotateClockwise();
            yield return(grid.Windowed(region).AllCells().ToArray());

            yield return(grid.Windowed(region).AllCells().Reverse().ToArray());

            grid = grid.RotateClockwise();
            yield return(grid.Windowed(region).AllCells().ToArray());

            yield return(grid.Windowed(region).AllCells().Reverse().ToArray());

            grid = grid.RotateClockwise();
            yield return(grid.Windowed(region).AllCells().ToArray());

            yield return(grid.Windowed(region).AllCells().Reverse().ToArray());
        }
示例#16
0
        internal void NextPage(PlatformGraphics pg)
        {
            this.hasMorePages = false;

            var sheet = this.CurrentWorksheet;

            if (sheet == null)
            {
                return;
            }

            // out of print areas
            if (this.CurrentRowIndex >= sheet.pageBreakRows.Count &&
                this.CurrentColIndex >= sheet.pageBreakCols.Count)
            {
                return;
            }

            int row = sheet.pageBreakRows[this.CurrentRowIndex];
            int col = sheet.pageBreakCols[this.CurrentColIndex];

            int endRow = sheet.pageBreakRows[this.CurrentRowIndex + 1];
            int endCol = sheet.pageBreakCols[this.CurrentColIndex + 1];

            switch (this.CurrentPrintSettings.PageOrder)
            {
            default:
            case PrintPageOrder.DownThenOver:
            {
                if (this.CurrentRowIndex < sheet.pageBreakRows.Count - 2)
                {
                    this.CurrentRowIndex++;

                    this.hasMorePages = true;
                }
                else
                {
                    if (this.CurrentColIndex < sheet.pageBreakCols.Count - 2)
                    {
                        this.CurrentRowIndex = 0;
                        this.CurrentColIndex++;

                        this.hasMorePages = true;
                    }
                    else
                    {
                        this.hasMorePages = false;
                    }
                }
            }
            break;

            case PrintPageOrder.OverThenDown:
            {
                if (this.CurrentColIndex < sheet.pageBreakCols.Count - 2)
                {
                    this.CurrentColIndex++;

                    this.hasMorePages = true;
                }
                else
                {
                    if (this.CurrentRowIndex < sheet.pageBreakRows.Count - 2)
                    {
                        this.CurrentColIndex = 0;
                        this.CurrentRowIndex++;

                        this.hasMorePages = true;
                    }
                    else
                    {
                        this.hasMorePages = false;
                    }
                }
            }
            break;
            }

            if (this.DrawingContext.Graphics == null)
            {
#if WINFORM
                this.DrawingContext.Graphics = new unvell.ReoGrid.WinForm.GDIRenderer(pg);
#endif // WINFORM
            }
            else
            {
                this.DrawingContext.Graphics.Reset();
            }

            var ig = this.DrawingContext.Renderer;
            ig.PlatformGraphics = pg;

#if DEBUG
            Debug.WriteLine(string.Format("print page {0,3},{1,3} - {2,3},{3,3}", row, col, endRow, endCol));
#endif // DEBUG

            GridRegion gr = new GridRegion(row, col, endRow, endCol);

            if (this.printViewportController == null)
            {
                this.printViewportController = new ViewportController(sheet);
            }
            else
            {
                this.printViewportController.worksheet = sheet;
            }

            this.PrintViewport        = new SheetViewport(this.printViewportController);
            this.PrintViewport.Bounds = this.CurrentPaperBounds;

            // refresh cells text boundary
            sheet.IterateCells(gr.ToRange(), (_unused_r, _unused_c, cell) =>
            {
                sheet.UpdateCellTextBounds(ig, cell, DrawMode.Print, this.CurrentPrintSettings.PageScaling, Core.UpdateFontReason.ScaleChanged);
                return(true);
            });

            this.PrintViewport.VisibleRegion = gr;
            this.PrintViewport.ScaleFactor   = this.CurrentPrintSettings.PageScaling;
            this.PrintViewport.ViewStart     = new Point(sheet.cols[col].Left, sheet.rows[row].Top);
            this.PrintViewport.UpdateView();

            this.PrintViewport.Draw(this.DrawingContext);

            if (this.CurrentPrintSettings.ShowMargins)
            {
                var m = this.CurrentPaperBounds;

                var p = this.DrawingContext.Renderer.GetPen(SolidColor.Gray);

                lock (p)
                {
                    ig.DrawLine(p, m.X - 50, m.Y, m.X, m.Y);
                    ig.DrawLine(p, m.Right + 50, m.Y, m.Right, m.Y);

                    ig.DrawLine(p, m.X - 50, m.Bottom, m.X, m.Bottom);
                    ig.DrawLine(p, m.Right + 50, m.Bottom, m.Right, m.Bottom);

                    ig.DrawLine(p, m.X, m.Y - 50, m.X, m.Y);
                    ig.DrawLine(p, m.X, m.Bottom + 50, m.X, m.Bottom);

                    ig.DrawLine(p, m.Right, m.Y - 50, m.Right, m.Y);
                    ig.DrawLine(p, m.Right, m.Bottom + 50, m.Right, m.Bottom);
                }
            }

            if (!this.hasMorePages)
            {
                this.NextWorksheet();

                this.hasMorePages = this.CurrentWorksheet != null;
            }
        }
示例#17
0
 public override void FromOSD(OSDMap map)
 {
     Error = map["Error"];
     OSDArray n = (OSDArray)map["Neighbors"];
     Neighbors = n.ConvertAll<GridRegion>((osd) => { GridRegion r = new GridRegion(); r.FromOSD((OSDMap)osd); return r; });
     SessionID = map["SessionID"];
     RegionFlags = map["RegionFlags"];
     if (map.ContainsKey("Urls"))
         Urls = (OSDMap)map["Urls"];
     if (map.ContainsKey("RegionRemote"))
         RegionRemote = (OSDMap)map["RegionRemote"];
     if (map.ContainsKey("Region"))
     {
         Region = new GridRegion();
         Region.FromOSD((OSDMap)map["Region"]);
     }
 }
示例#18
0
        public override void Action()
        {
            GridClient client = Bot.Client;

//            // Fly to make the border cross easier.
//            client.Self.Movement.Fly = true;
//            client.Self.Movement.Fly = false;

            // Seek out neighbouring region
            Simulator currentSim = client.Network.CurrentSim;
            ulong     currentHandle = currentSim.Handle;
            uint      currentX, currentY;

            Utils.LongToUInts(currentHandle, out currentX, out currentY);

            List <GridRegion> candidateRegions = new List <GridRegion>();

            TryAddRegion(Utils.UIntsToLong(Math.Max(0, currentX - Constants.RegionSize), currentY), candidateRegions); // West
            TryAddRegion(Utils.UIntsToLong(currentX + Constants.RegionSize, currentY), candidateRegions);              // East
            TryAddRegion(Utils.UIntsToLong(currentX, Math.Max(0, currentY - Constants.RegionSize)), candidateRegions); // South
            TryAddRegion(Utils.UIntsToLong(currentX, currentY + Constants.RegionSize), candidateRegions);              // North

            if (candidateRegions.Count != 0)
            {
                GridRegion destRegion = candidateRegions[Bot.Manager.Rng.Next(candidateRegions.Count)];

                uint targetX, targetY;
                Utils.LongToUInts(destRegion.RegionHandle, out targetX, out targetY);

                Vector3 pos = client.Self.SimPosition;
                if (targetX < currentX)
                {
                    pos.X = -1;
                }
                else if (targetX > currentX)
                {
                    pos.X = Constants.RegionSize + 1;
                }

                if (targetY < currentY)
                {
                    pos.Y = -1;
                }
                else if (targetY > currentY)
                {
                    pos.Y = Constants.RegionSize + 1;
                }

                m_log.DebugFormat(
                    "[CROSS BEHAVIOUR]: {0} moving to cross from {1} into {2}, target {3}",
                    Bot.Name, currentSim.Name, destRegion.Name, pos);

                // Face in the direction of the candidate region
                client.Self.Movement.TurnToward(pos);

                // Listen for event so that we know when we've crossed the region boundary
                Bot.Client.Self.RegionCrossed += Self_RegionCrossed;

                // Start moving
                Bot.Client.Self.Movement.AtPos = true;

                // Stop when reach region target or border cross detected
                if (!m_regionCrossedMutex.WaitOne(m_regionCrossingTimeout, false))
                {
                    m_log.ErrorFormat(
                        "[CROSS BEHAVIOUR]: {0} failed to cross from {1} into {2} with {3}ms",
                        Bot.Name, currentSim.Name, destRegion.Name, m_regionCrossingTimeout);
                }
                else
                {
                    m_log.DebugFormat(
                        "[CROSS BEHAVIOUR]: {0} crossed from {1} into {2}",
                        Bot.Name, currentSim.Name, destRegion.Name);
                }

                Bot.Client.Self.RegionCrossed -= Self_RegionCrossed;

                // We will hackishly carry on travelling into the region for a little bit.
                Thread.Sleep(6000);

                m_log.DebugFormat(
                    "[CROSS BEHAVIOUR]: {0} stopped moving after cross from {1} into {2}",
                    Bot.Name, currentSim.Name, destRegion.Name);

                Bot.Client.Self.Movement.AtPos = false;
            }
            else
            {
                m_log.DebugFormat(
                    "[CROSS BEHAVIOUR]: No candidate region for {0} to cross into from {1}.  Ignoring.",
                    Bot.Name, currentSim.Name);
            }
        }
示例#19
0
 public bool Store(GridRegion data)
 {
     throw new System.NotImplementedException();
 }
示例#20
0
 /// <summary>
 /// Define equality as two regions having the same, non-zero UUID.
 /// </summary>
 public bool Equals(GridRegion region)
 {
     if ((object)region == null)
         return false;
     // Return true if the non-zero UUIDs are equal:
     return (RegionID != UUID.Zero) && RegionID.Equals(region.RegionID);
 }
 public override void FromOSD(OSDMap map)
 {
     AgentID = map["AgentID"];
     Destination = new GridRegion();
     Destination.FromOSD((OSDMap)map["Destination"]);
     AgentIsLeaving = map["AgentIsLeaving"];
 }
示例#22
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;
        }
 public override void FromOSD(OSDMap map)
 {
     Destination = new GridRegion();
     Destination.FromOSD((OSDMap)map["Destination"]);
     ObjectBlob = map["Object"].AsBinary();
 }
 public override void FromOSD(OSDMap map)
 {
     AgentID = map["AgentID"];
     Destination = new GridRegion();
     Destination.FromOSD((OSDMap)map["Destination"]);
     OldRegion = new GridRegion();
     OldRegion.FromOSD((OSDMap)map["OldRegion"]);
     IsCrossing = map["IsCrossing"];
 }
示例#25
0
 public override void FromOSD(OSDMap map)
 {
     Error = map["Error"];
     OSDArray n = (OSDArray)map["Neighbors"];
     Neighbors = n.ConvertAll<GridRegion>((osd) => { GridRegion r = new GridRegion(); r.FromOSD((OSDMap)osd); return r; });
     SessionID = map["SessionID"];
     RegionFlags = map["RegionFlags"];
     Urls = (OSDMap)map["Urls"];
 }
示例#26
0
 public override void FromOSD(OSDMap map)
 {
     Destination = new GridRegion();
     Destination.FromOSD((OSDMap)map["Destination"]);
     System.IO.MemoryStream stream = new System.IO.MemoryStream(map["Object"].AsBinary());
     Aurora.Framework.Serialization.SceneEntitySerializer.SceneObjectSerializer.FromXml2Format(ref stream, Scene);
     stream.Close();
 }
示例#27
0
 public override void FromOSD(OSDMap map)
 {
     Error = map["Error"];
     OSDArray n = (OSDArray) map["Neighbors"];
     Neighbors = n.ConvertAll<GridRegion>((osd) =>
                                              {
                                                  GridRegion r = new GridRegion();
                                                  r.FromOSD((OSDMap) osd);
                                                  return r;
                                              });
     SessionID = map["SessionID"];
     RegionFlags = map["RegionFlags"];
     if (map.ContainsKey("Region"))
     {
         Region = new GridRegion();
         Region.FromOSD((OSDMap)map["Region"]);
     }
     if (map.ContainsKey("URIs"))
         URIs = ((OSDMap)map["URIs"]).ConvertMap<List<string>>((o)=>((OSDArray)o).ConvertAll<string>((oo)=>oo));
 }
 public static WindowGrid <T> Windowed <T>(this IGrid <T> grid, GridRegion window)
 {
     return(new WindowGrid <T>(grid, window));
 }
 public override void FromOSD(OSDMap map)
 {
     Destination = new GridRegion();
     Destination.FromOSD((OSDMap)map["Destination"]);
     Update = new AgentPosition();
     Update.FromOSD((OSDMap)map["Update"]);
 }
示例#30
0
        internal void NextPage(PlatformGraphics pg)
        {
            this.hasMorePages = false;

            var sheet = this.CurrentWorksheet;

            if (sheet == null)
            {
                return;
            }

            // out of print areas
            if (this.CurrentRowIndex >= sheet.pageBreakRows.Count &&
                this.CurrentColIndex >= sheet.pageBreakCols.Count)
            {
                return;
            }

            int row = sheet.pageBreakRows[this.CurrentRowIndex];
            int col = sheet.pageBreakCols[this.CurrentColIndex];

            int endRow = sheet.pageBreakRows[this.CurrentRowIndex + 1];
            int endCol = sheet.pageBreakCols[this.CurrentColIndex + 1];

            switch (this.CurrentPrintSettings.PageOrder)
            {
            default:
            case PrintPageOrder.DownThenOver:
            {
                if (this.CurrentRowIndex < sheet.pageBreakRows.Count - 2)
                {
                    this.CurrentRowIndex++;

                    this.hasMorePages = true;
                }
                else
                {
                    if (this.CurrentColIndex < sheet.pageBreakCols.Count - 2)
                    {
                        this.CurrentRowIndex = 0;
                        this.CurrentColIndex++;

                        this.hasMorePages = true;
                    }
                    else
                    {
                        this.hasMorePages = false;
                    }
                }
            }
            break;

            case PrintPageOrder.OverThenDown:
            {
                if (this.CurrentColIndex < sheet.pageBreakCols.Count - 2)
                {
                    this.CurrentColIndex++;

                    this.hasMorePages = true;
                }
                else
                {
                    if (this.CurrentRowIndex < sheet.pageBreakRows.Count - 2)
                    {
                        this.CurrentColIndex = 0;
                        this.CurrentRowIndex++;

                        this.hasMorePages = true;
                    }
                    else
                    {
                        this.hasMorePages = false;
                    }
                }
            }
            break;
            }

#if WINFORM
            // Always need a fresh GDIRenderer because the cachedGraphics of the used one is disposed
            if (this.DrawingContext.Graphics is WinForm.GDIRenderer renderer)
            {
                renderer.Dispose();
            }
            this.DrawingContext.Graphics = new WinForm.GDIRenderer(pg);
#else
            if (this.DrawingContext.Graphics != null)
#endif // WINFORM
            {
                this.DrawingContext.Graphics.Reset();
            }

            var ig = this.DrawingContext.Renderer;
            ig.PlatformGraphics = pg;

#if DEBUG
            Debug.WriteLine(string.Format("print page {0,3},{1,3} - {2,3},{3,3}", row, col, endRow, endCol));
#endif // DEBUG

            GridRegion gr = new GridRegion(row, col, endRow, endCol);

            if (this.printViewportController == null)
            {
                this.printViewportController = new ViewportController(sheet);
            }
            else
            {
                this.printViewportController.worksheet = sheet;
            }

            this.PrintViewport        = new SheetViewport(this.printViewportController);
            this.PrintViewport.Bounds = this.CurrentPaperBounds;

            this.PrintViewport.VisibleRegion = gr;
            this.PrintViewport.ScaleFactor   = this.CurrentPrintSettings.PageScaling;
            this.PrintViewport.ViewStart     = new Point(sheet.cols[col].Left, sheet.rows[row].Top);
            this.PrintViewport.UpdateView();

            this.PrintViewport.Draw(this.DrawingContext);

            if (this.CurrentPrintSettings.ShowMargins)
            {
                var m = this.CurrentPaperBounds;

                var p = this.DrawingContext.Renderer.GetPen(SolidColor.Gray);

                lock (p)
                {
                    ig.DrawLine(p, m.X - 50, m.Y, m.X, m.Y);
                    ig.DrawLine(p, m.Right + 50, m.Y, m.Right, m.Y);

                    ig.DrawLine(p, m.X - 50, m.Bottom, m.X, m.Bottom);
                    ig.DrawLine(p, m.Right + 50, m.Bottom, m.Right, m.Bottom);

                    ig.DrawLine(p, m.X, m.Y - 50, m.X, m.Y);
                    ig.DrawLine(p, m.X, m.Bottom + 50, m.X, m.Bottom);

                    ig.DrawLine(p, m.Right, m.Y - 50, m.Right, m.Y);
                    ig.DrawLine(p, m.Right, m.Bottom + 50, m.Right, m.Bottom);
                }
            }

            if (!this.hasMorePages)
            {
                this.NextWorksheet();

                this.hasMorePages = this.CurrentWorksheet != null;
            }
        }
示例#31
0
        public static string GetY(this GridRegion gr, IEnvironment env)
        {
            int result = gr.RegionLocY / (int)Constants.RegionSize;

            return(result.ToString());
        }
示例#32
0
 public GridRegion(GridRegion ConvertFrom)
 {
     m_regionName = ConvertFrom.RegionName;
     RegionFlags = ConvertFrom.RegionFlags;
     m_regionLocX = ConvertFrom.RegionLocX;
     m_regionLocY = ConvertFrom.RegionLocY;
     RegionSizeX = ConvertFrom.RegionSizeX;
     RegionSizeY = ConvertFrom.RegionSizeY;
     m_internalEndPoint = ConvertFrom.InternalEndPoint;
     m_externalHostName = ConvertFrom.ExternalHostName;
     HttpPort = ConvertFrom.HttpPort;
     RegionID = ConvertFrom.RegionID;
     ServerURI = ConvertFrom.ServerURI;
     TerrainImage = ConvertFrom.TerrainImage;
     ParcelImage = ConvertFrom.ParcelImage;
     Access = ConvertFrom.Access;
     Maturity = ConvertFrom.Maturity;
     RegionSecret = ConvertFrom.RegionSecret;
     EstateOwner = ConvertFrom.EstateOwner;
 }
示例#33
0
 public GridRegion(GridRegion ConvertFrom)
 {
     m_regionName = ConvertFrom.RegionName;
     m_regionType = ConvertFrom.RegionType;
     m_regionLocX = ConvertFrom.RegionLocX;
     m_regionLocY = ConvertFrom.RegionLocY;
     m_internalEndPoint = ConvertFrom.InternalEndPoint;
     m_externalHostName = ConvertFrom.ExternalHostName;
     m_httpPort = ConvertFrom.HttpPort;
     RegionID = ConvertFrom.RegionID;
     ServerURI = ConvertFrom.ServerURI;
     TerrainImage = ConvertFrom.TerrainImage;
     TerrainMapImage = ConvertFrom.TerrainMapImage;
     Access = ConvertFrom.Access;
     Maturity = ConvertFrom.Maturity;
     RegionSecret = ConvertFrom.RegionSecret;
     EstateOwner = ConvertFrom.EstateOwner;
 }
示例#34
0
 public MapTargetChangedEventArgs(GridRegion region, int x, int y)
 {
     Region = region;
     LocalX = x;
     LocalY = y;
 }
示例#35
0
 public override IDataTransferable Duplicate()
 {
     GridRegion m = new GridRegion();
     m.FromOSD(ToOSD());
     return m;
 }
 public override void FromOSD(OSDMap map)
 {
     Destination = new GridRegion();
     Destination.FromOSD((OSDMap)map["Destination"]);
     TeleportFlags = map["TeleportFlags"];
     CircuitData = new AgentCircuitData();
     CircuitData.FromOSD((OSDMap)map["CircuitData"]);
 }
示例#37
0
 public WindowGrid(IGrid <T> baseGrid, GridRegion windowRegion)
 {
     _baseGrid     = baseGrid;
     _windowRegion = windowRegion;
 }