[sonar] fix sonar plm
This commit is contained in:
@@ -86,8 +86,8 @@ public class LaneMarkTools {
|
||||
{
|
||||
Panel_Image_Scale = scale;
|
||||
|
||||
PANEL_IMAGE_WIDTH = (int) (screenWidth/4 * Panel_Image_Scale);
|
||||
PANEL_IMAGE_HEIGHT = (int) (screenHeight/3 * Panel_Image_Scale);
|
||||
PANEL_IMAGE_WIDTH = (int) (screenWidth/4.0 * Panel_Image_Scale);
|
||||
PANEL_IMAGE_HEIGHT = (int) (screenHeight/3.0 * Panel_Image_Scale);
|
||||
LANE_PANELBORDER_MARGIN = (int) (5 * Panel_Image_Scale);
|
||||
LANE_PANELBORDER_RADIAN = (int) (10 * Panel_Image_Scale);
|
||||
|
||||
@@ -154,12 +154,12 @@ public class LaneMarkTools {
|
||||
paint.setColor(Color.GREEN);
|
||||
paint.setAntiAlias(true);
|
||||
Path path = new Path();
|
||||
path.moveTo(ARROW_IMAGE_WIDTH / 2, 0);
|
||||
path.lineTo(ARROW_IMAGE_WIDTH, ARROW_IMAGE_HEIGHT / 2);
|
||||
path.lineTo(ARROW_IMAGE_WIDTH, ARROW_IMAGE_HEIGHT / 2 + ARROW_THICKNESS);
|
||||
path.lineTo(ARROW_IMAGE_WIDTH / 2, ARROW_THICKNESS);
|
||||
path.lineTo(0, ARROW_IMAGE_HEIGHT / 2 + ARROW_THICKNESS);
|
||||
path.lineTo(0, ARROW_IMAGE_HEIGHT / 2);
|
||||
path.moveTo(ARROW_IMAGE_WIDTH / 2.0f, 0);
|
||||
path.lineTo(ARROW_IMAGE_WIDTH, ARROW_IMAGE_HEIGHT / 2.0f);
|
||||
path.lineTo(ARROW_IMAGE_WIDTH, ARROW_IMAGE_HEIGHT / 2.0f + ARROW_THICKNESS);
|
||||
path.lineTo(ARROW_IMAGE_WIDTH / 2.0f, ARROW_THICKNESS);
|
||||
path.lineTo(0, ARROW_IMAGE_HEIGHT / 2.0f + ARROW_THICKNESS);
|
||||
path.lineTo(0, ARROW_IMAGE_HEIGHT / 2.0f);
|
||||
path.close();
|
||||
canvas.drawPath(path, paint);
|
||||
BitmapInfo info = new BitmapInfo();
|
||||
@@ -186,7 +186,7 @@ public class LaneMarkTools {
|
||||
paint.setColor(Color.GREEN);
|
||||
paint.setAntiAlias(true);
|
||||
Path path = new Path();
|
||||
path.moveTo(TRIANGLE_IMAGE_WIDTH / 2, 0);
|
||||
path.moveTo(TRIANGLE_IMAGE_WIDTH / 2.0f, 0);
|
||||
path.lineTo(TRIANGLE_IMAGE_WIDTH, TRIANGLE_IMAGE_HEIGHT);
|
||||
path.lineTo(0, TRIANGLE_IMAGE_HEIGHT);
|
||||
path.close();
|
||||
@@ -289,8 +289,8 @@ public class LaneMarkTools {
|
||||
paint.setStyle(Style.STROKE);
|
||||
paint.setStrokeWidth(ARC_GOTO_SECTION_WIDTH);
|
||||
paint.setAntiAlias(true);
|
||||
float arcGotoSectionPositionX = (LANE_WIDTH - ARC_RADIUS * 2) / 2;
|
||||
float arcGotoSectionPositionY = LANE_HEIGHT / 3;
|
||||
float arcGotoSectionPositionX = (LANE_WIDTH - ARC_RADIUS * 2.0f) / 2.0f;
|
||||
float arcGotoSectionPositionY = LANE_HEIGHT / 3.0f;
|
||||
canvas.drawLine(arcGotoSectionPositionX, arcGotoSectionPositionY,
|
||||
arcGotoSectionPositionX, arcGotoSectionPositionY + ARC_INTO_SECTION_HEIGHT,
|
||||
paint);
|
||||
@@ -320,14 +320,14 @@ public class LaneMarkTools {
|
||||
paint.setStrokeWidth(ARC_GOTO_SECTION_WIDTH);
|
||||
paint.setAntiAlias(true);
|
||||
|
||||
float arcGotoSectionPositionX = (LANE_WIDTH - ARC_RADIUS * 2) / 2;
|
||||
float arcGotoSectionPositionY = LANE_HEIGHT / 3;
|
||||
float arcGotoSectionPositionX = (LANE_WIDTH - ARC_RADIUS * 2.0f) / 2.0f;
|
||||
float arcGotoSectionPositionY = LANE_HEIGHT / 3.0f;
|
||||
canvas.drawLine(arcGotoSectionPositionX, arcGotoSectionPositionY,
|
||||
arcGotoSectionPositionX, arcGotoSectionPositionY + ARC_GOTO_SECTION_HEIGHT,
|
||||
paint);
|
||||
|
||||
float arcIntoSectionPositionX = arcGotoSectionPositionX + ARC_RADIUS * 2;
|
||||
float arcIntoSectionPositionY = LANE_HEIGHT / 3;
|
||||
float arcIntoSectionPositionY = LANE_HEIGHT / 3.0f;
|
||||
canvas.drawLine(arcIntoSectionPositionX, arcIntoSectionPositionY,
|
||||
arcIntoSectionPositionX, arcIntoSectionPositionY + ARC_INTO_SECTION_HEIGHT,
|
||||
paint);
|
||||
@@ -348,7 +348,7 @@ public class LaneMarkTools {
|
||||
canvas.save();
|
||||
canvas.translate(translationX, translationY);
|
||||
canvas.rotate(180);
|
||||
canvas.drawBitmap(arrowImage, -(arrowImage.getWidth() / 2),0, paint);
|
||||
canvas.drawBitmap(arrowImage, -(arrowImage.getWidth() / 2.0f),0, paint);
|
||||
canvas.restore();
|
||||
|
||||
BitmapInfo info = new BitmapInfo();
|
||||
@@ -378,7 +378,7 @@ public class LaneMarkTools {
|
||||
paint.setStrokeWidth(STRAIGHT_SECTION_WIDTH);
|
||||
paint.setAntiAlias(true);
|
||||
|
||||
Bitmap arrowImage = getRenderArrowImage(isW == AHEAD_BIT_MASK ? false : true).bitmap;
|
||||
Bitmap arrowImage = getRenderArrowImage(isW != AHEAD_BIT_MASK).bitmap;
|
||||
int arrowPositionX = (LANE_WIDTH - arrowImage.getWidth()) / 2;
|
||||
int arrowPositionY = (LANE_HEIGHT - ARROW_THICKNESS - STRAIGHT_SECTION_HEIGHT) / 2;
|
||||
canvas.drawBitmap(arrowImage, arrowPositionX, arrowPositionY, paint);
|
||||
@@ -429,13 +429,13 @@ public class LaneMarkTools {
|
||||
|
||||
canvas.drawPath(path, paint);
|
||||
|
||||
Bitmap arrowImage = getRenderArrowImage(isW == LEFT_TWO_BIT_MASK ? false : true).bitmap;
|
||||
Bitmap arrowImage = getRenderArrowImage(isW != LEFT_TWO_BIT_MASK).bitmap;
|
||||
int translationX = endX - ARROW_THICKNESS;
|
||||
int translationY = endY;
|
||||
canvas.save();
|
||||
canvas.translate(translationX, translationY);
|
||||
canvas.rotate(-90);
|
||||
canvas.drawBitmap(arrowImage, -(arrowImage.getWidth() / 2), 0, paint);
|
||||
canvas.drawBitmap(arrowImage, -(arrowImage.getWidth() / 2.0f), 0, paint);
|
||||
canvas.restore();
|
||||
|
||||
BitmapInfo info = new BitmapInfo();
|
||||
@@ -479,13 +479,13 @@ public class LaneMarkTools {
|
||||
|
||||
canvas.drawPath(path, paint);
|
||||
|
||||
Bitmap arrowImage = getRenderArrowImage(isW == RIGHT_TWO_BIT_MASK ? false : true).bitmap;
|
||||
Bitmap arrowImage = getRenderArrowImage(isW != RIGHT_TWO_BIT_MASK).bitmap;
|
||||
int translationX = endX + ARROW_THICKNESS;
|
||||
int translationY = endY;
|
||||
canvas.save();
|
||||
canvas.translate(translationX, translationY);
|
||||
canvas.rotate(90);
|
||||
canvas.drawBitmap(arrowImage, -(arrowImage.getWidth() / 2), 0, paint);
|
||||
canvas.drawBitmap(arrowImage, -(arrowImage.getWidth() / 2.0f), 0, paint);
|
||||
canvas.restore();
|
||||
|
||||
BitmapInfo info = new BitmapInfo();
|
||||
@@ -707,8 +707,8 @@ public class LaneMarkTools {
|
||||
paint.setStrokeWidth(RIGHT_TURN_VERTICAL_SECTION_WIDTH);
|
||||
paint.setAntiAlias(true);
|
||||
|
||||
float startX = LANE_WIDTH / 3;
|
||||
float startY = LANE_HEIGHT - LANE_HEIGHT / 4;
|
||||
float startX = LANE_WIDTH / 3.0f;
|
||||
float startY = LANE_HEIGHT - LANE_HEIGHT / 4.0f;
|
||||
float endX = startX;
|
||||
float endY = startY - RIGHT_TURN_VERTICAL_SECTION_HEIGHT;
|
||||
|
||||
@@ -717,20 +717,20 @@ public class LaneMarkTools {
|
||||
paint.setStyle(Style.FILL);
|
||||
|
||||
Path path = new Path();
|
||||
path.moveTo(endX - RIGHT_TURN_VERTICAL_SECTION_WIDTH / 2, endY);
|
||||
path.lineTo(endX - RIGHT_TURN_VERTICAL_SECTION_WIDTH / 2, endY + RIGHT_FRONT_TURN_SLOPE_THICKNESS);
|
||||
path.lineTo(endX - RIGHT_TURN_VERTICAL_SECTION_WIDTH / 2 + RIGHT_FRONT_TURN_SLOPE_WIDTH, endY);
|
||||
path.lineTo(endX - RIGHT_TURN_VERTICAL_SECTION_WIDTH / 2 + RIGHT_FRONT_TURN_SLOPE_WIDTH, endY - RIGHT_FRONT_TURN_SLOPE_THICKNESS);
|
||||
path.moveTo(endX - RIGHT_TURN_VERTICAL_SECTION_WIDTH / 2.0f, endY);
|
||||
path.lineTo(endX - RIGHT_TURN_VERTICAL_SECTION_WIDTH / 2.0f, endY + RIGHT_FRONT_TURN_SLOPE_THICKNESS);
|
||||
path.lineTo(endX - RIGHT_TURN_VERTICAL_SECTION_WIDTH / 2.0f + RIGHT_FRONT_TURN_SLOPE_WIDTH, endY);
|
||||
path.lineTo(endX - RIGHT_TURN_VERTICAL_SECTION_WIDTH / 2.0f + RIGHT_FRONT_TURN_SLOPE_WIDTH, endY - RIGHT_FRONT_TURN_SLOPE_THICKNESS);
|
||||
|
||||
canvas.drawPath(path, paint);
|
||||
|
||||
Bitmap triangleImage = getRenderTriangleImage(isW).bitmap;
|
||||
float translationX = endX - RIGHT_TURN_VERTICAL_SECTION_WIDTH / 2 + RIGHT_FRONT_TURN_SLOPE_WIDTH + TRIANGLE_IMAGE_HEIGHT;
|
||||
float translationY = endY - RIGHT_FRONT_TURN_SLOPE_THICKNESS / 2;
|
||||
float translationX = endX - RIGHT_TURN_VERTICAL_SECTION_WIDTH / 2.0f + RIGHT_FRONT_TURN_SLOPE_WIDTH + TRIANGLE_IMAGE_HEIGHT;
|
||||
float translationY = endY - RIGHT_FRONT_TURN_SLOPE_THICKNESS / 2.0f;
|
||||
canvas.save();
|
||||
canvas.translate(translationX, translationY);
|
||||
canvas.rotate(90);
|
||||
canvas.drawBitmap(triangleImage, -(triangleImage.getWidth() / 2), 0, paint);
|
||||
canvas.drawBitmap(triangleImage, -(triangleImage.getWidth() / 2.0f), 0, paint);
|
||||
canvas.restore();
|
||||
|
||||
BitmapInfo info = new BitmapInfo();
|
||||
@@ -769,10 +769,10 @@ public class LaneMarkTools {
|
||||
paint.setStyle(Style.FILL);
|
||||
|
||||
Path path = new Path();
|
||||
path.moveTo(endX + LEFT_TURN_VERTICAL_SECTION_WIDTH / 2, endY);
|
||||
path.lineTo(endX + LEFT_TURN_VERTICAL_SECTION_WIDTH / 2, endY + LEFT_FRONT_TURN_SLOPE_THICKNESS);
|
||||
path.lineTo(endX + LEFT_TURN_VERTICAL_SECTION_WIDTH / 2 - LEFT_FRONT_TURN_SLOPE_WIDTH, endY);
|
||||
path.lineTo(endX + LEFT_TURN_VERTICAL_SECTION_WIDTH / 2 - LEFT_FRONT_TURN_SLOPE_WIDTH, endY - LEFT_FRONT_TURN_SLOPE_THICKNESS);
|
||||
path.moveTo(endX + LEFT_TURN_VERTICAL_SECTION_WIDTH / 2.0f, endY);
|
||||
path.lineTo(endX + LEFT_TURN_VERTICAL_SECTION_WIDTH / 2.0f, endY + LEFT_FRONT_TURN_SLOPE_THICKNESS);
|
||||
path.lineTo(endX + LEFT_TURN_VERTICAL_SECTION_WIDTH / 2.0f - LEFT_FRONT_TURN_SLOPE_WIDTH, endY);
|
||||
path.lineTo(endX + LEFT_TURN_VERTICAL_SECTION_WIDTH / 2.0f - LEFT_FRONT_TURN_SLOPE_WIDTH, endY - LEFT_FRONT_TURN_SLOPE_THICKNESS);
|
||||
|
||||
canvas.drawPath(path, paint);
|
||||
|
||||
@@ -782,7 +782,7 @@ public class LaneMarkTools {
|
||||
canvas.save();
|
||||
canvas.translate(translationX, translationY);
|
||||
canvas.rotate(-90);
|
||||
canvas.drawBitmap(triangleImage, -(triangleImage.getWidth() / 2), 0, paint);
|
||||
canvas.drawBitmap(triangleImage, -(triangleImage.getWidth() / 2.0f), 0, paint);
|
||||
canvas.restore();
|
||||
BitmapInfo info = new BitmapInfo();
|
||||
info.bitmap = bitmap;
|
||||
@@ -807,8 +807,8 @@ public class LaneMarkTools {
|
||||
paint.setStrokeWidth(LEFT_TURN_VERTICAL_SECTION_WIDTH);
|
||||
paint.setAntiAlias(true);
|
||||
|
||||
Bitmap leftFrontTurnLaneArrow = getRenderLeftFrontTurnLaneArrow(isW == LEFT_TWO_BIT_MASK?false : true).bitmap;
|
||||
Bitmap UTurnLaneArrow = getRenderUTurnLaneArrow(isW == UTURN_BIT_MASK?false : true).bitmap;
|
||||
Bitmap leftFrontTurnLaneArrow = getRenderLeftFrontTurnLaneArrow(isW != LEFT_TWO_BIT_MASK).bitmap;
|
||||
Bitmap UTurnLaneArrow = getRenderUTurnLaneArrow(isW != UTURN_BIT_MASK).bitmap;
|
||||
|
||||
int translationX = 0;
|
||||
int translationY = LANE_HEIGHT / 4;
|
||||
@@ -864,8 +864,8 @@ public class LaneMarkTools {
|
||||
|
||||
Bitmap bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888);
|
||||
Canvas canvas = new Canvas(bitmap);
|
||||
Bitmap UTurnLaneArrow = getRenderUTurnLaneArrow(isW == UTURN_BIT_MASK ? false : true).bitmap;
|
||||
Bitmap rightFrontTurnLaneArrow = getRenderRightFrontTurnLaneArrow(isW == RIGHT_TWO_BIT_MASK ? false : true).bitmap;
|
||||
Bitmap UTurnLaneArrow = getRenderUTurnLaneArrow(isW != UTURN_BIT_MASK).bitmap;
|
||||
Bitmap rightFrontTurnLaneArrow = getRenderRightFrontTurnLaneArrow(isW != RIGHT_TWO_BIT_MASK).bitmap;
|
||||
Paint paint = new Paint();
|
||||
paint.setColor(Color.WHITE);
|
||||
paint.setStyle(Style.STROKE);
|
||||
@@ -873,7 +873,7 @@ public class LaneMarkTools {
|
||||
paint.setAntiAlias(true);
|
||||
|
||||
float translationX = -ARC_RADIUS;
|
||||
float translationY = LANE_HEIGHT / 4;
|
||||
float translationY = LANE_HEIGHT / 4.0f;
|
||||
canvas.save();
|
||||
if(isW != UTURN_BIT_MASK)
|
||||
{
|
||||
@@ -884,8 +884,8 @@ public class LaneMarkTools {
|
||||
|
||||
if(isW != RIGHT_TWO_BIT_MASK)
|
||||
{
|
||||
translationX = RIGHT_FRONT_TURN_SLOPE_WIDTH / 2;
|
||||
translationY = -(LANE_HEIGHT / 8);
|
||||
translationX = RIGHT_FRONT_TURN_SLOPE_WIDTH / 2.0f;
|
||||
translationY = -(LANE_HEIGHT / 8.0f);
|
||||
canvas.translate(translationX, translationY);
|
||||
canvas.drawBitmap(rightFrontTurnLaneArrow, 0, 0, paint);
|
||||
canvas.translate(-translationX, -translationY);
|
||||
@@ -894,15 +894,15 @@ public class LaneMarkTools {
|
||||
if(isW == UTURN_BIT_MASK)
|
||||
{
|
||||
translationX = -ARC_RADIUS;
|
||||
translationY = LANE_HEIGHT / 4;
|
||||
translationY = LANE_HEIGHT / 4.0f;
|
||||
canvas.translate(translationX, translationY);
|
||||
canvas.drawBitmap(UTurnLaneArrow, 0, 0, paint);
|
||||
canvas.translate(-translationX, -translationY);
|
||||
}
|
||||
else if(isW == RIGHT_TWO_BIT_MASK)
|
||||
{
|
||||
translationX = RIGHT_FRONT_TURN_SLOPE_WIDTH / 2;
|
||||
translationY = -(LANE_HEIGHT / 8);
|
||||
translationX = RIGHT_FRONT_TURN_SLOPE_WIDTH / 2.0f;
|
||||
translationY = -(LANE_HEIGHT / 8.0f);
|
||||
canvas.translate(translationX, translationY);
|
||||
canvas.drawBitmap(rightFrontTurnLaneArrow, 0, 0, paint);
|
||||
canvas.translate(-translationX, -translationY);
|
||||
@@ -934,8 +934,8 @@ public class LaneMarkTools {
|
||||
paint.setAntiAlias(true);
|
||||
|
||||
Bitmap straightLaneArrow = getRenderStraightLaneArrow(isW).bitmap;
|
||||
Bitmap leftFrontTurnArrow = getRenderLeftFrontTurnLaneArrow(isW == LEFT_TWO_BIT_MASK ? false : true).bitmap;
|
||||
Bitmap RightFrontTurnArrow = getRenderRightFrontTurnLaneArrow(isW == RIGHT_TWO_BIT_MASK ? false : true).bitmap;
|
||||
Bitmap leftFrontTurnArrow = getRenderLeftFrontTurnLaneArrow(isW != LEFT_TWO_BIT_MASK).bitmap;
|
||||
Bitmap RightFrontTurnArrow = getRenderRightFrontTurnLaneArrow(isW != RIGHT_TWO_BIT_MASK).bitmap;
|
||||
int translationX = -(LEFT_FRONT_TURN_SLOPE_WIDTH / 2);
|
||||
int translationY = LANE_HEIGHT / 6;
|
||||
canvas.save();
|
||||
@@ -1015,7 +1015,7 @@ public class LaneMarkTools {
|
||||
paint.setAntiAlias(true);
|
||||
|
||||
Bitmap straightLaneArrow = getRenderStraightLaneArrow(type).bitmap;
|
||||
Bitmap UTurnLaneArrow = getRenderUTurnLaneArrow(type == UTURN_BIT_MASK ? false : true).bitmap;
|
||||
Bitmap UTurnLaneArrow = getRenderUTurnLaneArrow(type != UTURN_BIT_MASK).bitmap;
|
||||
|
||||
int translationX = -ARC_RADIUS;
|
||||
int translationY = LANE_HEIGHT / 4;
|
||||
@@ -1228,7 +1228,7 @@ public class LaneMarkTools {
|
||||
}else if(mark.isUTurn)
|
||||
{
|
||||
//获取 "调头" 车道箭头图元
|
||||
bitmap = getRenderUTurnLaneArrow(highType == UTURN_BIT_MASK ? false : true);
|
||||
bitmap = getRenderUTurnLaneArrow(highType != UTURN_BIT_MASK);
|
||||
}
|
||||
|
||||
return bitmap;
|
||||
|
||||
@@ -81,14 +81,14 @@ public class DirectionLayer extends ImageView implements MapStatusListener {
|
||||
return;
|
||||
}
|
||||
canvas.save();
|
||||
canvas.translate(getWidth() / 2, getHeight() / 2);
|
||||
canvas.translate(getWidth() / 2.0f, getHeight() / 2.0f);
|
||||
// mCamera.save();
|
||||
// mCamera.rotateX(90 - mapController.getDAngle());
|
||||
// mCamera.getMatrix(matrix);
|
||||
// mCamera.restore();
|
||||
canvas.concat(matrix);
|
||||
canvas.rotate(mMapController.getMapViewRotation());
|
||||
canvas.translate(-getWidth() / 2, -getHeight() / 2);
|
||||
canvas.translate(-getWidth() / 2.0f, -getHeight() / 2.0f);
|
||||
super.onDraw(canvas);
|
||||
canvas.restore();
|
||||
postInvalidate();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -65,7 +65,7 @@ public class PubFunction
|
||||
*/
|
||||
public static double GetLineAngle(int nX1, int nY1, int nX2, int nY2)
|
||||
{
|
||||
return getAngleToNorth((nX2 - nX1)/5, (nY2 - nY1)/4);
|
||||
return getAngleToNorth((nX2 - nX1)/5.0f, (nY2 - nY1)/4.0f);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user