Giter Club home page Giter Club logo

polaris's Introduction

Polaris

Polaris is a framework greatly enhancing the Google Maps external framework. It aims to:

  • Make the user's life easier
  • Make the developer's life easier
  • Make the resulting map look polished and natural

Polaris Sample screenshot

Here are some interesting links you can use to discover Polaris:

  • Polaris Sample: A demo application demonstrating some features of the Polaris. It is available on the Google Play).
  • Meet Polaris, a map library for Android: A blog post I wrote to introduce the first version of the library. It contains a great description of the main features included in Polaris. You can read it on my personal blog).

Features

  • Gesture support
  • Effortless map annotating
  • Map callout variable anchor positioning
  • Built-in “user tracking” mode
  • Automatic built-in zoom controls
  • Natural map callouts transitions
  • Additional listeners
  • And many more!

Limitations

Polaris is an extension of the Google Maps External Library and hence suffers from a lot of its limitations and bugs (PolarisMapView must be used in a MapActivity, only one instance of PolarisMapView is allowed per MapActivity, etc.).

While reducing the complexity of the library, Polaris made the use of Overlay almost useless by managing main Overlays such as MyLocationOverlay and ItemizedOverlay internally. As a consequence, you must never use the getOverlays() method. PolarisMapView provides replacement methods such as addOverlay(Overlay), removeOverlay(Overlay), etc.

Usage

  1. Include the PolarisMapView widget in your layout.

    <com.cyrilmottier.polaris.PolarisMapView android:id="@+id/polaris_map_view" android:layout_height="match_parent" android:layout_width="match_parent" android:apiKey="[YOUR_API_KEY]" />

  2. In your onCreate method, add/find the PolarisMapView to your layout.

    mPolarisMapView = (PolarisMapView) findViewById(R.id.polaris_map_view)
    
  3. Bind your MapActivity's onStart and onStop method to the PolarisMapView equivalent.

    @Override protected void onStart() { super.onStart(); mPolarisMapView.onStart(); }

    @Override protected void onStop() { super.onStop(); mPolarisMapView.onStop(); }

###Including In Your Project

The Polaris library is presented as an Android library project. You can include this project by referencing it as a library project in Eclipse or ant.

###Building the sample application

Using the Google Maps external library requires registering your signing key to Google. When doing so, Google generates an API key you must pass to MapView when instanciating. For obvious reasons, you must keep these keys private.

Logically, the sample application doesn't include API keys. In order to run the project correctly you must add a LocalConfig.java file in the com.cyrilmottier.android.polarissample.util package containing your own API keys:

package com.cyrilmottier.android.polarissample.util;

public final class LocalConfig {

    private LocalConfig() {
    }

    public static final String GOOGLE_MAPS_API_KEY_RELEASE = "<YOUR_RELEASE_KEY>";
    public static final String GOOGLE_MAPS_API_KEY_DEBUG = "<YOUR_DEBUG_KEY>";

}

Developed By

Cyril Mottier - [email protected]

###Credits

License

Copyright (C) 2012 Cyril Mottier (http://www.cyrilmottier.com)

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

polaris's People

Contributors

arturdryomov avatar vernazza 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  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

polaris's Issues

android API 10 support

I have tested this library with Android API 10 support and I have an error (see bellow).
Is this library available for API 10 ?

MapCalloutView
@OverRide
public void setBackground(Drawable background) {
oopsBackgroundModified();
}

Typo in MapCalloutDrawable

Hi,

in MapCalloutDrawable.java you have method in which you are getting mLeftCapDrawable width rather than height

@Override
public int getIntrinsicHeight() {
    return Math.max(mLeftCapDrawable.getIntrinsicWidth(),
            Math.max(mBottomAnchorDrawable.getIntrinsicHeight(), mRightCapDrawable.getIntrinsicHeight()));
}

Polaris + ActionbarSherlock

How can I use this library with actionbarsherlock? i always get classnotfound when i extend SherlockMapActivity

couldn't find the way to get Polaris2&Sample "success"

@cyrilmottier
Hi,
I deployed my .m2 with links like maven-android-sdk-deploy and did all possiblities ot run the polaris2 mapv2 project.But still i am getting the following issues.Can any one please bring me to the right path in executing the polaris2 map.
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Polaris2 - parent .................................. SUCCESS [ 0.482 s]
[INFO] Polaris2 ........................................... FAILURE [ 0.399 s]
[INFO] Polaris2 - Sample .................................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.434 s
[INFO] Finished at: 2014-12-11T14:37:20+05:30
[INFO] Final Memory: 9M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project polaris2-lib: Could not resolve dependencies for project com.cyrilmottier:polaris2-lib:apklib:1.0.0: The following artifacts could not be resolved: android.support:compatibility-v4:jar:13, com.google.android.gms:google-play-services:apklib:7, com.google.android.gms:google-play-services:jar:7: Failure to find android.support:compatibility-v4:jar:13 in https://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn -rf :polaris2-lib

---If possible please provide me steps to reproduce for the working of this project.

Clearing annotation

I'm trying to use Polaris im my app. I've got problem with clearing markers.
The only thing is not working for me at the moment - clearing markers.

I'm using annotations.clear() (I'm using names from your sample).
I think there is small bug here.

annotations.clear() is only removing markers (without tooltips).

Let me show you this on some screens. This is my app. I'm showing some locations for my car (it works great).

Locations: https://dl.dropbox.com/u/6838779/Screenshot_2012-10-22-15-42-26.png

I'm trying to reload new annotations and markers for other car. It works, markers are reloaded but previous annotation is still on the screen.

See this: https://dl.dropbox.com/u/6838779/Screenshot_2012-10-22-15-39-40.png (this is view for other empty car).

Getting location of the MyLocationOverlay marker

I couldn't find a way to get the location of MyLocationOverlay marker. For the time being, I hacked this into PolarisMapView. Not sure if this is omitted on purpose but since PolarisMapView wraps MyLocationOverlay into it so I think adding this will simplify the usage a little bit. Or should we rely on LocationListener instead?

/**
 * Return current location of {@link MyLocationOverlay}.
 * @return GeoPoint or null if disabled.
 */
public GeoPoint getMyLocation(){
    if(mMyLocationOverlay != null){
        return mMyLocationOverlay.getMyLocation();
    }
    return null;
}

Double tap + drag to zoom in/out

Recently, Google Maps app added a feature that allows users to tap the map twice and drag the finger (keeping the finger on screen after the second tap) to zoom in/out. It enables users to use the map app with one hand only, since pinch-to-zoom is not a straightforward gesture to be performed when using only one hand.

Markers moving away from point while map is being dragged

How to reproduce:

  1. Zoom in towards a marker;
  2. While the new tiles are loading and you still get interpolated, scaled up tiles, move the map away from the marker you're zooming in.

This is what will happen:

http://img266.imageshack.us/img266/5526/device20121026092905.png

The blue marker was supposed to be over Los Angeles. After finish loading the tiles for that zoom level, everything is fine. This is the demo app downloaded from Google play.

dismissing calloutview and try to open it again...

I have added an Annotation object with title / subtitle to the mapview
I can click on the marker and the calloutview is correctly displayed.

The onAnnotationClicked callback is correctly called when I click on the calloutView.

In the onAnnotationClicked method, I would like to close this current calloutview.
For that, I'm using:
the calloutView.dismiss(Boolean.FALSE);

The callout is correctly closed but I need to wait several seconds before he could be displayed again...

Is it due to a wrong method call to close the callout view ?

Maven support

What about Maven? I see you don’t use it, but who knows… :-)

It would be perfect to push the library to Maven Central of course, but Polaris uses Google Maps SDK which doesn’t exist in Central, so pushing isn’t possible yet.

Wrong @Override in MapCalloutView

Hello Cyril,

I've been trying Polaris on one app of mine, and I found, when adding it to my project, that you where implementing the function setBackground overriding it from ViewGroup in the class MapCalloutView.

Eclipse recommended me to delete de @OverRide tag, because there was no such function in parent class.

I don't know why is this, if it is a bug from Polaris library, or a bug from Eclipse.

See you, and thank you!

Add Map Tap listener

It would be nice if an listener could be added that would fire on a basic Map simple tap, similar to the onTap method of the existing Overlay class.

Map callout doesn't disappear if annotation is removed

If the user clicks on an annotation a callout appears.
If the annotation is removed before than the callout has been removed (ie if the user doesn't click on the map), the callout will not disappear while clicking on the map. It will be dismissed only when the user clicks on another annotation, in which case a new callout will be displayed.

This happens frequently while using OnRegionChangedListener (or onRegionChangeConfirmed) for lazyloading:

  • the user click on an annotation
  • the user scrolls the map
  • annotations are recreated
  • an orphan callout is born.

Map recentering has a weird behavior

This happened to me with the sample app, but clearly is coming from the lib itself.

Here is how to reproduce it:

  • Open the app
  • Move the map so that the New York marker is on the far right, where you can barely see it.
  • Click on the New York marker.
  • The map scrolls all the way to the right to come back almost were it was.

I would expect it to only scroll a few pixels to the left, just to let the callout be visible.

Hard-coded overlay order

I do not consider hard-coding overlay order to be a good idea. If I add something besides annotations this something is drawn above annotation markers which generally is not desired. I had to change mOverlays.get() method to fix it. It's better to return to normal list behavior or to add an option to change predefined order.

Better support for hdpi/mdpi/ldpi/tvdpi densities

Polaris currently contains only xhdpi resources. Technically speaking, this is not really a problem because the system automatically scales the resources to fit the display density. However, system scaling can produce blurry and inaccurate which results in a not-so-polished map.

The best solution is to create resources for all of the supported densities

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.