Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to delete portals by bounds #1149

Open
iAmOren opened this issue Nov 21, 2016 · 13 comments
Open

Fails to delete portals by bounds #1149

iAmOren opened this issue Nov 21, 2016 · 13 comments

Comments

@iAmOren
Copy link

iAmOren commented Nov 21, 2016

window.Render.prototype.startRenderPass ->
window.Render.prototype.clearPortalsOutsideBounds

perhaps links and fields as well.

@dingram
Copy link
Contributor

dingram commented Dec 27, 2016

Can you please give some more information? What particular error do you see? What are you trying to do at the time? What actually fails, and what effect does it have?

@iAmOren
Copy link
Author

iAmOren commented Dec 28, 2016

accessed 'portals'.
expected portals in view.
got many portals out of view, some very far. - even for padding and "show more portals".

say i was at zoom 19 with 3 visible portals.
portals contained about 20 portals more than those 3, in neiboring countries and real far.

(perhaps it stores those for big fields and/or long links in the (very major) area?)
(didn't check lately)

so, no "particular error"

@dingram
Copy link
Contributor

dingram commented Dec 28, 2016

Ah, so you mean that the window.portals variable contains details for portals outside the visible map area? As far as I'm aware, we don't deliberately request portals outside the viewport, we just get what the Ingress servers give us. Some of these may be because they are the endpoints of links near the viewport, or vertices of fields that appear in the viewport. Also, some may be because the cells requested by IITC (which can be seen if you turn on the debug tiles layer) are larger than the viewport itself.

I can see how it would be useful to have a "get portals within viewport" function, so I will make this a feature request.

@iAmOren
Copy link
Author

iAmOren commented Dec 29, 2016

We used to get shard portals, target portals, etc.
I have already used code to filter portals on to viewport:

var bounds=map.getBounds(), portalsInBounds={};
for(var guid in portals) {
if(bounds.contains(portals[guid].getLatLng())) portalsInBounds[guid]=portals[guid];
}

(I actually use an array of guids and then access 'portals'.)

Can I get portals details of a portal that is NOT in view directly into a variable?
I'm sure I can and already dug into the code, but didn't figure it out yet.
Plus, how to check if details have already been received?
So far I've been using _portalDetails (or something similar) event/hook.

Thanks Dave!

@FesterCluck
Copy link
Contributor

I can understand why everyone is looking here. The portals, links, and fields collections appear to be our biggest bottleneck. However, there's more going on here than what appears.

The real bottleneck is how we are writing to localstorage. Since localstorage values are written as a giant string, it rewrites the whole thing over and over again every time we update the collection. Simply awful code. We need to move this to indexedDB, as such I'm going to branch and implement https://github.com/jakearchibald/idb to see how much it will help.

@iAmOren
Copy link
Author

iAmOren commented Feb 3, 2017

how can i get portal details into a js var without the need to show them on the map?
how will i know that the details are there (some flag/event)?
i'm guessing using tiles and getEntities - some more info about how they work, please!

@hayeswise
Copy link

@iAmOren Some, if not most, Ingress players would say that to stay close to the spirit of the game, you should click on the portal to get the portal details. As I understand, automating the fetching of the portal details is very risky due to the potential of putting load onto the Ingress servers that would exceed a typical human interaction. I wouldn't want you to get banned or to have IITC be put at risk.

I recommend that you get the portal details via window.addHook('portalDetailsUpdated' callBackFunction) and then do something useful with the information. Maybe you could highlight the portal when your conditions are met.

Lastly, I see the conversation has drifted from the original subject line. I recommend this issue be closed.

@iAmOren
Copy link
Author

iAmOren commented Feb 5, 2017

Well, there used to be a plugin "show more portals".
I want information on 9 (3x3) or even 25 (5x5) size of the map.
Unless there is a way to zoom out to view the area that I want and FORCE requests of all portals down to level 1/uncaptured portals (I see some are "removed out of boundaries", yet it doesn't remove properly as for the original post of this thread).

@FesterCluck
Copy link
Contributor

@iAmOren I did some testing. You are indeed correct that there is a plugin out there causing the portals out of bounds to be recreated. I haven't found the specific cause yet, but it's not caused by anything in this project. I'll contact you privately when I find the culprit, or please do the same for me if you find it first.

In my testing, it appears that something is hooking portal removed and putting it back.

@FesterCluck
Copy link
Contributor

The missions plugin should be reviewed. It's a possible source of the issue, while not doing the adding directly. It's attempting to override the deletePortalEntity, and while it does appear that it attempts to replace it, I can already tell there are going to be certain situations where this isn't going to work, and the delete behavior will be lost.

I'll update more when I've tracked down the mentioned cases.

@iAmOren
Copy link
Author

iAmOren commented Feb 13, 2017

FesterCluck, missions are not for me, so, if there is a plugin for them, I do not have it installed...
I'm using:
var bounds=map.getBounds();
for(var guid in portals) {
if(bounds.contains(portals[guid].getLatLng())) // do something with portals[guid]
}
One can delete portal if one wishes to...

@nhamer
Copy link

nhamer commented Dec 4, 2017

This isn't a bug in IITC

@iAmOren
Copy link
Author

iAmOren commented May 8, 2018

Thank you all for your valuable input!
Now I'm looking for something somewhat the opposite...
I'd like to intercept the portal-remover-if-map-moved-or-zoomed-out,
so to KEEP ALL portals in memory.
Perhaps within a set border (that I already have the code for).
This way, for example, if I look at a big city, at zoom-level 13, which "hides"(=removes) level 1 and uncaptured portals, I would still see those portals. I will probably have to zoom to zoom-level 15 and move about the city until all portals are added to window.portals, but then, when I zoom-out back to full-view of the city, I'd still see ALL portals.
Eventually, I'm sure I can figure it out, but if someone knows already [exactly?] how to do it - I'll be happy to know.
My goal is to have all 21K portals in my country, Israel, immediately visible to me at any zoom-level.
To see dense area of portals to go to - uncaptured/enemy...
I'd use the "border-checker" to remove portals of surrounding countries until I have plans to go visit them.
I apologize for the lengthy post,
and I thank you all in advance!
Oren/iAmOren. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants