Jump to content

MiniMapGenerator.MinimapImage


Marsbar

Recommended Posts

I'm wondering if I can create my own instance of the Map that's built into WRobot. I want to manually be able to focus it to a place but I'm not sure how to add it into a window. @Droidz 
When playing around I did something like this:

MiniMapGenerator.MinimapImage map = new MiniMapGenerator.MinimapImage("Eastern Kingdoms", 200, 200, (int)npc.PositionX - 100, (int)npc.PositionX + 100, (int)npc.PositionY - 100, (int)npc.PositionY + 100);
MiniMapGenerator.LandmarkMiniMap b = new MiniMapGenerator.LandmarkMiniMap(new robotManager.Helpful.Vector3(npc.PositionX, npc.PositionY, npc.PositionZ), "1234", System.Drawing.Color.Purple);
MiniMapGenerator.LandmarksMiniMap c = new MiniMapGenerator.LandmarksMiniMap();
c.Add(b);
map.Generate();

Any ideas?

Edited by Marsbar
Link to comment
Share on other sites

Hello, I think it is more easy to use " MiniMapGenerator.PathImage", sample:

        void RefreshMap(object objs)
        {
            try
            {
                var prm =(List<double>) objs;
                double zoom = prm[0];
                double actualWidth = prm[1];
                double actualHeight = prm[2];

                lock (_lockShowMap)
                {
                    var landmarksMiniMapCache = GenerateLandmarks(zoom);

                    var image = new MiniMapGenerator.PathImage(Usefuls.ContinentNameMpq, ObjectManager.ObjectManager.Me.Position, landmarksMiniMapCache, (float)zoom);
                    image.Generate(actualWidth, actualHeight);
                    if (image.Result != null)
                    {
                        // Save img:
                        if (!string.IsNullOrWhiteSpace(_saveTo))
                        {
                            try
                            {
                                image.Result.Save(_saveTo, ImageFormat.Jpeg);

                            }
                            catch { }
                            _saveTo = "";
                        }
                        // Show img:
                        var hbmp = image.Result.GetHbitmap();
                        try
                        {
                            var ret = Imaging.CreateBitmapSourceFromHBitmap(hbmp, IntPtr.Zero, Int32Rect.Empty,
                                                                            BitmapSizeOptions.FromEmptyOptions());
                            ret.Freeze();
                            Dispatcher.Invoke(DispatcherPriority.Background, new Action(() => MapImage.Source = ret));
                            //Dispatcher.BeginInvoke(
                            //                       DispatcherPriority.Send,
                            //                       new Action(() =>  MapImage.Source = null));
                            //Dispatcher.BeginInvoke(
                            //                        DispatcherPriority.Send,
                           //                         new Action(() => MapImage.Source = ret));
                        }
                        finally
                        {
                            DeleteObject(hbmp);
                        }
                    }
                    image.Dispose();
                }
            }
            catch
            {
            }
        }

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...