GithubHelp home page GithubHelp logo

dlsc-software-consulting-gmbh / gmapsfx Goto Github PK

View Code? Open in Web Editor NEW
317.0 42.0 118.0 1.55 MB

Java API for using Google Maps within a JavaFX application.

Home Page: http://rterp.github.io/GMapsFX/

License: Apache License 2.0

Java 83.05% HTML 4.28% JavaScript 12.45% CSS 0.22%
javafx javafx-application javafx-library javafx-project mapping map maps google-maps java

gmapsfx's People

Contributors

acmi avatar andredornas avatar bradh avatar dependabot[bot] avatar dlemmermann avatar geoffcapper avatar github-actions[bot] avatar harmhoog avatar jackodsteel avatar kuax avatar looqmaan avatar magomar avatar masinger avatar maurifont avatar rterp avatar selimbousbih avatar sinadarvi 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

gmapsfx's Issues

Two questions...

I've just tried out your library and it's perfect for a project I'm working on. I have two questions, though:

  1. For me, all the place names on the maps come up in Spanish. Is there an easy way to set this to maps.google.co.uk?
  2. I don't need the blank scrollpane that is displayed to the left of the map. Is there a simple way to remove this?

Thanks in advance.

GeoLocation Possibility ?

Hi,
I would like to know if this API has some geolocation services ? and if not could yu make one or show us how to use your package to make one.
By the way, Thx for this great library and the greatness it offers ^^

How to draw PolyLine on streets instead through buildings ??

Hi,

I have a startpoint and endpoint in LatLong, i want to draw path between those points but i want the path to be on streets/roads instead going through buildings/rivers. Is there any option of Polyline to do that ??
Something similar to snap to roads ?? [https://developers.google.com/maps/documentation/roads/snap#request](snap to road)

Javascript Enum

Create new entity (JavascriptEnum) to map to a enumeration in the Javascript environment.

Unable to add Polyline to a GoogleMap

I use GMapsFX 1.1.1
I try to add a Polyline to GoogleMap with this code:

LatLong ll1 = new LatLong(47.6197, -122.3231);
LatLong ll2 = new LatLong(47.6297, -122.3431);
LatLong[] ary = new LatLong[]{ll1, ll2};
MVCArray mvc = new MVCArray(ary);
PolylineOptions polyOpts = new PolylineOptions()
.path(mvc)
.strokeColor("red")
.strokeWeight(2);
Polyline poly = new Polyline(polyOpts);
map.addMapShape((MapShape) poly);

In the last line of code I get a compilation error because the polyline is not an instance of MapShape.
Where is the mistake?

setMapTypeId might not work

Needs some further testing, but I think there might be trouble with this, as I'm left with a view without tiles (but still has Google decorations) when I call setMapTypeId.

memory issue for many markers

Hello,

i need a kind of a car navigation in my java application.
The GMapsFX has every feature i need and its very simple! Great Job!

But, i have a big memory Problem

I create every seconds a new Geo-Position (Lat and Long) and send it to my MapPresenter.
An handlePositionEvent - Methods accept the new position and creteas a new Marker. I cache the previous marker

private Map<String, Marker> carMarkerMap = new HashMap<String, Marker>();
private GoogleMap map;


@Subscribe
public void handlePositionEvent(PositionEvent event) {

    if (mapIsReady) {
        Platform.runLater(new Runnable() {

            @Override
            public void run() {
                                    // creates a NEW marker
                Marker marker = createCarMarker(event.getCarName(),
                        event.getLatitude(), event.getLongitude());

                String carName = event.getCarName();

                if (carMarkerMap.containsKey(carName)) {
                    System.out.println("remove marker");
                    Marker m = carMarkerMap.get(carName);
                    map.removeMarker(m);
                    carMarkerMap.remove(carName);
                    m = null;
                }
                map.addMarker(marker);
                carMarkerMap.put(carName, marker);

            }

        });

    }

}

But i think, the Marker-Objects would not be destroy. After about 300 Markers, the application need 1 GB.

Does i make an misstake, or is it a bug?

thx

NullPointerException when resizing Stage with not initialized GoogleMap

Hello,

if I start an application with a GoogleMapView inside and without internet connection at startup and I resize the stage a NPE is thrown

java.lang.NullPointerException
    at com.lynden.gmapsfx.GoogleMapView.mapResized(GoogleMapView.java:101) ~[GMapsFX-1.1.2.jar:?]
    at com.lynden.gmapsfx.GoogleMapView.lambda$new$3(GoogleMapView.java:81) ~[GMapsFX-1.1.2.jar:?]
    at com.lynden.gmapsfx.GoogleMapView$$Lambda$576/1519827285.invalidated(Unknown Source) ~[?:?]
    at com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(ExpressionHelper.java:349) [jfxrt.jar:?]
    at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:81) [jfxrt.jar:?]
    at javafx.beans.property.ReadOnlyDoubleWrapper$ReadOnlyPropertyImpl.fireValueChangedEvent(ReadOnlyDoubleWrapper.java:177) [jfxrt.jar:?]
    at javafx.beans.property.ReadOnlyDoubleWrapper.fireValueChangedEvent(ReadOnlyDoubleWrapper.java:143) [jfxrt.jar:?]
    at javafx.beans.property.DoublePropertyBase.markInvalid(DoublePropertyBase.java:113) [jfxrt.jar:?]
    at javafx.beans.property.DoublePropertyBase.set(DoublePropertyBase.java:147) [jfxrt.jar:?]
    at javafx.scene.web.WebView.resize(WebView.java:304) [jfxrt.jar:?]
    at javafx.scene.Node.resizeRelocate(Node.java:2920) [jfxrt.jar:?]
    at javafx.scene.layout.AnchorPane.layoutChildren(AnchorPane.java:363) [jfxrt.jar:?]
...

Documentation

Create documentation on GMapsFX usage including how the framework is interacting with Javascript, and when and how Javascript objects can be created.

GoogleMap.getLatLong() obsolete?

Seems to me that com.lynden.gmapsfx.javascript.object.GoogleMap getLatLong() creates a ClassCastException and is obsolete anyway.

Javadocs

Ensure all classes and packages have Javadoc documentation.

Basic Map resoucres

Hi,

Is there a way (by code) to change the maps.html basic layout to 100% of map (instead of 75% map and 25% directions)?

Thx!

fitBounds() not implemented in maven-repository?

Hello @rterp,
I am unable to set the bounds (fitBounds) of the Gmap. When I pull your Git, there is no problem with that, but the function is not available in the maven-dependency. Is there a way so solve this?
Regards,
klemensh

Markers still visible on map after being removed

Markers that have been removed from the map instance are not removed from the display of the map (they disappear once the map has been zoomed or panned beyond the current window).

As with the previous issue raised, the Marker Options cannot be updated to allow the marker to be made invisible then removed as a workaround.

Is there a way to refresh to map to remove redundant markers?

Unable to drop more than 1 marker on Map

Only one marker appears on a map no matter how many are actually added. The following code only displays 1 marker, even though 2 are added.

    MarkerOptions markerOptions = new MarkerOptions();
    markerOptions.position( new LatLong(47.6, -122.3) )
                .visible(Boolean.TRUE)
                .title("My Marker");


    MarkerOptions markerOptions2= new MarkerOptions();

    markerOptions2.position( new LatLong(47.701, -122.3) )
                .visible(Boolean.TRUE)
                .title("My Marker2");    

Marker marker = new Marker( markerOptions );
Marker marker2 = new Marker(markerOptions2);
map.addMarker(marker);

    map.addMarker( marker2 );

java.lang.IllegalArgumentException: Image dimensions must be > 0

When panning and zooming a map I get this exception:

java.lang.IllegalArgumentException: Image dimensions must be > 0
at com.sun.prism.Image.(Unknown Source)
at com.sun.prism.Image.(Unknown Source)
at com.sun.prism.Image.fromByteBgraPreData(Unknown Source)
at com.sun.javafx.webkit.prism.RTImage.getImage(Unknown Source)
at com.sun.javafx.webkit.prism.PrismImage.getPlatformImage(Unknown Source)
at com.sun.javafx.webkit.UIClientImpl.startDrag(Unknown Source)
at com.sun.webkit.WebPage.fwkStartDrag(Unknown Source)
at com.sun.webkit.WebPage.twkProcessMouseEvent(Native Method)
at com.sun.webkit.WebPage.dispatchMouseEvent(Unknown Source)
at javafx.scene.web.WebView.processMouseEvent(Unknown Source)
at javafx.scene.web.WebView.access$2500(Unknown Source)
at javafx.scene.web.WebView$14.handle(Unknown Source)
at javafx.scene.web.WebView$14.handle(Unknown Source)
at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(Unknown Source)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown Source)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(Unknown Source)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
at com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source)
at com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)
at javafx.event.Event.fireEvent(Unknown Source)
at javafx.scene.Scene$MouseHandler.process(Unknown Source)
at javafx.scene.Scene$MouseHandler.access$1800(Unknown Source)
at javafx.scene.Scene.impl_processMouseEvent(Unknown Source)
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Unknown Source)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(Unknown Source)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(Unknown Source)
at com.sun.glass.ui.View.handleMouseEvent(Unknown Source)
at com.sun.glass.ui.View.notifyMouse(Unknown Source)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$300(Unknown Source)
at com.sun.glass.ui.win.WinApplication$4$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception in thread "JavaFX Application Thread" E

MarkerOptions icon not showing png image

There is not a lot of information on the expectation of the scope of the icon property in MarkerOptions; I am attempting to pass it a path to a PNG image in the resources but nothing is appearing when adding the marker to the map.

In the code snippet below, if the icon method is removed, then the default marker icon is displayed.

            MarkerOptions immediateMarkerOptions = new MarkerOptions();
            immediateMarkerOptions.position( latLong );

            if ( currentMode == SimulatorModes.immediate )
            {
                immediateMarkerOptions.icon( "images/MarkerGreen.png" );
            }
            else
            {
                immediateMarkerOptions.icon( "images/MarkerPin.png" );
            }

            immediateMarker = new Marker( immediateMarkerOptions );
            map.addMarker( immediateMarker );

Map repaint

Hi,
I add two different types of markers to the map. Let's say I add 10 red ones and 10 blue ones.
I have two buttons (red and blue). When I click the blue button, I hide the red markers. When I click the red button, I hide the blue markers. I use marker.setVisible().
This all works, but sometimes I get a problem.
Sometimes, I will click blue to show only the blue markers but some of the red ones are still visible. I think it is just a painting issue because if I zoom in and then zoom back out, they are gone and all is correct again.
So, is there something like map.refresh or map.repaint that I could call after I have set all the visibilities?
Thanks a lot,
Jim

Zoom and Drag Problem

Hello,
We used some code from a previous blog of yours (https://rterp.wordpress.com/2014/04/25/gmapsfx-add-google-maps-to-your-javafx-application/), but when we try to zoom by double-clicking the map, we then cannot drag the map.
Here is a picture showing what happens when we try to drag and move the map after zooming with a double click:
gmapsfx-error
That document image appears, and the map will not drag properly.
We don't see the issue when using the zoom controls.
We are using the most recent release of the jar file, and we are seeing the same issue on Mac and Windows.
Any help would be appreciated!
Thank you!

sysout's are poluting the log-files

We redirect sysout's and syserr's to logfiles.
It would be nice if no unnecessary sysout's would be printed :)

E.g.
GoogleMapView.mapResized: triggering resize event
GoogleMapView.mapResized: triggering resize event done

Using other map server

Hi,

I tried your framework, and it's really great.
Currently I'm working on a small GIS project, and I plan to use opensource Geoserver.
I download my country Shapefile from OpenStreetMap ... and deployed it into Geoserver.
My question is: Can I use my own Geoserver to serve map tile for your framework?
If not, could you please state on which class should I re-implement to be able to use my Geoserver instead of Google map?

Thanks

MarkerOptions show the same png image when multiple markers are added to the map

Hi ! In my project when the map starts I add some markers with different images, but the map shows me all the markers with the same icon.
The images are next to html inside the jar.

i have this code in the Main

@Override
    public void mapInitialized() {
        MapOptions mapOptions = new MapOptions();

        mapOptions.center(new LatLong(-37.317314,  -59.13849))
        .mapType(MapTypeIdEnum.TERRAIN)                 
        .overviewMapControl(false)
        .panControl(false)
        .rotateControl(false)                                   
        .scaleControl(false)
        .streetViewControl(false)                               
        .zoomControl(true)                                  
        .zoom(16);                                      

        map = mapView.createMap(mapOptions);

       MarkerOptions markerOptions = new MarkerOptions();
        markerOptions.position(new LatLong(-37.317430,-59.138460))
        .visible(true)
        .title("Point 1")
        .icon("images/cerrado.png");

        Marker marker = new Marker( markerOptions );
        map.addMarker(marker);

        MarkerOptions markerOptions2 = new MarkerOptions();
        markerOptions2.position(new LatLong(-37.315080,-59.143340))
        .visible(true)
        .title("Point 2")
        .icon("images/obras.png");

        Marker marker2 = new Marker( markerOptions2 );
        map.addMarker(marker2);

    }

This is the result
GoogleMap

but when i refresh the map (doing zoom) i get this

GoogleMap2

do you know if this is a bug or i 'm doing things in the wrong way?
Thanks

Undefined Return Values

Hi Rob,

I've put in some sloppy handling of return values throughout that need to be tidied up. In most cases the return value should be the class type of the primitive, so where I'm returning double it should be Double. My question is about booleans... Return false if it's null? Or should we return Boolean which will be more accurate, but introduce the need for extensive null tests throughout the code before we use any boolean value.

I'd suggest Booleans from anything that's going to be in the Javascript library as we wouldn't want to surprise end-users, but for the Google Maps stuff it's often settings, so for example if getEditable returns null, it may as well be false.

What are your thoughts?

Using Gluon to complile and deploying to an Samsung S5 Android phone.

Within the Gluon compile environment, the desktop version (Windows 10/JDK 8u66) runs very well. However when I deploy and tried running in the S5 Android phone, the JavaFX WebView displays the following: "Web Page not available, net::ERR_UNKNOWN_URL_SCHEME".

It may be that the Android JavaFX Webview treats the embedded maps.html differently from the way the Windows 10 JavaFX Webview component does.

It I instantiate JavaFX Webview and passes in a web URL, both the Windows 10 and Android environment runs identically without any issues.

Cant get custom icon to load

Hi,

Im busy with a school project but im trying to get a custom marker icon but it doesn't work.

I placed the image in rescources/html/images/marker-green.png

and i used .icon("images/spotlight-green.png")

can you help me?

Make scrollpane configurable

Currently the scrollpane is enabled by default due to the following line.

Make the scrollpane configurable at runtime via the API

Zooming on map causes UI to become unresponsive

Hi,
More of a question than an issue, library works great.
It's just when you click the zoom button a couple of time or use scroll wheel on mouse to zoom, the map crashes and UI becomes unresponsive. Exceptions being thrown are

  • java.lang.IllegalArgumentException: Texture must be non-null
  • java.lang.IllegalStateException: Operation requires resource lock

From Googling, it seems this could be an issue with the JavaFX webview itself. Although, most of the issues are closed and JavaFX say the issue has being resolved.
So I'm just wondering if you guys came across this and would have any advice on how to workaround it:)

I'm thinking I could disable the scroll wheel and try prevent user from clicking zoom button too often!! Lost to be honest, would adding these 2 vm arguments help
-Dprism.order=sw
-Xmx2048m

Updating Marker Options

A Marker object is instantiated with a MarkerOptions object; once this the Marker is instantiated, the options cannot be accessed. The options contain a visible setting that is unsettable once associated with a Marker which seems incorrect.

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.