double curX2 = posX + Math.cos(angle) * dirX * step * Constants.DASHED_LINE_DENSITY; double curY2 = posY + Math.sin(angle) * dirY * step * Constants.DASHED_LINE_DENSITY;
double curX2 = posX + cos * step; double curY2 = posY + sin * step;
protected void draw(Graphics g, boolean hilited){	ViewState view = ViewState.getInstance();	int offsetX = view.getRx();	int offsetY = view.getRy();		int posX = getRx() - offsetX;	int posY = getRy() - offsetY;	int rwidth = getRwidth();	int rheight = getRheight();	if((hilited) && (!((posX > view.getViewWidth()) || (posY > view.getViewHeight())		|| ((posX + rwidth) < 0) || ((posY + rheight) < 0))))	{		g.setColor(Constants.HILITE_COLOR);		g.drawRect(posX, posY, rwidth, rheight);	}	g.setColor(getColor());	double scale = view.getScale();		posX = getRx() + (int)(Constants.CONNECTOR_WIDTH * scale / 2) - offsetX;	posY = getRy() + (int)(Constants.CONNECTOR_HEIGHT * scale / 2) - offsetY;			int posX2 = partnerVertex.getRx() + (int)(Constants.CONNECTOR_WIDTH * scale / 2) - offsetX;	int posY2 = partnerVertex.getRy() + (int)(Constants.CONNECTOR_HEIGHT * scale / 2) - offsetY;	if(partnerVertex.getHashID().compareTo(hashId) < 0)	{		if((isDashed) && ((posX != posX2) || (posY != posY2)))		{			double angle = Math.atan(((double)(Math.abs(posY2 - posY))) / Math.abs(posX2 - posX));						int dirX = (posX < posX2) ? (1) : (-1);			int dirY = (posY < posY2) ? (1) : (-1);			double curX = posX;			double curY = posY;			int step = 0;									while(((curX * dirX) <= (posX2 * dirX)) && ((curY * dirY) <= (posY2 * dirY)))			{				step++;				double curX2 = posX + Math.cos(angle) * dirX * step * Constants.DASHED_LINE_DENSITY;				double curY2 = posY + Math.sin(angle) * dirY * step * Constants.DASHED_LINE_DENSITY;								if(((curX2 * dirX) > (posX2 * dirX)) || ((curY2 * dirY) > (posY2 * dirY)))				{								curX2 = posX2;					curY2 = posY2;				}								g.drawLine((int)curX, (int)curY, (int)curX2, (int)curY2);				step++;								curX = posX + Math.cos(angle) * dirX * step * Constants.DASHED_LINE_DENSITY;				curY = posY + Math.sin(angle) * dirY * step * Constants.DASHED_LINE_DENSITY;			}		}		else			g.drawLine(posX, posY, posX2, posY2);	}	if(isArrow)	{		double angle = Math.atan(((double)(Math.abs(posY2 - posY))) / Math.abs(posX2 - posX));				int dirX = (posX < posX2) ? (1) : (-1);		int dirY = (posY < posY2) ? (1) : (-1);					int[] vertexX = new int[3];		int[] vertexY = new int[3];					vertexX[0] = posX;		vertexY[0] = posY;				double arrowSize = Constants.ARROW_SIZE * getRscale();		double lineLength = Math.sqrt((posX2 - posX) * (posX2 - posX) + (posY2 - posY) * (posY2 - posY));					if(arrowSize > lineLength / 2)			arrowSize = lineLength / 2;				vertexX[1] = (int)(posX + Math.cos(angle + Constants.ARROW_SHARPNESS) * dirX * arrowSize);		vertexY[1] = (int)(posY + Math.sin(angle + Constants.ARROW_SHARPNESS) * dirY * arrowSize);					vertexX[2] = (int)(posX + Math.cos(angle - Constants.ARROW_SHARPNESS) * dirX * arrowSize);		vertexY[2] = (int)(posY + Math.sin(angle - Constants.ARROW_SHARPNESS) * dirY * arrowSize);		g.fillPolygon(vertexX, vertexY, 3);	}}