Jump to content
This site uses cookies! Learn More

This site uses cookies!

By continuing to use this site, you agree to allow us to store cookies on your computer. :)

Marsbar

MiniMapGenerator.MinimapImage

Recommended Posts

Posted (edited)

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

Share this post


Link to post
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
            {
            }
        }

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...