Closed worthant closed 1 year ago
Guys, that is very sad, but unfortunately, webEngine do not support all the features, that i need to make this work. Placemarks from Yandex API just doesn't load and a lot of things fall apart.
Maybe, i will do the web stuff after that in 9th lab. For now, i will try to bypass this using custom icons, maybe it will still work.
1) how it shoud've look like (in the browser) 2) how i bypassed it because icons aren't showing up in webEngine
Generate icon name:
private String generateRandomIconName() {
int iconNumber = new Random().nextInt(100) + 1;
return "building_icon_" + iconNumber + ".svg";
}
Ans then, pass generated icon name to the js script:
function addCity(name, latitude, longitude, owner, iconName) {
var placemark = new ymaps.Placemark([latitude, longitude], {
hintContent: name,
balloonContent: 'Owner: ' + owner
}, {
iconLayout: 'default#image',
iconImageHref: '../icons/' + iconName, // The path to the icon depends on how your project is structured
iconImageSize: [15, 15],
iconImageOffset: [-24, -24],
iconContentLayout: MyIconContentLayout
});
myMap.geoObjects.add(placemark);
}