MapWindow 4 - ActiveX Control Programming : MapWindow Discussion Forum
hi friends i wrote blow code for clip but "tkClipOperation.clClip" return null and but other "tkClipOperation" propertise work very well and i just need "cclip" this is my code main_map = new Shapefile();
probleme with clipping
Posted by: ahmad_ferdinand ()
Date: March 26, 2012 03:12AM

hi friends
i wrote blow code for clip but "tkClipOperation.clClip" return null and but other
"tkClipOperation" propertise work very well and i just need "cclip"
this is my code

 main_map = new Shapefile();
            dest = new Shapefile();
            source = new Shapefile();
            Shape n = new Shape(); 
            Shape m = new Shape();
            main_map.Open(openFileDialog2.FileName, null);
            source.Open(@"C:\Users\Ahmad\Desktop\ahmad\nahie.shp", null);
            n = source.get_Shape(0); 
            for (int i = 0; i < main_map.NumShapes; i++)
            {
                if (main_map.get_Shape(i).Clip(n,tkClipOperation.clClip) != null) 
                {
                    main_map.set_ShapeSelected(i, true);
                }
            }
            dest = main_map.ExportSelection();
            dest.SaveAs("C:\\Users\\Ahmad\\Desktop\\clip.shp", null);

because return null saveas method throw exception , its mean clip never happen and i don't know why , mw4 clip a shapefile with a shapefile with one shape
and i gave that to my code but return null
thanks

[Edit: Added code tags for better reading]



Edited 1 time(s). Last edit at 03/28/2012 02:58AM by pmeems.

Re: probleme with clipping
Posted by: ahmad_ferdinand ()
Date: March 27, 2012 09:02AM

Friend please i need help

Re: probleme with clipping
Posted by: pmeems ()
Date: March 28, 2012 03:03AM

I don't understand what you want to try to do.

I think using shapefile.Clip() might work better:
[www.mapwindow.org]

Just set shape from source as selected and let MapWindow do the clipping.

--
Paul

--
Don't forget to read the new documentation: www.mapwindow.org/documentation/mapwingis4.8
Join us Google+: MapWindow GIS Google+ Community
Join the MapWindow Group on LinkedIn! LinkedIn - MapWindow Group

Download the latest beta installer at:
tinyurl.com/mwMonthly 32-Bit
tinyurl.com/mwMonthlyx64 64-Bit
Follow me on Twitter MapWindow_nl to read when a new installer is published.

---
Paul Meems
The Netherlands
[www.bontepaarden.nl]
Release manager, configuration manager and
forum moderator of MapWindow GIS

Owner of MapWindow.nl - Support for
Dutch speaking users: www.mapwindow.nl

*******
Everything I say or write is my personal opinion and
not the opinion of the company I work for.
*******
View my profile on LinkedIn

Re: probleme with clipping
Posted by: ahmad_ferdinand ()
Date: March 28, 2012 07:54AM

believe me , shapefile.clip or shape.clip both return null for each map i use
shapefile.clip always return null and shape.Clip(n,tkClipOperation.clClip) return null also , in mw4 in toolbox/old tools/clip shapefile with polygone/, work well
but in my code return null

thank you for your answers

Re: probleme with clipping
Posted by: ahmad_ferdinand ()
Date: March 29, 2012 12:48AM

hi friends
i used again "shapefile.clip(true,source,false) , but this time throw this exception : "AccessviolentException" , do you know what is this ? and how can i solve it ?
thank you

Re: probleme with clipping
Posted by: ahmad_ferdinand ()
Date: March 29, 2012 07:19AM

maybe this time it want return values but this exception is a snag
anybody knows what must do? thanks

Sorry, only registered users may post in this forum.





Banner Exchange




GISCP.com




Send us your banner logo (160x120) for the space above, and add this MapWindow banner ad to your site:

Just paste this text in your page: