Polygons |
EMAPI.Object.PolygonObject - the class of area's objects (polygons) placed on the maps in the form of layers of {EMAPI.VectorLayer} type.
Adding area:
obj.push(new EMAPI.Object.PolygonObject( { name: 'Polygon_1', label: 'Polygon 1', labelVisible: true, labelXOffset: -5, labelYOffset: -35, fontSize: 16, fontFamily: 'arial', lonLat: [ new EMAPI.LonLat(19.447817, 51.749553), new EMAPI.LonLat(19.437817, 51.749553), new EMAPI.LonLat(19.437817, 51.739553) ] })); //adding the name of the polygon 'Polygon_1'
where:
name | {String} Name of the object shown in the information window. |
label | {String} The label's object on the map. |
labelVisible | {Boolean} Information about the visibility of the object's name on the map (by default false). |
labelXOffset | {Integer} Additional horizontal label's shift with the name (by default 0). |
labelYOffset | {Integer} Additional vertical label's shift with the name (by default 15). |
fontSize | {String} The font size for the label with the name of the object on the map (by default 12px). |
fontFamily | {String} Font name for the label with the name of the object on the map (by default Courier New). |
labelVisible | {Boolean} Information about the visibility of the object's name on the map (default is false). |
lonLat | {Array(EMAPI.LonLat)} List of coordinates points of a polygon. |
An example of using:
var layer = new EMAPI.VectorLayer('warstwa 1'); //create a new layer 'layer' map.addLayer(layer); //add a layer of 'layer' to the map var obj = new Array(); //creating a new array of objects 'obj' obj.push(new EMAPI.Object.PolygonObject({name:'Polygon_1', label: 'Polygon 1', labelVisible: true, labelXOffset:-5, labelYOffset:-35, fontSize: 16, fontFamily: 'arial', lonLat:[new EMAPI.LonLat(19.447817, 51.749553), new EMAPI.LonLat(19.437817, 51.749553) , new EMAPI.LonLat(19.437817, 51.739553)]})); //adding polygon called 'Polygon_1' obj.push(new EMAPI.Object.PolygonObject({name:'Polygon_2', label: 'Polygon 2', labelVisible: true, labelXOffset:25, labelYOffset:-30, fontSize: 16, fontFamily: 'arial', lonLat:[new EMAPI.LonLat(19.469817, 51.739553), new EMAPI.LonLat(19.465817, 51.729553) , new EMAPI.LonLat(19.444817, 51.744553)]})); //adding polygon called 'Polygon_2' layer.addObjects(obj) //Adding objects from the array 'obj' to layer 'layer''