Usually a lot of read and write vector data properties are not many, occasionally operate a small number of vector data, the habit does not open the editing state.
Today Curiosity Baidu summed up the next time should open the editing state.
First, summary
- The actions you make require recovery and redo, especially long transaction operations.
- Prevent storage from failing.
- When you connect to the database.
Second, doubts
Do I need to turn on editing when I edit shp?
Before seems to have encountered the same problem with the startediting () here
void Updatefeature (IFeature if,igeometry Igeo)
{
Idataset Idataset = If.class as Idataset;
Iworkspaceedit Iworkspaedit = idataset.workspace as Iworkspaceedit;
Iworkspaedit.startediting (TRUE);//Why not have this code.
Iworkspaedit.starteditoperation ();
If.shape = Igeo;
If.store ();
Iworkspaedit.stopeditoperation ();
Iworkspaedit.stopediting (TRUE);
}
A problem was found when updating the shape file, iworkspaedit.startediting (TRUE);//After using this code, always If.store (); exit immediately, resulting in the inability to edit.
Later, asked a colleague, he said shape does not need, because there is no problem of multi-user editing.
Third, reference
Reference One: Some thoughts of Iworkspaceedit
Today finally completed the conversion of VCT, far beyond the expected time. The main is not to show the geometrical data, that is, no storage. Finally the reason, did not get igeometry feature call store, that is, the geometry information is not saved. The Featureclass will show that you have created the feature. So judging from the number of records above the attribute, I thought it was right.
In addition, it is not known at first that you can use Feature.stroe without calling Iworkspaceedit. It is mainly the beginning of the influence of the Elder. Today, I looked closely at Iworkspaceedit's documentation, which said that when you want to edit an object, it is best to open the editing state, except when individual objects are edited . When you connect to a database, you must use edit state . There are seven rules that you can refer to.
Another thing to say is that if you open the edit state, you must call Feature.store, or call discard. Otherwise, it sometimes throws an exception. I think so, edit state, but look iworkspace this kind of name, know is to create a workspace, when the changed information is not saved by feature, the workspace does not automatically release the stored change information, and this time off the workspace and editing state, Then the memory will leak, throw an exception, it is logical
Reference Two: a detailed description of the open editor, seven rules can read starteditoperation and StartEdit
This is also what we call a transaction, and if you want the operation to return and redo, you have to write the code between the iworkspaceedit startediting () and the StopEditing () function. Write the relevant actions between the Iworkspaceedit starteditoperation () and stopeditoperation () .
Reference three: Here content rich Iworkspaceedit interface
It is strongly recommended that you use the edit session to perform insert,update or delete operations in edit operation. Although it is not necessary to specify the start and end of an edit operation, the result is indeterminate, depending on the state of the database operation, and even the changes that are made cannot be implemented and an error occurs. For this reason, all editing operations should be in edit operation.
Geodatabase ensures that the only instance of the row object in database is during the edit session. A geodatabase does not support nested transactions, and only one transaction can be opened at a time when editing in a version of an environment in an SDE geodatabase. This means that when you edit multiple versions under one connection, when you call Startediting on another version, you first call stopediting on the first version. Opening another transaction before closing the first transaction returns the application with a OPER transaction error. This error can be avoided by calling Isbeingedited before calling Startediting in the program. Make
AE edit vector must need iworkspaceedit to open startediting?