How to move marker with animation along routing path? - web

I want to move marker along curved path.I do receive LatLong every minute.
for example A, B are received LatLong locations. I need right way to make it happen.
I could move using leaflet.animateMarker
but it moves from A point to B which is bad when the path is curved.
curved path. Please advise if you have any idea about how to move the marker along curved path? thanks in advance!

You can use lib from GitHub This. It is very commonly used to animate markers on Leaflet map. Hope this will cover your needs.
Features
Let move your markers along a polyline.
You can zoom in/out, your moving marker will be at the right place !
You can pause or end the animation whenever you want.
You can deal with events.
You can make loop.
You can add the the point one by one.
You can add station at some points of the polyline.

Related

Add double lines in the middle of another svg line

so I have a drawing program and I need to implement a "broken line", it is an SVG line with two another lines in the middle of this line, these two line needs to cross perpendicularly to the principal line, maybe this picture can help me to explain the problem:
This line can be drawn in any angle that the user choose
I don't really understand svg's so I'm having a lot of trouble implementing this.
Thank you
So I discovered one way to implement that using polylines and calculating the middle of the source and target coordinates, so when it changes I change the middle point too. After that, I created a marker-mid with the double lines.

How to drag a polygon in MFC?

I'm new to MFC. I know how to draw a line and how to scribble in MFC. I use CDC and some functions such as LineTo() and MoveTo() to do this. Moreover, I've got FillRect() and Rectangle().Now I want to drag my rectangle or any polygon in the view.It's like you drag a icon on your desktop.
I think the first step is to get the region.Then erase the old polygon and when the mouse move draw a same polygon which depends on the point where the mouse go.
So I search region in MSDN and I got Region class and CRgn class.But before I look into these two class I want to know whether I'm in the right direction.
I need more suggestions on how to learn MFC. Actually,all I need is to finish my homework which is mainly about draw polygons and drag them and link them by line. And I hope I can finish this homework all by myself and MSDN. Can MSDN help me do that?
The CDC::Polyline function will draw a polygon much faster than using LineTo and MoveTo.
You do not need region and do not need to erase the old polygon. Instead, you need to draw everything in the view OnDraw. Any change you want to make with the mouse should change the array of coordinates that represent the polygon and then call Invalidate. In other words, do not draw in the mouse message handlers. Calling Invalidate in the mouse message handlers will cause OnDraw to be called later and it should repaint the entire view.

How can I draw to an XY position in Emacs?

I wanted to allow the Emacs cursor to move around freely outside of actual text (similar to virtualedit=all in Vim).
"Oh," I thought, "I'll just keep track of a virtual cursor and draw it to the screen myself."
But it turns out the actual native C drawing routines (such as draw_glyphs) seem to refer back to the buffer contents to decide what to draw (I could be wrong though).
My next idea was to make a giant overlay of all spaces so I'd have complete freedom where to put stuff. But an overlay only goes over ranges of actual text, so again, this does not seem to give me what I'm looking for.
Is this a reasonable goal without hacking the C code?
I believe the writeable area of a window is intrinsically limited to the buffer with which it is associated, i.e. you have to draw in an area where buffer content exists.
(One example of this limitation is the impossibility of drawing a vertical guide line in the 80th column to help the user identify long lines; currently the best possible implementation of such a feature is to highlight the "overflow" of each too-long line.)
You can do the same as what artist-mode does without adding spaces to the buffer:
when trying to place the cursor after the end of the line, just use an overlay with an after-string property which adds the spaces in the display without modifying the buffer.
Have a look at "artist-mode" (M-xartist-modeRET) - it allows you to draw in Emacs.
From the function documentation: "Artist lets you draw lines, squares, rectangles and poly-lines, ellipses and circles with your mouse and/or keyboard."
You can look at popup.el from the auto-complete package, which can pop up tooltips and menus and such at any position, including positions outside the contents of the buffer. Maybe that will show you how you can do it.

'Slider Control' kind of controls in Cocos2d help

I am making a game in Cocos2d. I want there to be a dotted line that follows the user's finger. I want the line to be straight. The problem is, how do I check to see how many 'dots' will fit in the distance between the ball and where the user is touching? And make it follow in a STRAIGHT line between the ball's position and the finger's position? So here's a re-clarification:
The ball sits still on the left side of the screen, and is halfway up the screen. The user drags their finger, and a dotted line is drawn between the ball's position and the touch's position. I have a 'dot' image to be used, and I would like it to be used as the dots in the line. So it will have to recreate the sprite as many times as it will fit in the area between the two points. Please tell me if you want me to clarify further, Thanks!!
I would make a CCNode object called dottedLine or something.
The dot image would be a sprite that gets added as a child of the node (multiple times).
I would work out the path from ball to finger touch using Trigonometry/Pythagoras theorem.
For creating the line:
From point 0, the ball, i would add 15-20 pixels towards the touch point along the path, and place a dot, I'd repeat this until I reached the end of the line.
Every dot that was placed I would increment a counter, and set that number as the integer tag of that sprite for use in an update method.
Every time the cctouchesmoved method gets called, i'd call an update method on the dottedLine object.
This method would check the distance between the ball and touch point, divide it by the number of dots currently children of the object and remove or add any that are needed. Recreating the sprites every time you move your finger would be messy and wasteful, so reusing your dots and just setting them new positions as the path between ball and touch point changes would probably be best.
I'm not going to provide you code, i think i've explained more than enough of the working out for you to do some googling and work this out.

Read Path and draw circles

i am working on SVG, problem i am facing is that i want to read the path and after reading it i want to draw the circles through tag used in svg, on that path, kindly help me out any help will be awesome...Thanks in Advance :)
The information you have provided still does not make sense to me. Here's a guess at what you might be looking for.
If you have a <path> element and you want to place circles along the path, you can use the getPointAtLength() method to find the location at an arbitrary distance along the path.
Then you can create <circle> elements (or <use> elements that reference a circle) and place them at this location.
Here is a demo that uses this technique (and also happens to create a <polygon> of the result):
http://phrogz.net/svg/convert_path_to_polygon.xhtml

Resources