I'm using the sketch editor to let the user draw and edit polygons on map
I want to let the user the option to move/rotate/resize etc.
when I create polyline/polygone I can do it with no problem as I send the geometry to the sketch editor
but when I want to create a point, I cannot resize and rotate it, only move the point along the map
(because sometimes my point are represented with a symbol, for example, truck)
is such option even exist?
P.S
I know I can go directly to the geometry / SimpleMarkSymbol and change it properties, but that's not an optimal solution for me
Related
Using SharpMap (Windows Forms) how can I display an overlay image over the map tile background so that the image scales and moves accordingly with the map zoom and pan? I want to implement a georeferencing like functionality.
I tried using SharpMap.Layers.GdiImageLayer but I didn't find a way to position it to a custom position (real world coordinate) - it is getting placed by default at origin [0,0] (the background tile coordinates). Is there a way to define a relation (transformation) to place it in a particular position?
I managed to get closer to a solution using VectorLayer with RasterPointSymbolizer but the symbol (image loaded for symbol) would need to be transformed on map scaling/zoom (so that corners remain in the same real world coordinates) - the math calculation behind looks a little complicated for a solution that seems more like a workaround than a natural one. As a note - I don't need precise calculation using projection/real geoid as I am doing this only at building level.
Using GDAL - GeoTIFF might be a choice here by generating a GeoTIFF based on the original image and making the georeferencing metadata dynamic based on UI controls? The original image is in raster format (JPG) with no geographic metadata.
Is there a better solution?
If VectorLayer - RasterPointSymbolizer is the best choice, do you have an example for symbol(image) synchronization with the map view?
As far as i can tell the GdiImageLayer calculates the position based on a world-file (GdiImageLayer.SetEnvelope()). Here is the link to the method. This meta file has to have the same name in the same location but the filetype must be of type *.wld. There you set the position (top left corner) and the skew in x and y axis. So rotation will be perserved. I never tried this but i would suggest correct zooming would work
(The wiki article offers also some good understanding for world files)
There might be another way if no world file is present and the information rests in the header. There is a GDalSample loading a GeoTiff Image onto an existing map. The example can be found in the WinFormSamples and the Different kind of layers supported by [MapBox] Example. The map is showing the overlay only while magnifying and not fully function but maybe a good hint
I am trying to create a WPF application using C# to run on Pixelsense that is basic version of the tangram puzzle. I am able to draw my 7 shapes and translate and rotate them all around the screen.
Could anyone give me advise regarding how I should go about saving the pattern (with shapes in specific positions and orientations) so that when a user creates the pattern next time, the application can match it to the saved one and tell the user if it's correct.
It's a pattern matching and recognition problem that I am trying to solve.
I have been stuck on this for a while now :(
Define the solution as a collection of objects with shapeType, position, and orientation properties. Have the solution include one shape at position 0, 0 and an orientation of 0. Now loop over all the shapes the user has actually placed to find the ones with a shapeType that matches the shape your solution has at 0,0,0. Calculate the position and orientation of every other shape relative to where the user put this one. Compare those values to the rest of your solution. You'll need to experiment with how much tolerance to allow because this stuff is not precise - to make the game fun, err on the side of having high tolerances. If needed, you can follow this up with some performance optimizations to only re-evaluate pieces that moved.
Hopefully you are using physical shape prices with tags on them instead of this purely a virtual game. I always wanted to build this when I was on the Surface team but it never happened. One challenge you will run into is defining how the tag's position/orientation relates to the actual shape. If you'll be putting tag stickers on multiple tangram sets, you almost certainly won't get the on precisely the same each time so you may need to add a "calibration" mode to your app (have the user place each piece in a specific spot and then push a button so you can record where the tag is relative to those spots). The TagVisualizer WPF control should help a lot for building your UI - definitely look into using it (this scenario was top of mind when we designed that API). The default behavior of that control (if you tell it the ID of a tag to look for but not how to visualize it) is a "crosshair" that can help you find tune your offset values.
Good luck! If you wouldn't mind recording a YouTube video when you are done and posting a comment here linking to it, I'd really appreciate that
You can use ObservableCollection or List of a custom class. That class can consist of various values such as position, orientation etc as properties.
When a new pattern is drawn or when the pattern change its position you can update that particular object stored in the collection. As you have all the details of the pattern(positions and orientation) you can iterate the for loop and check the position of the new pattern when added.
I would like to programmatically(C#) update/replace all shapes of a given visio flowchart(*.vsd). The diagram layout remain the same(all connections, coordinates etc. are the same), but the master-shapes should be different(from different stencil).
Any examples, suggestions and ideas are highly appreciated.
Thanks for your suggestions! The source-diagram has many protected shapes that are grouped(+multiple subshapes), so I guess it will be better, if I take all the information for a given source-shape, and then drop a new master from the target-stencil and set these properties. Next, I would take the next Shape and do the same. I would create a new Visio document, since Iām not sure, whether the source Page-ShapeSheet is not customized someway. But I don't know how to do basic steps programmatically in C# e.g.
how to create new vsd file within C# (maybe
application.Documents.AddEx(āā))
must I then open this document with application.Document.OpenEx, or the document is already open/active
must I create a new Page within this document
-ā¦
In this post: "save and close visio documents visual basic macro
" similar steps explained, but in VBA and not in C#.
I'd suggest just using Visio 2013, which has that function out of the box.
However, that's probably not going to work for you. I've taken two different routes in the past, depending on what differences there were between the original and the replacement shape.
One way to do this is, to copy as many attributes as you can between the shapes, and duplicate the glues and everything. So to do this, you just copy the width, height, pins, etc.., and then step through all the glues in the original shape, and move the glues to the new shape.
The other way, which is a bit cleaner, in my opinion, is wholesale copying all the geometry sections from the original into the destination shape. This makes it so you don't have to worry about glues and formatting and things, and are just copying over the graphics that make up the shape.
If you have a grouped shape with multiple subshapes, it's probably going to be easier to drop a new master out, but if it's just a simple graphic-type shape, copying the geometry is probably better.
One thing to be aware of with the "copy the geometries" method is, you have to make sure any user cells or controls which are precedent to any geometry cells in the new shape also exist in the original shape. Visio's Cell class tells you the precedents for a cell, so this is easy enough to do.
Hope that helps.
I think you can extract some information from these two links and play with it:
Visio shape - get X,Y position
http://msdn.microsoft.com/en-us/library/cc160747.aspx
I am very curious, I have for example a app to localize our property, our first, second house, favorite park and we can add pushpins to corners of this property in a way to form a shape(triangle, square, polygon etc), not a line or point.
How to create this shape, there is a method to calculate the surface area? Change a background for example to color yellow between these pushpins ?
When we created a shape we can chose from the listbox or map to delete this shape or go to there using GPS, i wrote something like that in Simulate my current position
I think its a interesting app but i need your help ;)
Try getting the geocoordinates of each pushpin and using maths? I guess you could assume the flatness of the Earth over a small area (like a house) but over larger you'll need to account for curvature.
As for colouring the shapes in, I don't think there's a way to do this using the Map control.
I have a series of points in a GraphicsPath; for our purpose lets assume its the outline of an uppercase B. I want to be able to be able to draw only the bottom portion that would resemble an uppercase L.
I'd like to be able to select a window of points from the GraphicsPath. Is there a handy way to do this without doing point interpolation; ie have to write code to calculate slope math and possibly derivatives?
I don't believe that there's a way to actually tell the Graphics class to "stop" halfway through a path, or somehow create a new path that intersects with a bounding box (without implementing the method yourself), but if you're just doing this so you can draw a certain part of the path, then you should be able to achieve what you want by setting the clipping region.
See the Graphics.ClipBounds property, which takes a RectangleF, or Graphics.Clip, which is a Region (the former is generally easier to use, unless you already have a Region instance).
If you need to use the partial path for something else then I'm not aware of any built-in way to do it.