|
POST
|
On my first topic I have found several interfaces that need to be checked to determine if an Edit Session can be safely started on SDE data. When dealing with SDE, you need to check if the feature class can be updated, deleted or inserted. For that you can use the ISQLPrivilege interface: Dim workspace As ESRI.ArcGIS.Geodatabase.IWorkspace = pDataset.Workspace ' Assume pDataset is assigned a Dataset If workspace.Type = esriWorkspaceType.esriRemoteDatabaseWorkspace Then Dim pFCName As IFeatureClassName = pDataset.FullName Dim pSQLPriv As ISQLPrivilege = pFCName If pSQLPriv.SQLPrivileges And esriSQLPrivilege.esriUpdatePrivilege <> esriSQLPrivilege.esriUpdatePrivilege Then ' Bitwise check for Update Privileges MsgBox("You do not have priveleges to update this feature class!") End If End If The Bitwise check can combine multiple states. For example to see if all edit priveleges are granted use: If pSQLPriv.SQLPrivileges And (esriSQLPrivilege.esriUpdatePrivilege Or esriSQLPrivilege.esriDeletePrivilege Or esriSQLPrivilege.esriInsertPrivilege) <> (esriSQLPrivilege.esriUpdatePrivilege Or esriSQLPrivilege.esriDeletePrivilege Or esriSQLPrivilege.esriInsertPrivilege) Then ' Bitwise check for All Edit Privileges Assuming the user has the approrpiate edit privileges you also need to check the current state of the Editor Options setting to permit versioned and non-versioned editing and compare it to the version status of the Dataset you want to edit. The IEditProperties3 interface tells whether the Editor Options are set to allow versioned or non-versioned editing while the IVersionedObject3 can determine if an SDE dataset object is versioned or non-versioned. The settings of the Editor and the Feature Class target must match to allow the Editor to be started: Dim pVO3 As IVersionedObject3 = pDataset ' Assume a valid SDE Dataset is assigned to this variable Dim pEP3 As IEditProperties3 = m_Editor ' assumes this variable is assigned with an instance of IEditor Dim MESM As esriMultiuserEditSessionMode = pEP3.MultiuserEditSessionMode If MESM = esriMultiuserEditSessionMode.esriMESMVersioned And Not pVO3.IsRegisteredAsVersioned Then ' Do something when the Edit Mode in set to versioned editing but the Dataset is non-versioned ElseIf MESM = esriMultiuserEditSessionMode.esriMESMNonVersioned And pVO3.IsRegisteredAsVersioned Then ' Do something when the Edit Mode in set to non-versioned editing but the Dataset is versioned End If The MultiuserEditSessionMode setting can used to notify the user that there is a mismatch or it can actually change the Editor Option setting to match the dataset. If the Editor Option is changed it should be reset back before the user can regain control or else the user should be allowed to determine if the tool should proceed and be notified of the change, since if the code does not change the setting back if will affect the user's ability to start or stop an edit session on versioned or non-versioned data. I hope this helps someone.
... View more
11-17-2011
09:02 AM
|
0
|
0
|
1787
|
|
POST
|
A few observations in my testing of a new set of routines based on the help I found. The help encourages the use of the Editor interfaces (IEditor, IEditor2 or IEditor3) for managing edit sessions rather than the Geodatabase interfaces (IWorkspaceEdit and IMultiuserWorkspaceEdit). This appears to relate to the locking behavior I mentioned in my second question and to my third question about refreshing the Desktop editing tools like the Sketch Properties window. The Editor interfaces are the only ones that affect what the user sees in Desktop. The Geodatabases interfaces do not. So if I use the Editor interfaces to start an edit session and an edit operation the Desktop responds by enabling the Editor menu and blanks out the Sketch Properties window. When the edit operation complete it does not leave a lock that prevents user actions with editor in Desktop. The operation can also be undone by the user through the normal undo interface if the edit session is left active and the edits are not saved. But if I use the Geodatabase interfaces the Desktop does not respond at all and any failure to complete the edit session with that interface when the user had not started an edit session will interfere with the user trying to start an edit session in Desktop if the program edit session did not complete. There also is no way for the user to undo the operation through the normal Desktop interface and only the program can manange any undo. So to the extent that the Geodatabase interfaces are used the edit session those interfaces manage has to be completely self contained and must complete all operations and edit sessions begun by those interfaces in the code. It appears to me that the Geodatabase interfaces are better suited to ArcCatalog operations rather than Desktop operations, given that these interfaces interfere with the Desktop edit session but do not give the user access through the normal interfaces to resolve any conflicts the program may have created and failed to resolve. In Desktop the Geodatabase interfaces can be used to test for certain edit states that are not available with the Editor interfaces, but only the Editor interfaces should be used to actually start or stop the editor or the edit operations in Desktop code.
... View more
11-16-2011
07:25 AM
|
0
|
0
|
1787
|
|
POST
|
I completed a Model that overlays several polygon layers, clips out a specified section, dissolves according to certain attributes and sums the acreage. What I want to do is add another Calculate Field entry into my Model, but I can't get the Field Calculation correct. The Fields I want to select from are [CAUVLCType] and [MUSYM]. The fields are coded-value domains and descriptions. What I've tried is similar to Label expressions: Function if ([CAUVLCType] = 'CROP' AND [MUSYM] = 'NpA') then [Soil_Acreage] * 460 elseif ([CAUVLCType] = 'WOOD' AND [MUSYM] = 'NpA') then [Soil_Acreage] * 100 End if End Function Can someone provide me a couple lines of code that will work on a copy/paste basis which I can repeat and enter different field descriptions as needed?! Thanks, Jeff Drop the Function brackets. They are not used in the Field Calculator. Also, if you are using VB Script, use double quotes not single quotes for literal strings. Finally you have to return a variable value to the expression in order to output your calculated values. Try these settings (use the expression builder in the Field Calculator tool): Parser: VB Script Code Block: Dim Output If ([CAUVLCType] = "CROP" AND [MUSYM] = "NpA") then Output = [Soil_Acreage] * 460 elseif ([CAUVLCType] = "WOOD" AND [MUSYM] = "NpA") then Output = [Soil_Acreage] * 100 End if Expression: Output
... View more
11-14-2011
07:34 PM
|
0
|
0
|
1271
|
|
POST
|
Thanks for that-very complicated methods to do a simple task and clunky too-thanks, I'm investigating but may be easier just to do it in MapInfo cheers You're welcome. Post a picture if you can get beyond your attitude. This "simple task" is not well described.
... View more
11-14-2011
07:27 PM
|
1
|
0
|
3927
|
|
POST
|
After searching the forums a little more I came across a few help topics that seem to deal with many of my questions. The most useful topics are Editing with the geodatabase API, Updating Features, Managing edit sessions and edit operations, IWorkspaceEdit Interface and IMultiuserWorkspaceEdit Interface It looks like I will need to revise my code substantially to properly implement the recommended practices for editing with ArcObjects. If I come up with a good workflow for properly checking the current state of the Editor relative to the layer I want to edit, determining appropriate editing options for a layer based on its data type, selecting the best method that enhances performance without compromising data, etc... I will post it here.
... View more
11-14-2011
10:33 AM
|
0
|
0
|
1787
|
|
POST
|
All the Python examples to work with geometry are for point features. Would someone please tell me how I can get the measure (not length) from a route feature class? Your help is greatly appreciated. Fardosht If all you want is the beginning or ending measure value of a line the code in the Field Calculator that works using Python (if you have 9.3 or up) is one of the following: !Shape.FirstPoint.M! !Shape.LastPoint.M! If you are wanting the measure at any point along the line I am not really sure if Python has an interface that replicates the ArcObjects IRouteLocator and IRouteLocation functionality.
... View more
11-14-2011
07:18 AM
|
0
|
0
|
568
|