09-29-2016 07:13 AM
I would like to programmatically import an area of my MapView to a Layout Sheet. Is it possible to choose an area having the shape of a polygon?
The only possibility I have found so far is to use the CreateEmbed method of a SmartFrames2d object and define an area in its second parameter, the mapstring.
But this area always results in an axis-aligned rectangle, whereas I would like to have a polygon shaped area.
Doeas anyone have an idea if this is possible and if yes, how?
I am very grateful for any hints!
Thanks and regards
Solved! Go to Solution.
09-29-2016 08:30 AM
I am afraid that this is not possible. The only idea I have is to somehow use the Boundary2d object. Otherwise it is only possible to set the SmartFrame2d area to be rectangle or ellipse via the ShapeOption property.
09-29-2016 11:41 PM
thank you for your answer!
Actually it would be ok if the SmartFrames2d area is a rectangle as long as the area of the map which I import is polygon shaped. In GeoMedia it is possible to manually choose a polygon shaped map area to import, and my question was if it is also possible to do so programmatically?
09-30-2016 02:34 AM
in GeoMedia in the LayoutWindow you can click on "Map and Marginalia", then on "Insert Map..." and you get the following dialog, where as method for the Geographic extent you can choose e.g. Polygon:
After clicking OK you see you MapView, and you can click on the map to identify your polygon and then insert this area to the layout window and get e.g. something like this:
My question is, if it is possible to program this workflow. The only option I have found to insert an area from you map view to the layout window is to choose the createEmbed method of the SmartFrames2d object, but here the area of the inserted map is always a rectangle.
I hope that I could clarify the workflow and thanks for your effort!
09-30-2016 01:20 PM
so actually this is possible using the Boundary2d object, as I suggested in my first post. You should set the SmartFrame2d.ShapeOption to igBoundaryFrame, and then call the SmartFrame2d.SetClippingBoundary method with appropriate Boundary2d object as an argument. The most tricky part is to construct the Boundary2d object, as it should be in the paper units. So you should scale the real coordinates using CoordSystem.StorageToProjectionScale/MapView.DisplayScale ratio. And also you should translate the coordinates using the SmartFrame2d.GetOrigin values.
10-04-2016 03:19 AM
thank you very much for your answer. I am trying to test it right now and I have one more question:
I would like to create the Boundary2d object using the AddByPoints method of the Boundaries2d object. Can you tell me which type the second parameter of this method should be?
I.e., I am programming in C# and want to do the following:
Boundary2d objBoundary = objBoundaries.AddByPoints(points.Count, points);
where objBoundaries is an Boundaries2d object. As points I tried to use a PBasic.Points object but I get an error. I suppose that the type is wrong. Do you have an idea which type to use?
Thanks and regards
10-04-2016 03:32 AM
it should be just a simple array of doubles, with the length 2*points_count. Each pair holds the X and Y coordinates. So for example:
double my_points = new double[2*my_points_count];
my_points = X1;
my_points = Y1;