Polylines |
EMAPI.Object.PolylineObject - multiline object class (polygonal line) placed on the maps in the layers form of {EMAPI.VectorLayer} type.
Adding polygonal lines:
obj.push(new EMAPI.Object.PolylineObject( { name: 'Polygonal_line_1', label: 'Polygonal line 1', labelVisible: true, labelXOffset: -10, labelYOffset: -20, fontSize: 16, fontFamily: 'arial', fontColor:'#339933', lonLat: [ new EMAPI.LonLat(19.457817, 51.759553), new EMAPI.LonLat(19.447817, 51.749553), new EMAPI.LonLat(19.453817, 51.744553) ] })); //adding the name of polygonal line 'Polygonal line_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). |
fontColor | {String} Hexadecimal font color for the label with the name of the object on the map (by default #ff0000). |
lonLat | {Array(EMAPI.LonLat)} List of coordinates points of polygonal line. |
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.PolylineObject({name:'Polygonal_line_1', label: 'Polygonal line 1', labelVisible: true, labelXOffset:-10, labelYOffset:-20, fontSize: 16, fontFamily: 'arial', fontColor:'#339933', lonLat:[new EMAPI.LonLat(19.457817, 51.759553), new EMAPI.LonLat(19.447817, 51.749553), new EMAPI.LonLat(19.453817, 51.744553)]})); //adding the name of polygonal line 'Polygonal_line_1' obj.push(new EMAPI.Object.PolylineObject({name:'Polygonal_line_2', label: 'Polygonal linea 2', labelVisible: true, labelYOffset:-20, fontSize: 16, fontFamily: 'arial', lonLat:[new EMAPI.LonLat(19.447817, 51.737553), new EMAPI.LonLat(19.437817, 51.729553), new EMAPI.LonLat(19.444817, 51.754553), new EMAPI.LonLat(19.422817, 51.738553)], strokeColor:'#FF0000', strokeWidth:'5'})); //adding the name of polygonal line 'Polygonal_line_2' layer.addObjects(obj) //Adding objects from the array 'obj' to layer 'layer'