Thread Tools Display Modes
10-02-16, 03:22 PM   #1
Joxip
A Defias Bandit
Join Date: Oct 2016
Posts: 2
How would I add a POI on the map from world location?

Hello,

I'm wondering how I would go about adding a POI on the map from a world location. Any help would be greatly appreciated as I've been struggling for quite some time with this - thanks!

Edit: The only data I have access to is map, zone, area, x, y and z.

Last edited by Joxip : 10-02-16 at 04:41 PM.
  Reply With Quote
10-02-16, 07:31 PM   #2
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
Probably the easiest way would to be to use the HereBeDragons library. It does all the heavy lifting for you.

If you are just wanting to make your own notes, try HandyNotes, which uses HBD as a backend. And you can set waypoints using TomTom, also using HBD. You can find TomTom on both Wowinterface and Curse.

Last edited by myrroddin : 10-02-16 at 07:33 PM. Reason: Need an API or something pre-built?
  Reply With Quote
10-05-16, 06:23 AM   #3
Joxip
A Defias Bandit
Join Date: Oct 2016
Posts: 2
Originally Posted by myrroddin View Post
Probably the easiest way would to be to use the HereBeDragons library. It does all the heavy lifting for you.

If you are just wanting to make your own notes, try HandyNotes, which uses HBD as a backend. And you can set waypoints using TomTom, also using HBD. You can find TomTom on both Wowinterface and Curse.
Have any idea on how it can be done without using a library? My project doesn't allow me.
  Reply With Quote
10-05-16, 11:15 AM   #4
Torhal
A Pyroguard Emberseer
 
Torhal's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 1,196
Originally Posted by Joxip View Post
Have any idea on how it can be done without using a library? My project doesn't allow me.
Your project doesn't allow you? Care to elaborate?
__________________
Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Author of NPCScan and many other AddOns.
  Reply With Quote
10-05-16, 08:46 AM   #5
Nimhfree
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 267
Are you just trying to put an icon on the world map at a specific position? If so, you can do something like:

Code:
local frame = WorldMapDetailFrame
local pin = CreateFrame("Frame", nil, frame)
pin:SetWidth(16)
pin:SetHeight(16)
pin:EnableMouse(true)
pin:SetScript("OnEnter", function(pin) self:ShowTooltip(pin) end) -- this routine you need to write
pin:SetScript("OnLeave", function() self:HideTooltip() end) -- this routine you need to write
-- You need to set the texture of the pin you want to display.  Here is an example
pin.texture:SetTexture("Interface\\MINIMAP\\ObjectIcons.blp")
pin.texture:SetTexCoord(0.125, 0.250, 0.125, 0.250)
pin.texture:SetAllPoints()
-- Make it appear at different levels in the map as desired (other icons can cover it based on what you choose)
pin:SetFrameStrata("TOOLTIP")
pin:SetFrameLevel(frame:GetFrameLevel() + 1)
pin:SetPoint("CENTER", frame, "TOPLEFT", x / 100 * frame:GetWidth(), -y / 100 * frame:GetHeight())
pin:Show()
You will only want to do this if the map being shown matches that of the map associated with the x,y.
  Reply With Quote
10-07-16, 01:28 AM   #6
Vlad
A Molten Giant
 
Vlad's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 793
There are a lot of map related quirks, and if you want a general solution, HBD would be the way to go.
__________________
Profile: Curse | Wowhead
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » How would I add a POI on the map from world location?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off