web/js/googlemap.js
// write javascript or kml for rectangle
write javascript or kml for rectangle
write javascript or kml for rectangle
function logCode6() {
    if (notext === true) return;
    if(codeID == 2) { 
        gob('coords1').value = 'var rectangle = new google.maps.Rectangle({\n'
            +'map: map,\n'
            +'fillColor: '+polygonstyles[pcur].fill+',\n'
            +'fillOpacity: '+polygonstyles[pcur].fillopac+',\n'
            +'strokeColor: '+polygonstyles[pcur].color+',\n'
            +'strokeOpacity: '+polygonstyles[pcur].lineopac+',\n'
            +'strokeWeight: '+polygonstyles[pcur].width+'\n'
            +'});\n';
        gob('coords1').value += 'var sWest = new google.maps.LatLng('+southWest.lat().toFixed(6)+','+southWest.lng().toFixed(6)+');\n'
        +'var nEast = new google.maps.LatLng('+northEast.lat().toFixed(6)+','+northEast.lng().toFixed(6)+');\n'
        +'var bounds = new google.maps.LatLngBounds(sWest,nEast);\n'
        +'rectangle.setBounds(bounds);\n';
        gob('coords1').value += '\n\\\\ Code for polyline rectangle\n';
        gob('coords1').value += 'var myCoordinates = [\n';
        gob('coords1').value += southWest.lat().toFixed(6) + ',' + southWest.lng().toFixed(6) + ',\n' +
                    southWest.lat().toFixed(6) + ',' + northEast.lng().toFixed(6) + ',\n' +
                    northEast.lat().toFixed(6) + ',' + northEast.lng().toFixed(6) + ',\n' +
                    northEast.lat().toFixed(6) + ',' + southWest.lng().toFixed(6) + ',\n' +
                    southWest.lat().toFixed(6) + ',' + southWest.lng().toFixed(6) + '\n';
        gob('coords1').value += '];\n';
        var options = 'var polyOptions = {\n'
        +'path: myCoordinates,\n'
        +'strokeColor: "'+polygonstyles[pcur].color+'",\n'
        +'strokeOpacity: '+polygonstyles[pcur].lineopac+',\n'
        +'strokeWeight: '+polygonstyles[pcur].width+'\n'
        +'}\n';
        gob('coords1').value += options;
        gob('coords1').value +='var it = new google.maps.Polyline(polyOptions);\n'
        +'it.setMap(map);\n';
        javacode = gob('coords1').value;
    }
    if(codeID == 1) { 
        var kmltext = '<Placemark><name>'+placemarks[plmcur].name+'</name>\n' +
                        '<description>'+placemarks[plmcur].desc+'</description>\n' +
                        '<styleUrl>#'+placemarks[plmcur].style+'</styleUrl>\n' +
                        '<Polygon>\n<tessellate>'+placemarks[plmcur].tess+'</tessellate>\n' +
                        '<altitudeMode>'+placemarks[plmcur].alt+'</altitudeMode>\n' +
                        '<outerBoundaryIs><LinearRing><coordinates>\n';
        kmltext += southWest.lng().toFixed(6) + ',' + southWest.lat().toFixed(6) + ',0.0 \n' +
                    southWest.lng().toFixed(6) + ',' + northEast.lat().toFixed(6) + ',0.0 \n' +
                    northEast.lng().toFixed(6) + ',' + northEast.lat().toFixed(6) + ',0.0 \n' +
                    northEast.lng().toFixed(6) + ',' + southWest.lat().toFixed(6) + ',0.0 \n' +
                    southWest.lng().toFixed(6) + ',' + southWest.lat().toFixed(6) + ',0.0 \n';
        kmltext += '</coordinates></LinearRing></outerBoundaryIs>\n</Polygon>\n</Placemark>\n';
        placemarks[plmcur].plmtext = kmlcode = kmltext;
        gob('coords1').value = kmlheading()+kmltext+kmlend();
    }
}
function logCode6 ( ) { if ( notext === true ) return ; if ( codeID == 2 ) { gob ( 'coords1' ) . value = 'var rectangle = new google.maps.Rectangle({\n' + 'map: map,\n' + 'fillColor: ' + polygonstyles [ pcur ] . fill + ',\n' + 'fillOpacity: ' + polygonstyles [ pcur ] . fillopac + ',\n' + 'strokeColor: ' + polygonstyles [ pcur ] . color + ',\n' + 'strokeOpacity: ' + polygonstyles [ pcur ] . lineopac + ',\n' + 'strokeWeight: ' + polygonstyles [ pcur ] . width + '\n' + '});\n' ; gob ( 'coords1' ) . value += 'var sWest = new google.maps.LatLng(' + southWest . lat ( ) . toFixed ( 6 ) + ',' + southWest . lng ( ) . toFixed ( 6 ) + ');\n' + 'var nEast = new google.maps.LatLng(' + northEast . lat ( ) . toFixed ( 6 ) + ',' + northEast . lng ( ) . toFixed ( 6 ) + ');\n' + 'var bounds = new google.maps.LatLngBounds(sWest,nEast);\n' + 'rectangle.setBounds(bounds);\n' ; gob ( 'coords1' ) . value += '\n\\\\ Code for polyline rectangle\n' ; gob ( 'coords1' ) . value += 'var myCoordinates = [\n' ; gob ( 'coords1' ) . value += southWest . lat ( ) . toFixed ( 6 ) + ',' + southWest . lng ( ) . toFixed ( 6 ) + ',\n' + southWest . lat ( ) . toFixed ( 6 ) + ',' + northEast . lng ( ) . toFixed ( 6 ) + ',\n' + northEast . lat ( ) . toFixed ( 6 ) + ',' + northEast . lng ( ) . toFixed ( 6 ) + ',\n' + northEast . lat ( ) . toFixed ( 6 ) + ',' + southWest . lng ( ) . toFixed ( 6 ) + ',\n' + southWest . lat ( ) . toFixed ( 6 ) + ',' + southWest . lng ( ) . toFixed ( 6 ) + '\n' ; gob ( 'coords1' ) . value += '];\n' ; var options = 'var polyOptions = {\n' + 'path: myCoordinates,\n' + 'strokeColor: "' + polygonstyles [ pcur ] . color + '",\n' + 'strokeOpacity: ' + polygonstyles [ pcur ] . lineopac + ',\n' + 'strokeWeight: ' + polygonstyles [ pcur ] . width + '\n' + '}\n' ; gob ( 'coords1' ) . value += options ; gob ( 'coords1' ) . value += 'var it = new google.maps.Polyline(polyOptions);\n' + 'it.setMap(map);\n' ; javacode = gob ( 'coords1' ) . value ; } if ( codeID == 1 ) { var kmltext = '<Placemark><name>' + placemarks [ plmcur ] . name + '</name>\n' + '<description>' + placemarks [ plmcur ] . desc + '</description>\n' + '<styleUrl>#' + placemarks [ plmcur ] . style + '</styleUrl>\n' + '<Polygon>\n<tessellate>' + placemarks [ plmcur ] . tess + '</tessellate>\n' + '<altitudeMode>' + placemarks [ plmcur ] . alt + '</altitudeMode>\n' + '<outerBoundaryIs><LinearRing><coordinates>\n' ; kmltext += southWest . lng ( ) . toFixed ( 6 ) + ',' + southWest . lat ( ) . toFixed ( 6 ) + ',0.0 \n' + southWest . lng ( ) . toFixed ( 6 ) + ',' + northEast . lat ( ) . toFixed ( 6 ) + ',0.0 \n' + northEast . lng ( ) . toFixed ( 6 ) + ',' + northEast . lat ( ) . toFixed ( 6 ) + ',0.0 \n' + northEast . lng ( ) . toFixed ( 6 ) + ',' + southWest . lat ( ) . toFixed ( 6 ) + ',0.0 \n' + southWest . lng ( ) . toFixed ( 6 ) + ',' + southWest . lat ( ) . toFixed ( 6 ) + ',0.0 \n' ; kmltext += '</coordinates></LinearRing></outerBoundaryIs>\n</Polygon>\n</Placemark>\n' ; placemarks [ plmcur ] . plmtext = kmlcode = kmltext ; gob ( 'coords1' ) . value = kmlheading ( ) + kmltext + kmlend ( ) ; } }
write javascript or kml for rectangle
write javascript or kml for rectangle
//placemarks[plmcur].style = polygonstyles[pcur].name; // javascript // kml