Quantcast
Viewing all 2341 articles
Browse latest View live

New Post: Sample code in C# to plot a point from degree lat and long

Sleschinski,
Again thank you very much. This helped. Now my code is working. I need one more help. I am running into problems where my sets of points are not clockwise. I even wrote the following while loop to get the proper clockwise lat,longs. But did not work out. Your help is appreciated.

New Post: Sample code in C# to plot a point from degree lat and long

How about Shape.get_PartIsClockWise, Shape.ReversePointsOrder?

New Post: Sample code in C# to plot a point from degree lat and long

My polygon has 4 points. So 5 points in the shape object it total. I know it is in proper sorting. Just need to make it clockwise.
while (!Shape.PartIsClockWise[0])
            {
                MapWinGIS.Shape tempshape = new Shape();
                tempshape.ShapeType = ShpfileType.SHP_POLYGON;

                tempshape.InsertPoint(Shape.get_Point(1), 0);
                tempshape.InsertPoint(Shape.get_Point(2), 1);
                tempshape.InsertPoint(Shape.get_Point(3), 2);
                tempshape.InsertPoint(Shape.get_Point(4), 3);
                tempshape.InsertPoint(Shape.get_Point(1), 4);

                Shape = tempshape;                
            }
            return Shape;

New Post: VPN blocking mapwingis tiles

Hi,

My tool is working fine with mapwingis activeX component. But When I turn on the office VPN it does not pull the tiles from openstreetmaps. I even tried google. Did not work out. Anyone know any workaround?

New Post: Sample code in C# to plot a point from degree lat and long

Here is a sample code which demonstrates the functionality. I believe we had an issue with it in the past, so I've just tested it to make sure it works.
// it's counter-clockwise list
var list = new List<Point>()
{
    new Point() {x = 0.0, y = 0.0},
    new Point() {x = 100.0, y = 0.0},
    new Point() {x = 100.0, y = 100.0},
    new Point() {x = 0.0, y = 100.0},
    new Point() {x = 0.0, y = 0.0},
};
            
//list.Reverse();       // to make it clockwise

var shape = new Shape();
shape.Create(ShpfileType.SHP_POLYGON);

int pointIndex = 0;
foreach (var pnt in list)
{
    shape.InsertPoint(pnt, ref pointIndex);
    pointIndex++;
}

bool isClockwise = shape.PartIsClockWise[0];
Debug.Print("Is clockwise: " + isClockwise);

if (!isClockwise)
{
    if (!shape.ReversePointsOrder(0))
    {
        Debug.Print("Failed to reverse point order");
        return;
    }
}

Debug.Print("Is clockwise: " + shape.PartIsClockWise[0]);

New Post: VPN blocking mapwingis tiles

Closed Unassigned: Occurrence of MouseMoveEvent is very slow [26005]

I try to show cursor coordinate in a separate control, e.g. LABEL, while mouse move (by implementing the mouse move event as shown [here](https://mapwingis.codeplex.com/discussions/636662)).
My problem is that the occurrence of MouseMoveEvent is very slow compared to the built-in coordinates on the map, thus the update rate of the label is slow too. I think that the problem may be in the firing of the MouseMoveEvent or in the interoperability between the OCX and the .net framework.

How to make the update rate of the label as fast as the built-in shown coordinates?

regards
Comments: Not an issue.

New Post: Disable keyboard hotkeys

Hi,
How to disable keyboard hotkeys: space for panning, z for zoom, ...?
Is there any method to do it?

New Post: How persent sql server geometry data in mapwingis

hi . in my project in c# i need to display geometry data in my map by sql server database and SP .but i dont know make it... plz help me to complate this ok thanks all

New Post: Disable keyboard hotkeys

Hi, there is no way to disable those keys in MapWinGIS itself. But you can intercept and suppress them at the parent form level (in .NET by overriding ProcessCmdKey or setting KeyPreview = true).

New Post: How persent sql server geometry data in mapwingis

New Post: How persent sql server geometry data in mapwingis

very nice thanks sleschinski for help me.i try to learn this refrence but if get problem then sent it to you. ok

New Post: VPN blocking mapwingis tiles

I do somthing like this, if it helps...
 If My.Settings.Map_Tiles_Proxy = "" Then
            TheMap.Tiles.AutodetectProxy()
        Else
            TheMap.Tiles.SetProxy(My.Settings.Map_Tiles_Proxy, My.Settings.Map_Tiles_Port)
            ' MsgBox("not working")
        End If

New Post: AxMap.ZoomToSelected sometimes zooms more than needed

Hi every one,

I implements a service that use AxMap.ZoomToSelected(), but some times the new extents (after zooming) is smaller (in surface) than that for selected features. I notice that while selecting two point features and doing ZoomToSelected(): after zooming, the selected points are outside the new extents.

Is there any idea to solve that?

New Post: VPN blocking mapwingis tiles

sleschinski & ross,
Thank you very much for your help. I tried all the possible options. I even got the proxy address and used .SetProxy method. But it did not work. Do you know which server and port MapWinGis is pulling the tiles?

New Post: Select multiple layers with cmSelection Tool

Hi I'm using C# to develop an application but i'cant find a way to select multiple layers at the same time ant that they return me their handlers. Any advice? thank you

New Post: Map control events in VBA

Sergei

Just to tie up a loose end. I had posted the question while on the road and unable to devote enough time to implementation. Only got back to programming after returning home.

Your advice helped a lot, but I struggled for a long time to understand how to implement it in VBA. Bottom line is that I have always created event procedures using each object's properties sheet, but that technique does not work with the map control. Took me a long time to realize that I could choose the map object from the list of objects in the code editor, and find every available event. Once I passed that hurdle, I could follow your advice about the Choose Layer event. I've got the "selection" process working, and my program is nearing completion.

Thanks again for your excellent product and helpful advice.

New Post: Select multiple layers with cmSelection Tool

Hi, you should handle SelectBoxFinal event and call Shapefile.SelectShapes for each layer. Here is a single layer example. To run it for multiple layers something like this should be used:
for (int i = 0; i < axMap1.NumLayers; i++)
{
    int layerHandle = axMap1.get_LayerHandle(i);
    var sf = axMap1.get_Shapefile(layerHandle);
    if (sf != null)
    {
        //sf.SelectShapes
    }
}
Version 4.9.3 also has built-in in selection mechanism (ChooseLayer event should be handled). It's described in my post here . However it won't suit your needs, since there is no way to run it for multiple layers.

Hope this helps,
Sergei

New Post: AxMap.ZoomToSelected sometimes zooms more than needed

HI, most likely it's caused by AxMap.ZoomBehavior = zbUseTileLevels, which is set by default. It adjusts extents to the closest tile level. In theory it can only expand the extents, but apparently we have a bug there (those calculations are quite tricky).

To solve this you can:
a) call AxMap.ZoomOut() after zooming (optionally call AxMap.LockWindow to make it look like a single zoom);
b) set AxMap.ZoomBehavior = zbDefault and add more padding after zooming by expanding AxMap.Extents;
var ext = AxMap.Extents;
ext.GetBounds(...);
var extNew = new Extents();
extNew.SetBounds(...);   // larger extents
axMap1.Extents = extNew;
c) calculate extents of selected shapes yourself and add enough padding.

Unfortunately AxMap.ZoomToSelected doesn't use AxMap.ExtentPad property - it would be easier to handle it that way, I'll add its support in the next release.

Regards,
Sergei

New Post: VPN blocking mapwingis tiles

MapWinGIS uses CAtlHttpClient for tile requests. I believe it uses default port 80 since they are HTTP requests. URL naturally depends on the provider. I'd suggest to examine the issue with Fiddler. MapWinGIS requests can be intercepted by Fiddler by setting:
axMap1.Tiles.SetProxy("127.0.0.1", 8888);     // where 8888 is the default port Fiddler uses
Hope this helps,
Sergei
Viewing all 2341 articles
Browse latest View live