/*-----------------------------------------------------------------------
User JavaScript File

version: 	4.0
author:		sebastian kupke
email:		sebastian.kupke@baral.de
website:	http://www.baral.de
-----------------------------------------------------------------------*/


/* =selectRectEnd
    Called if a selection with a rect ends
-----------------------------------------------------------------------*/
function selectRectEnd(type,geometry) {

    if (type == 'point') {
        alert('Punkt: ' + geometry.x + ' ' + geometry.y);
    } else if (type == 'rect') {
        alert('Rechteck:\nLinks unten: ' + geometry.lowerLeftPoint.x + ' ' + geometry.lowerLeftPoint.y + '\nRechts oben: ' + geometry.upperRightPoint.x + ' ' + geometry.upperRightPoint.y);
    } else {
        alert('Error!');
    }
}

/* =selectPolygonEnd
    Called if a selection with a polygon ends
-----------------------------------------------------------------------*/
function selectPolygonEnd(polygon) {

    var pointStr = '';
    
    for (var i = 0; i < polygon.points.length; i++) {
        
        pointStr += i + '. ' + polygon.points[i].x + ' ' + polygon.points[i].y + '\n';
    }
    
    alert(pointStr);
}

/* =selectCircleEnd
    Called if a selection with a circle ends after the radius is set
-----------------------------------------------------------------------*/
function selectCircleEnd(circle) {

    var center = mInterfaceSelectCircleCenter.replace(/\{0\}/,Math.round(circle.center.x)).replace(/\{1\}/,Math.round(circle.center.y));
    var radius = mInterfaceSelectCircleRadius.replace(/\{0\}/,Math.round(circle.radius));
    
    alert(center + '\n' + radius);
}











