Code Monkey home page Code Monkey logo

gwty-leaflet's Issues

Issue creating map with HTMLPanel

I have the following code.

public class MapWidget {

    Map itsMap;
    public MapWidget(HTMLPanel inHTMLPanel) {
        LatLng center = L.latLng(0, 0);
        HTMLElement mapElement = new HTMLElement();
        mapElement.innerHTML = inHTMLPanel.getElement().getInnerHTML();
        itsMap = L.map(mapElement, new MapOptions.Builder(center, 1, 1).build());
    }
    public HTMLElement getElement(){
        return itsMap.getContainer();
    }
}

I get the following error in my console.

MapWidget.java:21 Uncaught TypeError: Cannot read property 'gwidgets' of undefined

The line the it complains about is
HTMLElement mapElement = new HTMLElement();

I believe it has to use a builder to create that but looking at what is available from L class there doesn't seem to be one.

I was following what was done in the following issue #2

Any help would be greatly appreciated.

Issue initializing tile layer

Hi,
With the latest snapshot when i try to bootstrap the map i see only gray background. Then I noticed in the leaflet quick start tutorials I need to initialize tile layer which than gives javascript error saying id is not defined.
Is there any startup project that can show an actual map without gray area, for the latest leaflet version?
Thanks.

String tileUrl = "https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=XXX"; LatLng center = L.latLng(41.130076, 29.256913); Map map = L.map("map", new MapOptions.Builder(center,13,5).build()); L.tileLayer(tileUrl, new TileLayerOptions.Builder().build()).addTo(map);

Interop for some Leaflet plugins

Would it be ok to add to this project some interop files for some well known Leaflet plugin such as Leaflet.ClusterMarker and Leaflet.Draw ? Or should it be put in new separate libraries ?

Compile failure path for type 'com.gwidgets.api.client.GwtyLeaflet

I compiled gwty-leaflet to a jar file using maven and then added that jar to the build path of a simple test project that I created (with Eclipse). The project is using GWT 2.8.0.beta1 and is the standard GWT "greet". The project works fine until I add an inherits for GwtyLeaflet.

After adding an element to the app's gwt.xml file the following error is displayed at compile time...

Do you have any suggestion as to what the problem could be? The jar is on the build path, as is gwt-material-1.5.3.jar, gwt-material-addins-1.5.2.jar and gwt-material-themes-1.5.2.jar.

Finding entry point classes
Tracing compile failure path for type 'com.gwidgets.api.client.GwtyLeaflet'
Checked 0 dependencies for errors.
[ERROR] Hint: Check that the type name 'com.gwidgets.api.client.GwtyLeaflet' is really what you meant
[ERROR] Hint: Check that your classpath includes all required source roots

1.1 geometry MultiLineString, LineString

Hi,
in my geoJson string I have some MultilineString geometry. But when I am generating JsObject:
(JsObject) Global.JSON.parse(jsonString);
Something is wrong. Am I missing something? When I have Multipolygon It is ok...
Thanks

createTile in GridLayer

Hi, I noticed in GridLayer, that createTile does not yet exist. Are there any updates on this? I am new to jsinterop, would this work?

@JsFunction
public interface FunctionCreateTile {
HTMLElement createTile(coords);
}

@JsMethod
public native L createTile(FunctionCreateTile fn);

How to pass another TileLayerOptions implementation to L.tileLayer ?

I'm wondering how to use a custom TileLayerOptions with :

public static native TileLayer tileLayer(String urlTemplate, 
TileLayerOptions options);

To call this method, you have to pass an instance of TileLayerOptions. But in the leaflet docs, there is no actual object that corresponds to TileLayerOptions, it's rather an object literal.

So how do you pass for example a TileLayerWMSOption to this method ? Or any other options map for another provider.

ps : I don't know why all the JsType constructors are mostly private, but because of that, we can't extend L to add other static method, or extend TileLayerOption.

Thanks

How to get absolute position from map latLng coordinate?

Hi, I was trying to get absolute or relative pixel position from latlng coordinate using map.latLngToContainerPoint() method. But it turns out this method returns position with respect to whole large map. How am I supposed to get screen position from this?

Thanks!

How to use an htmlpanel to initialize a map

There are two APIs L.map to initialize map. One takes String id and other takes HTMLElement.
How can I use HTMLPanel widget here. I think if you can provide HTMLElement class extending JavaScriptObject then HTMLPanel::getElement can be used here.

Point is missing z (zoom)

Point is missing the z property - used in TileEvent.getCoords() - "Point object with tile's x, y, and z (zoom level) coordinates"

@JsProperty
public double z;

JSNI vs jsinterop

How come there is still some JSNI usage in gwty-leaflet/src/main/java/com/gwidgets/api/leaflet/events/Event.java ?
Does this mean there is still work to be done to fully migrate to jsinterop ?

Problem with TileLayerOptions.

When you try to use TileLayerOptions as argument 'options' of L.tileLayer method (otherwise of null)

LeafletResources.whenReady( e -> {
    MapOptions options = new MapOptions.Builder(L.latLng(52.51, 13.40), 5.0, 5.0).dragging(false).build();
    final Map map = L.map("map", options);
    TileLayerOptions tloptions = new TileLayerOptions.Builder().attribution("test").build();
    L.tileLayer("http://{s}.tile.osm.org/{z}/{x}/{y}.png", tloptions).addTo(map);
    return null;
});

this provide next JavaScript error:

Uncaught TypeError: Cannot read property 'appendChild' of undefined
    at e._initContainer (leaflet.js:6)
    at e.onAdd (leaflet.js:6)
    at e._layerAdd (leaflet.js:6)
    at e.whenReady (leaflet.js:6)
    at e.addLayer (leaflet.js:6)
    at e.addTo (leaflet.js:6)
    at ENd_g$ (Main.java:31)
    at Function.LNd_g$ (Main.java:17)
    at HTMLScriptElement.lambda_0_g$ (Runtime.java:166)

The 'null' argument work correctly

L.tileLayer("http://{s}.tile.osm.org/{z}/{x}/{y}.png", null).addTo(map);

gwty-leaflet: 0.5 and 1.0-SNAPSHOT, GWT 2.8.0 and 2.8.1

LeafletResources path

Can I recommend using GWT.getModuleBaseForStaticFiles() instead of GWT.getModuleName() in LeafletResources? In my case, my page was not the root.. eg /some/path which resulted in LeafletResources looking for /some/path/gwt_module_name/leaflet/leaflet.js.

Using GWT.getModuleBaseForStaticFiles(), LeafletResources instead looks for /gwt_module_name/leaflet/leaflet.js as expected

Native methods require a JavaScript implementation enclosed with /*-{ and }-*/

I wanted to use your library in my project where I use GWT and SmartGWT. But when I add map creation in my code I get compile errors as below. Could you tell what the problem is?

[INFO]    [ERROR] Errors in 'com/gwidgets/api/leaflet/L.java'
[INFO]       [ERROR] Line 76: Native methods require a JavaScript implementation enclosed with /*-{ and }-*/
[INFO]       [ERROR] Line 85: Native methods require a JavaScript implementation enclosed with /*-{ and }-*/
[.........]
[INFO]    [ERROR] Errors in 'com/gwidgets/api/leaflet/LatLng.java'
[INFO]       [ERROR] Line 65: Native methods require a JavaScript implementation enclosed with /*-{ and }-*/
[........]
etc.

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.