ingress-intel-total-conversion icon indicating copy to clipboard operation
ingress-intel-total-conversion copied to clipboard

Layer count area

Open Athanasius opened this issue 4 years ago • 18 comments

Implements showing the area of selected existing fields or drawn triangles. Addresses #246

NB: Assumes a drawn polygon is a triangle and only considers the first three points. To generalise this to any polygon would be a lot more work (either splitting it up into triangles and summing them, or doing a 'line scan' different method).

Athanasius avatar Sep 12 '19 09:09 Athanasius

Please rebase your additions on master branch. And it'd be nice to include here some screenshot of plugin in work.

johnd0e avatar Sep 12 '19 10:09 johnd0e

We do not want ANY polygon, we want triangles only! So just use those polygons that have exactly 3 nodes.

MysticJay avatar Sep 12 '19 11:09 MysticJay

and only considers the first three points.

Wrong. All non-triangles should be rejected.

johnd0e avatar Sep 12 '19 15:09 johnd0e

So, show an area of 0 m^2 if a polygon had more than 3 points, or adjust the output to not even show an area string?

Keeping in mind that if there are multiple polygons at the point clicked, with some being triangles and others with 4+ points, it will still count the triangles and show their total area.

Athanasius avatar Sep 14 '19 10:09 Athanasius

I could make it explicit with s/Area/Triangles Area/ in the polygon output.

Athanasius avatar Sep 14 '19 10:09 Athanasius

I have no suggestion on this, as I never seen your plugin at work. Consider this https://github.com/IITC-CE/ingress-intel-total-conversion/pull/254#issuecomment-530770226

johnd0e avatar Sep 14 '19 10:09 johnd0e

353cac732857768da0e1e1c774bfbd4a76635e55 so we only work on triangles (and explicitly state polygon area is only for triangles) 2867a628c7e74dfc7931f493e58be553c6a93310 comments out most of the debug console.log'ing, leaving just a few in case of bugs. (Edit: I'd forgotten to commit and cited the wrong commit IDs)

Now I'll see if this will rebase cleanly on master.

Athanasius avatar Sep 14 '19 10:09 Athanasius

That's it rebased on master, but now it doesn't work because master doesn't work on Firefox 69.0 on Linux. That's why I was basing this on test-builds in the first place. See #247

Athanasius avatar Sep 14 '19 10:09 Athanasius

So, if you want to check this you'll need to use https://github.com/Athanasius/iitc-ce_ingress-intel-total-conversion/pull/new/layer-count-area_test-builds

Athanasius avatar Sep 14 '19 10:09 Athanasius

Working on some screenshots now.

Athanasius avatar Sep 14 '19 10:09 Athanasius

That's it rebased on master, but now it doesn't work

To make it work can cherry-pick this commit https://github.com/johnd0e/ingress-intel-total-conversion/commit/55c52bcbf2f57a2d201443033379f748ea4463f0

johnd0e avatar Sep 14 '19 10:09 johnd0e

Working on some screenshots now.

https://miggy.org/games/ingress/IITC/layer-count-area/

Hopefully the filenames are self-explanatory. Yes, the red squares and arrows were "added in post" and aren't part of the changes. They're there just to make it clear where I clicked (cursor wouldn't capture) for each output.

Athanasius avatar Sep 14 '19 11:09 Athanasius

That's it rebased on master, but now it doesn't work

To make it work can cherry-pick this commit johnd0e@55c52bc

Confirmed working with this commit, but I assume I shouldn't push that into my branch for this PR.

Athanasius avatar Sep 14 '19 11:09 Athanasius

Why not. It will merge clean.

johnd0e avatar Sep 14 '19 11:09 johnd0e

Why not. It will merge clean.

Done.

Athanasius avatar Sep 14 '19 11:09 Athanasius

No, that will not merge clean. You should first cherry-pick https://github.com/johnd0e/ingress-intel-total-conversion/commit/55c52bcbf2f57a2d201443033379f748ea4463f0, than rebase your changes on top of it.

johnd0e avatar Sep 14 '19 11:09 johnd0e

No, that will not merge clean. You should first cherry-pick johnd0e@55c52bc, than rebase your changes on top of it.

Now acceptable ?

Athanasius avatar Sep 14 '19 11:09 Athanasius

Now we are at least able to review the PR. (I cannot give any forward promise that we accept it)

johnd0e avatar Sep 14 '19 11:09 johnd0e