How to create an interactive Map using Images - c#

I have a couple of images that I would like to create an interactive map of in Silverlight and WPF. The pictures are of States and counties. I tried doing some search on how this is done but have not been able to find a good example on how to go about accomplishing this. So I would appreciate your help. Thanks in advance.

I was involved in creating a Xaml World map from scratch (below) and that alone took nearly a day for a stylised polygon version (no fine detail)....
I have since purchased a Wacom Bamboo tablet & stylus and found that to be about 5 times faster to work with compared with a mouse.
Quoting myself: "You import a map as a background image and use the pen tool to dot-to-dot trace around the country. Combine all those path segments into a single path. Then create a separate poly-path for each state (close them to allow for a fill)."
Once you create them you can name the individual country polygons and connect up mouse logic to make them all glow on mouse over or change colour on press etc.
Basically all the other stuff on that screen are user controls and custom controls. Work out the behaviour you want and create controls to suit your own needs.
In your instance you can use less accurate polygons as they will only be for hit-testing and highlighting and you will want to retain the actual map images under the polygons.

Related

How do i programmatically create a kind of arrow that points to the buttons like a flow

I am creating an Accounting software on C# WPF and I want this kind of arrow pointing to buttons like a flow structure in the picture.
And want that to be responsive.
I tried using png images of different sizes to show but its very hard and a lot of hard codes and some don't work as expected.
Please tell me a way to create it.
I know path class little bit but don't know how to make resize according to the screen size

Drawing custom Editor controls in Unity

Sometimes a Unity project has data that demands more than ordinary inspector fields and we want to create more sophisticated tools to edit the data. For example, here's a blog post about creating a node editor: Creating a Node Based Editor in Unity
It's useful to be able to create node editors, but that project draws nothing but boxes and lines and curves using the tools in GUI and Handles, which is fine for what it is, but what if we need to draw something not supplied by Handles?
For example, if we want to draw an elaborate mesh to represent some data that we want to be able to edit, it seems not ideal to render each individual polygon of the mesh using Handles.DrawAAConvexPolygon(...). Shouldn't we instead have a way to more directly send the mesh to be rendered? Or is DrawAAConvexPolygon exactly what we should be doing?
Is the GL class the appropriate approach when wanting to draw arbitrary meshes in an editor control? It is certainly capable of drawing, but is it bad practice? In particular, the GL.Viewport(Rect) method seems to work very strangely within a GUI. One cannot simply give it a GUI Rect and thereby have a viewport in the same place we'd have a GUI control if we gave it that same Rect. We need to calculate the Rect that will put the viewport in the appropriate place, and even then we have to determine the coordinate system within the viewport. Based on the documentation for Viewport(Rect) one might expect the viewport to be (0, 0) to (Screen.width, Screen.height), but it does not always work out that way exactly, and it all gives the impression that GL is not designed to be used within Editor GUI. The documentation for GL.Viewport has it used in an OnPostRender method, so is it misguided to try to use GL in other places?
If we should not be using the GL class, then what is the technique for drawing within custom Editor controls?
You may wanna look at Unity Graph view if you want to make a Node Based Editor in Unity.
It use UXML and USS with is close to HTML and CSS.
Making it pretty easy to customise as you wanted.
Unity Video on UXML and USS: Customize the Unity Editor with UIElements!
https://www.youtube.com/watch?v=CZ39btQ0XlE&t=98s
Here are 3 Github you can download and look at.
https://github.com/rygo6/GTLogicGraph
https://github.com/rygo6/GraphViewExample
This one is made by me.
https://github.com/KasperGameDev/Dialogue-Editor-Tutorial/tree/Dialogue-Prototype-Bonus

Remove labels in gmap.net

I'm building an application where I'm using gMap.net (not google maps). I need a totally physical map where there are no labels. All the mapProviders are showing labels. As in the attached picture you can see few landmarks are there. Is there any way to remove them.
Afaik the map data is provided as is, there's no option of actually peeking into the map layers delivered by the map providers.
If the satellite-only imagery is not an option, have you looked at either of those:
ArcGIS_World_Physical_Map
ArcGIS_World_Shaded_Relief_Map
ArcGIS_World_Terrain_Base_Map
Depending on the zoom level these might be a neutral option.

How do I Draw a Chessboard using XAML?

I am working on a project that requires me to develop an application using the Universal Windows Platform (UWP). I have no prior knowledge of developing UWP apps and XAML is completely new to me. Thankfully however, I am competent at writing in C#.
The project I am working on involves recreating the Tafl Board games - Hnefatafl, Brandubh, Tablut, etc.
Now, while I'm fairly confident in my ability to create the underlying logic for the game, I find myself bamboozled when it comes to creating the interface using XAML.
Several different chessboards will need to be rendered: 7x7, 9x9 and 11x11.
So my question is two-fold.
How do I create a chessboard in XAML that will scale appropriately to different window/display sizes and be able to be backed by a grid behind the scenes (i.e. The application can detect which square of the board is touched, etc)
How do I go about rendering a different board depending on the game type selected?
Apologies if this is a terrible question but googling hasn't helped me a whole lot and StackOverflow has always been a great source of information.
You might want to try out the RelativePanel control and use different coloured rectangles for the tiles. This would resize for different screen sizes.
I hope you finally got an answer to this that led you in the right direction. If you didn't here are some ideas that might narrow your research terms and get your going. I'd give you working samples but youd did mention it is for a school project :).
Using a listbox and manupulating the base style can be a relatively
good way to go, and very reusable. This also fulfills your
requirement of knowing the tile currently selected as the listbox
already handles that. I used this technique for a Sudoku board that
had alternating colors for the different regions.
Create a UserControl with properties for the number of columns and
rows you need for your board and then dynamically add the rows and
columns to the grid. If your game model has a list of tiles and
each tile has a column and row property that can be mapped to the
column and row indices of the grid, you could potentially bind to it
quite easily.
Create a custom control that handles the columns,
rows and other aspects of the board itself in c# and the rendering
in XAML. I personally shy away from this just because the existing
controls are already so flexible that with enough ingenuity you can
create what you need with out of the box controls.

Create an Object Editor in C# for WinForms

I need to find, or create an editor that will handle text and images as objects. For instance I have a 3 line string of text, to be able to move it around and position it within a canvas, also the ability to add an image, and possibly resize it within that canvas. and take the result, and save it, whether I get the the offsets and positions manually, of each of the objects (preferable) , or get the entire canvas as an image, to be able to save and print.
Rulers would be great... Im not trying to re-create Photoshop, but the idea is similar.
I will be doing this in a C# WinForms application, it does seem however that a WPF solution might be better suited, and I think I can have a WPF control within winforms...
Any direction or advice would be greatly appreciated.
Forget winforms. It doesn't support anything. Your best bet is to do it in WPF and if you need, you can integrate it into an existing winforms application via the ElementHost.
Please see my similar answers/samples about this:
https://stackoverflow.com/a/15580293/643085
https://stackoverflow.com/a/15469477/643085
https://stackoverflow.com/a/15821573/643085
Also, see this example with support for zoom, panning and resizing functionality:
https://stackoverflow.com/a/16947081/643085
They're all MVVM based and have some interesting features.
You can easily customize these samples and add ANY type of elements:
images,
geometries,
usable interactive UI elements with functionality (TextBoxes, ComboBoxes, whatever),
text,
videos,
FlowDocuments,
or whatever that's visible on screen)
by adding additional data items and their corresponding DataTemplates.

Categories