OpenLayers 3 Wrapper for Vaadin

That is exactly what the input projection should do. Transforms your center point from given input projection to the map projection. I’d suggest to find out the real coordinates and projections you are dealing with. What is the projection used by your map source?

-Matti

Maybe it would be more simple to just add viewChangeListener to your view and react to the extentChanged callback. That should give you the coordinates in your input projection format (EPSG426 aka wgs84)

Regards,
Matti

Hi Matti,
Thank you for fixing it.

Ahha. I thought that the extend was just to restrict the pan of the map. You’re right! Listening to changes in the extent are returning exactly the coordinates that I’m looking for.

I also found that I could fit the view to a bounding box by using:

map.view.fitExtent(new OLExtent(new OLCoordinate(box.west, box.north), new OLCoordinate(box.east, box.south)))

Perfect.

Thanks Matti.

Next challenge. How do I go about sizing an OLMap component? Whatever I do I can’t get it to do anything other than take the size according to the size of the browser window, rather than fit within the enclosing component.

Again, am I doing anything wrong here?

[code]
Layout applicationPanel = new VerticalSplitPanel();
applicationPanel.setSizeFull();
setContent(applicationPanel);

applicationPanel.firstComponent = new MyOLMap();
[/code]This sets up a split panel with the top and bottom taking 50% of the display each.

The map, in the top split, however, is not sized within the bounds of that split. When I drag the split panel separate it reveals that the map is actually full screen sized, and only the top half was showing.

I’ve tried paying around with setting the height and width on the OLMap object, but nothing appears to change the behaviour.

Is this a feature of OpenLayers? How do I go about making the map change aspect ratio as the containing component proportions change?

Thanks,
Joe

p.s. sorry for all the questions - I hope you’re not getting bored of them!

Thanks Matti,

New MapInitialize listener and approach 2 both adds the Overview map but its not loaded initially. Only when I collapse and uncollapse, it renders map in it. I haven’t tried loading on Button click as I am creating only Javascript Overview map.

I forgot to report that @Push and using UI.access did the trick perfectly. Thanks :).

Joe

Ok, sorry. It was a total school boy error. Although I was setting applicationPanel to fullSize, I wasn’t setting ‘this’ to fullSize - hence the strange layout behaviour.

Works nicely now. Sorry for the noise.

Layout applicationPanel = new VerticalSplitPanel();
applicationPanel.setSizeFull();
setContent(applicationPanel);
[b]
this.setFullSize();
[/b]

applicationPanel.firstComponent = new MyOLMap();
applicationPalen.firstComponent.setFullSize();

Have I found an OLModifyInteraction bug, or is it a feature?

If I add some features, and then set one of them to have a modification interaction on it, when I add additional features they become editable, even though I didn’t set an interaction. Is that to be expected?

vectorSource.addFeature(feature1)
vectorSource.addFeature(feature2)
map.addInteraction(new OLModifyInteraction(layer, new OLModifyInteractionOptions(), feature2))
vectorSource.addFeature(feature3)

After this, feature1 is no editable, but both feature2 and feature3 are editable. If I take a look at map.getInteractions() I don’t see any additional interactions defined, only the one on feature2.

This is with open layers 1.0.2.

Is this a known issue, or an issue with open layers itself? Is there a workaround?

Thanks,
Joe

Ahha! Found it. There is a bug, but it’s ticked by my bug. What I actually had was:

vectorSource.addFeature(feature1) vectorSource.addFeature(feature2) map.addInteraction(new OLModifyInteraction(layer, new OLModifyInteractionOptions(), feature2)) vectorSource.removeFeatureById(feature2.id) vectorSource.addFeature(feature3) i.e. I inadvertantly was removing my feature, for which there was an interaction defined. That’s what caused the error.

It’s interesting to understand what’s going on here though. So, is probably a feature, not a bug, but I would have thought that the interaction ought to have been removed by the code when the feature was… that might be a good refinement to make.

Ok, no, I was right the first time. There does appear to be a bug.

After the following interactions on a vector source:

vectorSource.addFeature(feature1)
vectorSource.addFeature(feature2)
map.addInteraction(new OLModifyInteraction(layer, new OLModifyInteractionOptions(), feature2))
vectorSource.addFeature(feature3)

I find that feature1 is not editable, and feature2 is editable. However, feature3 is also editable.

Looks like a bug/feature in OLModifyInteractionConnector.java; it’s when new features are added to the layer they are being added to the interaction, which is the wrong thing to do if the features were already restricted.

I’ll post a fix on github.

Don’t know if this is the right place to write this, but I noticed a bug in OLPoint. The methods getLongitude() and getLatitude() both return the point’s x-coordinate. Fortunately I can work around this by just using getX() and getY(), but still it would need a fix…

Hi, I have a problem I cant figure out.
I have a SplitPanel (or a Vertical/HorizontalPanel) in which I add a Map and a Combobox. Everytime i type something in the combox the map “moves down” or the margin to the top gets bigger (there even appears a scroll bar next to the map).

Here is the buildLayout method of my View:

[code]
private void buildLayout() {
OLMap olMap = new OLMap();
OLSource olsource = new OLMapQuestSource(OLMapQuestLayerName.OSM);
OLTileLayer olTileLayer = new OLTileLayer(olsource);
olMap.addLayer(olTileLayer);

OLViewOptions options=new OLViewOptions();
OLView olview=new OLView(options);
olview.setZoom(1);
olview.setCenter(0, 0);

olMap.setView(olview);

VerticalSplitPanel splitPanel = new VerticalSplitPanel();
splitPanel.setFirstComponent(olMap);
splitPanel.setSecondComponent(new ComboBox(“test”));
splitPanel.setSplitPosition(80,Unit.PERCENTAGE);

this.addComponent(splitPanel);

this.setSizeFull();
}
[/code]Maybe this is a common issue and is not related to v-ol.

I am using:
vaadin version: 7.5.10
v-ol3 verison: 1.0.3
and valo theme (if it matters).

Thanks in advance,
Andreas

Dear Matti

First, it’s really a great Add-on!!! (We’re currently using version 0.1.7 with Vaadin 7.5.5).

Now we’re testing vaadin 7.6.1 and get the following exception (full stack trace is attached):

Error sending hierarchy change eventscom.google.gwt.event.shared.UmbrellaException: Exception caught: (TypeError) : Cannot read property 'nullMethod' of null I guess it’s is because the Add-on is not compatible yet with vaadin 7.6.1??? (Or do you have an idea what the problem on “our” side could be?).

We’re using:

  • vaadin-client-7.6.1.jar
  • v-ol3-1.0.3
  • gwt-ol3-1.0.3
  • ContextMenu-4.5.0

Kind regards,
Michael
22658.txt (6.36 KB)

Hello Michael,

Thank you for letting me know. Most likely a compatibility issue with 7.6. I’ll have a look and address the issue in next version. Unfortunately I am very busy with some other projects at the moment so probably can not promise the next release before the end of this month. Is this a blocker for you?

Regards,
Matti

Thanks a lot for the fast response! If time permits it would be great otherwise we definitely have no problem to ship our product (on 5th Feb.) with vaadin 7.5!

Kind regards,
Michael

Hi, Matti!

You’ve done a great job, addon is really good. I’m interesting in one thing, could it be possible to use a static image like a map, I mean any static image, smth like here http://openlayers.org/en/v3.2.0/examples/static-image.html.

Thanks in advance.

Any thoughts on this?

Hello Ievgen,

Thank you! Currently there is no support for static image source in the add-on. Also the supported projections are the ones that are supported by proj4js. So at the moment this is not possible with the add-on. On the other hand, there is nothing that would make it impossible to implement such features. I will add issues for adding support for those in github and try to address that in a future release. Can not promise any time schedule at this point, though.

Cheers,
Matti