I want to get a specific object from a group, for example I have the following objects:
var circleGroup = new H.map.Group({
volatility: true,
objects: [theCircle, circleOutline]
});
this._circle = circleGroup;
And I want to get the value of the object "theCircle", I'm using the below code to get the value of the object "theCircle" but it does not work.
_circle.getObjects()[0];
This is how you can create H.map.Group of objects and you are right about the method to access specific object by calling _circle.getObjects()[0];
Creating H.map.Group
circleGroup = new H.map.Group({
volatility: true
});
// put all objects into one group
circleGroup.addObjects([circle, polygon, rect, polyline]);
I have modified the example in the below link that implements H.map.Group https://developer.here.com/documentation/examples/maps-js/geoshapes/draggable-shapes
Working Example: https://jsfiddle.net/raj0665/q7agonfb/7/
In this example:
// place group with all objects on the map
map.addObject(draggableGroup);
//To access just circle on the map, comment above line and uncomment below code of line
// map.addObject(_draggableGroup.getObjects()[0]);