draw lines to connect two shapes - connection

How to design such function that user can use mouse to draw a line to connect two shapes? I'm using this module in wxpython : wx.lib.ogl.
The doc for theses methods are brief and no good demo that I can learn from.
Does anyone can give me some ideas?
Thanks

Did you look at the wxPython demo? It shows exactly how to do this. It draws several shapes and then connects them with arrows and lines. You can get the wxPython demo from the wxPython website, which I assume you already know since you keep re-posting your questions to the wxPython mailing list.

Related

Use image library from Hammerspoon

I'd like to use a more sophisticated graphics or GUI widget library in my Hammerspoon config file, in order to get user input and do more advanced drawing on the screen than Hammerspoon allows (as far as I can tell) by default. I'm new to Lua and Hammerspoon, and so far I've been unable to figure out how to get this working. (Simple drawing on-screen is not a problem, so examples of geometric shapes are not helpful. I can do that already with no difficulty.)
I initially thought one of the Lua libraries designed for building games would have more than I could possibly need, and looked into love2d, but it did not appear to be possible to use with Hammerspoon in any straightforward manner.
To give two concrete examples of things I'd like to do:
I'd like to display a dialog box in which the user can enter two values, to specify how many rows and how many columns they want in their screen grid. A native Cocoa dialog would be better, but something graphically drawn on screen with Lua would be fine, as long as the details of the image are abstracted away for me, and I can just define the text and fields and buttons in the dialog.
I'd like to draw a dotted-line rectangle with curved corners and a shadow around specified grid segments as a preview of where a window would be moved if the user completed a certain command.
There's a lot more, but anything that allows me to do those things should allow me to do anything else I want.
We don't yet have a good answer to generating dialog boxes, although it is possible to do it with AppleScript, which you can call from Hammerspoon with hs.osascript.
As for drawing things like dotted-line rectangles, we can't currently do that, but if you'd like to file an issue on our GitHub project, it's something we can look at for a future release :)

What kind of chart is suitable for work flow? and it should be free

I have a requirement in my product to create an widget to have workflow kind of process.
If you see attached image , I am looking for similar kind of chart.
As we have already fusion charts with us, is it possible to have similar stuff?
Since you already have FusionCharts, I would recommend using the Drag Node Chart. The chart is exactly of the type you need and the dragging functionality can be easily turned off!
http://www.fusioncharts.com/charts/drag-node-charts/
In fact, one of the examples look very close to the image in your question and as far as I can tell, the chart can be customised to look almost same -
http://www.fusioncharts.com/charts/drag-node-charts/
Only downside that I can think of is that you will have to manually calculate the position of your workflow nodes (the connectors will connect automatically.) However, the positions can be easily computed by writing simple function on the beforeDataUpdate event fired by the chart.
PS: Using the annotations feature, you can dynamically position texts labels, images, and other such items arounds your process diagram.

How do I Display Select Pixels of an Image Using Swift?

I'm trying to define pixels of an image based on their color code, and display them on command. I've been researching this and can't seem to find information on the subject, I've mostly been pointed towards "Animations" and "Core Image Filters" which isn't quite what I'm looking for. Any information on the subject is much appreciated.
https://github.com/jjxtra/DRColorPicker
try this sample code of a color picker. one of the views is a plane of continuous colors and is probably what you want. apple has good source code and the swift book is great for avoiding bad questions. you have to watch it as a beginer.too many simple questions on this site and they will block you from asking more.

How to wrap locations that are close to each other in a single marker with Mapkit?

I am looking for a good and fast way to wrap locations that are in a specific range on a MKMapView in a single marker. Clicking on that marker brings you closer to the center point of this locations. You can see what I mean on the picture below.
mc donalds app - map sample screen
My first thought was to check a specific pixel range for each marker, hide the ones that are closer than X pixels to each other and get the center of them to create a new marker.
Did anyone of you ever did something similar?
There's a demo from WDC 11 or 10 that does exactly that, and coalesces based on proximity, not grid. Much better looking than DTCluster.
After a while of searching an testing, I found several frameworks for this like:
REVClusterMap, SuperPin, DTClusterMaker and a lot more. At the moment I stick with "REMarkerClusterer". It's pretty simple to implement and is free (MIT License)
https://github.com/romaonthego/REMarkerClusterer
Here is a nice article about clustering:
http://applidium.com/en/news/too_many_pins_on_your_map/
If someone else has good frameworks for this in his bookmarks/github-list, please post it here. I sill would like to see them ...

iOS KMLViewer Sample Polygon Callout?

I am pretty new to the iOS world, and since I am a geographer by trade I of course wanted to play with some of the Mapkit functions.
I downloaded the KMLViewer sample, and as part of that sample the KML file has points and polygons. For the points users can press one of the points and get a call out with the attributes of that point. This functionally is not built in for the polygons. I would like to be able to press one of the polygons and have a call out open with its attributes?
Can someone help guide me on how to accomplish this? Thank you so much for any help, guidance, and patients.
Thanks,
Paul
It's all about Overlay view. Use MKAnnotationView class to set properties and annotate as much as you like. It's a view so you can build it like any view and put it on the map. You will also find other sample codes here. Also found nice example on OverlayView here.

Resources