Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draw a line #17

Open
whowazit opened this issue Apr 6, 2015 · 1 comment
Open

Draw a line #17

whowazit opened this issue Apr 6, 2015 · 1 comment

Comments

@whowazit
Copy link

whowazit commented Apr 6, 2015

How to draw a line based on the coordinates in the map.xml?

@mohshaat1990
Copy link

on class poly area there is comment ondraw function
@OverRide
public void onDraw(Canvas canvas) {
// draw the bounding box
/* canvas.drawRect(left * mResizeFactorX + mScrollLeft,
top * mResizeFactorY + mScrollTop,
right * mResizeFactorX + mScrollLeft,
bottom * mResizeFactorY + mScrollTop,
textOutlinePaint);*/

i used this function to draw polygon based on coordinates in map.xml
Paint paint = new Paint();
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth(4);
paint.setColor(Color.RED);
Path p = new Path();
/* p.moveTo(left * mResizeFactorX + mScrollLeft, top * mResizeFactorY + mScrollTop);
p.lineTo(left * mResizeFactorX + mScrollLeft, top * mResizeFactorY + mScrollTop);
p.lineTo(right * mResizeFactorX + mScrollLeft, top* mResizeFactorY + mScrollTop);/
p.moveTo(xpoints.get(0) * mResizeFactorX + mScrollLeft, ypoints.get(0) * mResizeFactorY + mScrollTop);
for(int a=0;a<xpoints.size();a++)
p.lineTo(xpoints.get(a)
mResizeFactorX + mScrollLeft, ypoints.get(a) * mResizeFactorY + mScrollTop);
/* p.moveTo(xpoints.get(0) * mResizeFactorX + mScrollLeft, ypoints.get(0) * mResizeFactorY + mScrollTop);
p.lineTo(xpoints.get(0)* mResizeFactorX + mScrollLeft, ypoints.get(0) * mResizeFactorY + mScrollTop);
p.lineTo(xpoints.get(1) * mResizeFactorX + mScrollLeft, ypoints.get(1) * mResizeFactorY + mScrollTop);
p.lineTo(xpoints.get(2) * mResizeFactorX + mScrollLeft, ypoints.get(2) * mResizeFactorY + mScrollTop);*/
p.close();
// p.lineTo(200, 100);
// p.lineTo(240, 155);
// p.lineTo(250, 175);
// p.lineTo(20, 20);
canvas.drawPath(p, paint);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants