MapXtreme 2005 learning experience some problems (eight)

First on a MapXtreme ugly picture

This is only a thousand mountains after I get out of the effect.

During the process, there will be some problems often being given almost no information on the Internet can be solved, I read a lot of practice, repeatedly click on the error code annotation step by step approach.

Finally there is a small achievement.

Table.BeginAccess (TableAccessMode.Write); this code, the error rate is very high.

We modify a table, usually begin to look, and then deal with, and then end it after processing

In repeated begin and end, once you get lock on the error. Usually cause this problem, another table is being processed, exception occurs after you try completely, caused no endAccess

 Table.DeleteFeature (feature); report of this code is also high, circulated on the Internet so some code:

foreach (Featrue fea  in  Table)
{
  Table.DeleteFeature(feature);
}

Description:

05233705_VgZj.gif
Used to delete data tables, where the error rate is usually due to Table.BeginAccess (TableAccessMode.Write); this anomaly caused

so the best treatment is to try it Table.BeginAccess (TableAccessMode.Write); the normal, and then delete the data table

there is little mention, in fact, there's something from the Table finally execute the Delete 
the wHERE  MKEY = @mkey such statement, it would have meant a one execution.

Not as direct execution delete from table to OK, foreach to do. That MISql operation, and operation ADO.net almost a kind of, do not worry not.

 

 

The last one is the most serious problem.

The problem arises is this: draw a point on the map, a good start, then tap to zoom in or small, will be a normal, one would then point missing, then tap, point out again, so back and forth complex.

For a normal, not normal for a while.

Numerous studies show that repeated often: the map is in the presence of Session, the study found, often uncertainty Session will be lost, so it's best to add some processing logic stippled in:

 

 

I handled this way:

05233705_VgZj.gif
if  (CommonHelper.Get < string > ( " Command " "" ==   ""   ||  map.CustomProperties[ " layerCount " ==   null   ||  ( int )map.CustomProperties[ " layerCount " !=  map.Layers.Count)
            {
                
                RUnitMapView mapView 
=   new  RUnitMapView(map);
                map.CustomProperties[
" layerCount " =  map.Layers.Count; // Layer Session of loss prevention             }

 

Description:

Looking for a place to save the map under several layers, due after generating points, and map layers will be the initial layer is not the same. So, with this do for the judge Session is lost.

If the Session is lost, reload it processes the data points. In this way, finally solved the problem.

 

 

 

Reproduced in: https: //my.oschina.net/secyaher/blog/274313

Guess you like

Origin blog.csdn.net/weixin_34321977/article/details/91967003