Comments (5)
Hey @brenton-crowley,
As regards the documentation of the signature of define bounds, the signature is defineRelativeBounds(double left, double top, double right, double bottom)
, which calls PositionManager's public void setBounds( double l, double t, double r, double b )
- my "eg" in the documentation is incorrect - I'll remove next time.
As far as positioning, it's actually pretty basic, and not at all based on geolocation. It just uses a relative point. If you define bounds between 0 and 1, then use a positioning method and pass a value of 0.4, the pixel returned would be 40% of the total axis (width or height, depending on if the 0.4 was for X or Y). So if you define the bounds with latitudes of 45.1250 through 45.6725, it would calculate that 45.39875 would be the vertical halfway point. I suspect that true geolocation wouldn't be as simple, and that the curve of the planet's surface would need to considered, but I think only rarely would this have a visible effect.
The class that does the position translation is PositionManager, and the signature is translate
- here's what's actually happening.
The demo is kind of cobbled together from a (very) old version of this widget (2 years?) that did use Boston coordinates, but I could very well have changed them for debugging purposes, or tweaked the corner coordinates, etc. As I said, the positioning methods just take the relative point you supply and multiply that against the dimensions you supply to come back with a pixel position - there's no actual geolocation happening. The original widget did use lat/lng, and the basic relative positioning approach used by TileView, and it was at least close enough so that the markers did line up visually.
I suppose it's possible there's some bad math laying around in there - now that you understand what's happening with positioning, feel free to post back if you discover a problem.
HTH, and thanks for the input.
Mike
from tileview.
Hi @moagrius,
I looked a little more beneath the hood and it turns out we are using the same positioning logic (relating to the iOS version I created).
I have identified the problem, and having identified it, the existing documentation now makes much more sense.
The relative position logic translates to x, y positions. This is fine in normal circumstances, but in relation to coordinates things get a little more funky. The conventional way to refer to coordinates is the form:
coordinate(latitude, longitude);
but in a screen environment latitude values correspond to y-values and longitude to x-values. If I were to follow the original documentation and define my bounds as such:
defineRelativeBounds(long, lat, long, lat);
then wherever I add a marker it must also follow this same convention.
addMarker(longitude, latitude);
In the examples provided, the inputted are around the wrong way (lat, long). I will continue with your existing implementation, but perhaps you could update the demo and docs to notify the developer that coordinates should be in the form of (long, lat).
Or perhaps a convenience method could be inserted for adding a marker at a coordinate, and then the tileView can take care of switching the values around. Ultimately, it should reflect the same pattern as the defineRelativeBounds().
tileView.addMarkerAtCoordinate(view, lat, long);
I hope that I made some sense :)
from tileview.
I had hoped to remove all notion of convention when switching from "faux-geolocation" to "relative positioning", and not making any mention of lat/lng, but I agree that you're right, what few references remain are more confusing and should be removed from the documentation. I'll leave this issue open until I get a chance to do that.
from tileview.
Great. Thanks for the clarification.
from tileview.
docs have been updated to remove inconsistent references. thanks for contributing. closing issue now.
from tileview.
Related Issues (20)
- Remote tile demo freezes and crashes HOT 2
- Combine smooth scroll and scale HOT 2
- Tiles not properly laid out when Scale < 1 with remote tiles HOT 15
- Open source but no license? HOT 2
- Markers disappear when zooming HOT 4
- Cannot add tile images on the fly HOT 1
- StreamProvider asked to provide data for rows and columns out of bounds with to small images HOT 5
- Tiles outside the image are created HOT 8
- White text on white background in Advanved Tile Demo HOT 1
- Get touched position when touch on the tileview (version 4.0.7)
- longtouch
- App killed in background crashes when returning to foreground HOT 1
- `android.os.BadParcelableException` regarding `com.moagrius.widget.ScrollView$SavedState.<init>` HOT 1
- Use in viewholder for recycler view. HOT 2
- build() method starts to return void instead of TileView HOT 1
- Mike passed away HOT 5
- Does this lib support SVG format
- JCenter -> MavenCenter
- implementation 'com.qozix:tileview:2.7.7' doesn't seem to work HOT 1
- Impossible import com.qozix.tileview HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tileview.