//SW: Koordinaten
function oCoord(x,y) {
	if(arguments.length==3) {
		var mapName= arguments[2];
		this.x= parseInt(x*refCoordSystem.width/aMaps[mapName].width);
		this.y= parseInt(y*refCoordSystem.height/aMaps[mapName].height);
	} else {
		this.x= x;
		this.y= y;
	}

	this.convertToMap= function(mapName) {
		return new oCoord( parseInt(this.x*aMaps[mapName].width/refCoordSystem.width), parseInt(this.y*aMaps[mapName]/refCoordSystem.height) );
	}
}

//SW: Gauss-Krüger Koordinaten
function oGkCoord(degree,minutes,seconds) {

	this.value= degree*3600+minutes*60+seconds;
	
	this.getDegree= function() {
		return parseInt(this.value/3600);
	}
	this.getMinutes= function() {
		return parseInt((this.value%3600)/60);
	}
	this.getSeconds= function() {
		return parseInt(this.value%60);
	}

	this.getGkCoord= function() {
		return this.getDegree()+"°"+this.getMinutes()+"'"+this.getSeconds()+"\"";
	}
}

//SW: eine Karte
function oCitymap(width, height, offsetX, offsetY, imagePrefix, imagePostfix, widthPiece, heightPiece, measureWidth, measureText) {
	this.width= width;
	this.height= height;
	this.offsetX= offsetX;
	this.offsetY= offsetY;

	this.imagePrefix= imagePrefix;
	this.imagePostfix= imagePostfix;
	this.widthPiece= widthPiece;
	this.heightPiece= heightPiece;
	
	//SW: Schnelle Lösung, muss durch Berechnung aus Koordinaten noch ersetzt werden
	this.measureWidth= measureWidth;
	this.measureText= measureText;
	
	this.getPositionInGk= function(Coord) {
		var gkCoord= new oCoord(new oGkCoord(0,0,0), new oGkCoord(0,0,0));
		gkCoord.x.value= parseInt( (Coord.x/this.width)*(refCoordSystem.gkRight.value-refCoordSystem.gkLeft.value)+refCoordSystem.gkLeft.value ); 
		gkCoord.y.value= parseInt( (Coord.y/this.height)*(refCoordSystem.gkBottom.value-refCoordSystem.gkTop.value)+refCoordSystem.gkTop.value );
		
		return gkCoord;
	}
}


