private void zoom(double upperLeftX2, double upperLeftY2, double utmWidth2, double utmHeight2, boolean zoomIn,
			double x1utm2, double x2utm2, double y1utm2, double y2utm2) {

		if(zoomIn) {
			if(x1utm2 > x2utm2) { //If x1 > x2 then switch
				double temp = x1utm2;
				x1utm2 = x2utm2;
				x2utm2 = temp;
			}
			if(y1utm2 > y2utm2) { //If y1 > y1 then switch
				double temp = y1utm2;
				y1utm2 = y2utm2;
				y2utm2 = temp;
			}

			if(utmWidth == 1500 || utmHeight == 1500) {
				repaint();
				return;
			}


			if(x2utm2-x1utm2 < 1500 || y2utm2-y1utm2 < 1500) { //You can't zoom more than this (1500m in either width or height)
				utmWidth = 1500;
				utmHeight = 1500;
			}

			else {
				utmWidth = x2utm2-x1utm2;
				utmHeight = y2utm2-y1utm2;
			}
			upperLeftX += x1utm2;
			upperLeftY -= y1utm2;

		}
		else {
			upperLeftX = upperLeftX2;
			upperLeftY = upperLeftY2;
			utmWidth = utmWidth2;
			utmHeight = utmHeight2;
		}


		if(utmWidth/utmHeight < preferredRatio) {
			this.utmWidth = utmHeight * preferredRatio;
		}
		else if(utmWidth/utmHeight > preferredRatio) {
			this.utmHeight = utmWidth / preferredRatio;
		}
		utmWidthRelation = utmWidth/1000;
		utmHeightRelation = utmHeight/1000;

		calculateZoomLvl();
		calculateFactor();
		//A new query with the new interval is made and all the nodes in this interval is redrawn with the new factor
		queryQT(new Interval<Double>(upperLeftX, upperLeftX+utmWidth), new Interval<Double>(upperLeftY, upperLeftY-utmHeight));
		edges = qt.getEdges();
		drawGraph(edges, width, height);
		repaint();
	}