我在使用地图传递价值方面存在问题。代码创建一个多边形,并测量面积(以mq为单位)和距离(以mt为单位)。 代码javascript:
function on_click_function(location_passed){
click_polygon.setMap(null); // clears click_polygon from map
click_line.setMap(null); // clears click_line from map
points_array.push(location_passed); // push clicked lat lng into points array
if (document.getElementById("polygon_mode").checked){ // create (or recreate) the click_polygon object
create_polygon();
click_polygon.setMap(my_map);
}
if (document.getElementById("line_mode").checked){ // create or recreate the click_line
create_line();
click_line.setMap(my_map);
}
clear_markers();
rewrite_markers();
calculate_dimensions_and_display();
}// end on_click_function
和html代码:
<table id = "output_table">
<tr>
<td><input type="radio" name="draw_mode" id = "line_mode" onclick = "mode_was_changed();" checked = "checked"/> Ora seleziona i vertici del tetto
</td>
<td><input type="radio" name="draw_mode" id = "polygon_mode" onclick = "mode_was_changed();" /> <!-- checked = "checked" --> Calcola l'area del tuo tetto
</td>
<td>Dimensioni: <span id="area"> </span>
</td>
<td>Area: <span id="area"> </span>
</td>
网址为:app.tettosano.com/calculator.php
用户单击单选按钮以显示或区域或周边。但是,我想要用户在绘制多边形时,它可以在两个不同的框中同时显示区域和周边,但是同时。
我该如何解决这个问题?
此致
的Alessandro