Giter VIP home page Giter VIP logo

mapscaleview's People

Contributors

haransis avatar jonas-haeusler avatar kptlronyttcna avatar pengrad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

mapscaleview's Issues

Simple setup scaleView with GoolgeMap, MapboxMap, etc

Client just call scaleView.initWith(map: GoogleMap) when map is ready.

This method will set all camera move listeners and pass data to scaleView.
Maybe add lifecycle param to support unregistering listeners on destroy.

The google-maps or mapbox sdks should be added as runtime dependencies, to be not included in client app.

Mapbox example

Make activity with Mapbox map in sample app
Find the way how to restrict Mapbox token

Add centimeters

Miles scale goes down to 1 foot while meters scale goes down to 1 meter.
1 foot = 0.3 meters
Therefore the meters scale should go down to 30 centimeters.

When tilt != 0

When tilt != 0 then MapScaleView shows very strange information - from 20 km to 2000 km...
Also, what about:

  • change properties dynamically
    (I know about Clark's fork but can't assign it to my build.gradle);
  • showing scale in miles/kms

Thank you! :)

Can not install, something wrong when sync gradle

Hello, thanks anyway for your repo.

Can you help me? got this error ๐Ÿ˜ข

Error:(67, 13) Failed to resolve: com.github.pengrad:mapscaleview:1.2.1
Show in File
Show in Project Structure dialog

Incorrect scaling?

I am not sure the scale is correct. See the attached screenshot showing a rural area in the US. The squares are generally roads a mile apart, but the MapScaleView is indicating the distance apart is 2 miles. Seems the scale is incorrectly reporting the distance (as seen in the upper left of the map).

screenshot_20170428-113627

Dynamic width

Hello,

Thank you for this very useful library! I quickly grabbed the code and updated it to make the view's width to be dynamic (ie it is updated when the update(...) method is called). This allows for instance to put a semi-transparent background to the MapScaleView, and to get that background's with to be updated.

Here's are the modifications I made:

Drawer.java:

    int getWidth(Scales scales) {
        return Math.round(Math.max(scales.top() == null ? 0 : scales.top().length(), scales.bottom() == null ? 0 : scales.bottom().length()) + strokePaint.getStrokeWidth());
    }

MapScaleView.java:

    private void updateScales() {
        Scale top, bottom = null;

        if (scaleType == ScaleType.MILES_ONLY) {
            top = mapScaleModel.update(false);
        } else {
            top = mapScaleModel.update(true);
            if (scaleType == ScaleType.BOTH) {
                bottom = mapScaleModel.update(false);
            }
        }

        scales = new Scales(top, bottom);
        requestLayout();
        invalidate();
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        int width = measureDimension(desiredWidth(), widthMeasureSpec);
        int height = measureDimension(desiredHeight(), heightMeasureSpec);

        mapScaleModel.setMaxWidth(width);
        drawer.setViewWidth(width);
        updateScales();

        int realWidth = drawer.getWidth(scales);

        setMeasuredDimension(realWidth, height);
    }

And here's a possible result (when I move the map, the scale bar's width is updated, including its background):

Screenshot_1580217035

Feel free to incorporate them in your code.

OSM example?

Hi, could you post a short example on how to implement this with OSM ?

mapbox example

Could add a mapbox example to this somewhere? I can't figure out how to get it to work.

Thanks

Add tests

Unit tests for model.
Is it possible/necessary to add UI tests?

Set font of ScaleView

Hello.
I needed to change the font of the scale bar. (Yeah minor stuff)
I have a pull request ready if you want to add this feature to the repo.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.