MapWindow Developer Team : MapWindow Discussion Forum
Hello, I think there is a bug in CShapefile::StartEditingShapes, for there is no progress information output ("Reading shapes into memory") when I specify an ICallback parameter. I list my modification of this function: if( newpercent > perc
[BUG] Start Editing Shapefile with Progress Information
Posted by: neio ()
Date: July 19, 2009 09:44PM

Hello,

I think there is a bug in CShapefile::StartEditingShapes, for there is no progress information output ("Reading shapes into memory") when I specify an ICallback parameter.

I list my modification of this function:

if( newpercent > percent )
{
percent = newpercent;
if( cBack != NULL ) //Neio 2009/7/20
cBack->Progress(OLE2BSTR(key),percent,A2BSTR("Reading shapes into memory"));
else
if( globalCallback !=NULL)
globalCallback->Progress(OLE2BSTR(key),percent,A2BSTR("Reading shapes into memory"));
}


Regards,
Neio Zhou



Edited 1 time(s). Last edit at 07/19/2009 09:46PM by neio.

Options: ReplyQuote
Re: [BUG] Start Editing Shapefile with Progress Information
Posted by: Sergei ()
Date: July 20, 2009 04:56AM

Hi, Neio.

I agree with you. Also I found that there is one more such mistake in StartEditingShapes and a couple in StopEditingShapes function.
Maybe there are similar ommisions in other functions where local cBack variable is used as a parameter. It would be good to have all this cases fixed.

Maybe it would be better to assign two callbacks to one variable to avoid superfluous code on each occasion we want to report something.
Someting like this (vb6):

' in the beginning
if (cBack is nothing) and not (globalCallback is nothing) then
set cBack = globalCallback
end if

' on each occasion later
If not (cBack is nothing) then
msgbox "We got error"
end if

Regards Sergei.

Options: ReplyQuote
Re: [BUG] Start Editing Shapefile with Progress Information
Posted by: pmeems ()
Date: July 20, 2009 02:09PM

Sergei and Neio,

Thanks for catching these. Would you mind reporting it as a bug in Mantis

Sergei, if I'm correct you've made some fixes in the past. Would you mind fixing these as well?

Thanks,

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

Options: ReplyQuote
Re: [BUG] Start Editing Shapefile with Progress Information
Posted by: Sergei ()
Date: July 20, 2009 04:18PM

Hello, Paul.

I've made changes in my local copy. Functions affected:
CShapefile::EditDeleteField
CShapefile::EditInsertField
CShapefile::Open
CShapefile::SaveAs
CShapefile::StartEditingShapes
CShapefile::StartEditingTable
CShapefile::StopEditingShapes
CShapefile::StopEditingTable

//I added these lines in the beginning of the functions
if(cBack == NULL && globalCallback!=NULL)
cBack = globalCallback;

// and excluded second condition in all cases
if( cBack != NULL )
cBack->Error( OLE2BSTR(key), A2BSTR(ErrorMsg(lastErrorCode) ) );
// else if( globalCallback != NULL )
// globalCallback ->Error( OLE2BSTR(key), A2BSTR(ErrorMsg(lastErrorCode) ) );

I'll commit changes as soon as the team approves them.

Options: ReplyQuote
Re: [BUG] Start Editing Shapefile with Progress Information
Posted by: pmeems ()
Date: July 21, 2009 03:51PM

Sergei,

I've asked Chris M. to look at your code.

Because you've already changed stuff at StopEditingShapes() would you mind looking at this bug 1344
Perhaps you can fix it easily.

Thanks,

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

Options: ReplyQuote
Re: [BUG] Start Editing Shapefile with Progress Information
Posted by: cmichaelis ()
Date: July 21, 2009 04:09PM

I see no problem with calling the progress callback on these functions - I'd say go for it. Commit away.

Cheers,
--Chris

Options: ReplyQuote
Re: [BUG] Start Editing Shapefile with Progress Information
Posted by: Sergei ()
Date: July 22, 2009 06:07AM

Commited.

Paul, I also examined this problem (bug 1344). See [www.mapwindow.org]. I think a thorough analysis is needed on what ocx does with file handles to solve this. My guess is that ocx keeps open too much files at once. Maybe it'll be usefull to find out what files are actually opened while they are loaded in ocx (try to delete shp, shx, dbf files). Then to do the same thing with ArcGis.

Regards Sergei

Options: ReplyQuote
Re: [BUG] Start Editing Shapefile with Progress Information
Posted by: Sergei ()
Date: July 22, 2009 06:34AM

Paul, I tested it.

Mapwingis keeps all three files open, while arcgis - none of them (it's possible to delete all three files while they are loaded). It's rather likely that the problem will disappear if we'll begin to close files after they were actually drawn.

Options: ReplyQuote


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: