Привет
Может кто нибудь столкнулся с этим.
тут есть фрагмент кода на C# и на C++. на C# все равотает а на
C++ результат не запоминается. Помогите если можно, пожалуйста.
C#
private void Editing2()
{
if (m_pCurrentLayer == null) return;
if ( (IGeoFeatureLayer)m_pCurrentLayer == null) return;
IFeatureLayer pFeatureLayer = (IFeatureLayer)m_pCurrentLayer;
IDataset pDataset = (IDataset)pFeatureLayer.FeatureClass;
if (pDataset== null) return;
IWorkspaceEdit pWorkspaceEdit = (IWorkspaceEdit)pDataset.Workspace;
if (!pWorkspaceEdit.IsBeingEdited())
{
pWorkspaceEdit.StartEditing(true);
pWorkspaceEdit.EnableUndoRedo();
}
pWorkspaceEdit.StartEditOperation();
IFeatureCursor pFeatureCursor = pFeatureLayer.FeatureClass.Search(null, false);
IFeature pFeature = pFeatureCursor.NextFeature();
while (pFeature != null)
{
pFeature.Delete();
pFeature = pFeatureCursor.NextFeature();
}
pWorkspaceEdit.StopEditOperation();
pWorkspaceEdit.StopEditing(true);
m_pMap.ClearSelection();
IActiveView pActiveView = (IActiveView)m_pMap;
pActiveView.Refresh();
}
VC++
HRESULT result;
if (m_ipCurrentLayer == NULL)
return;
if ( (IGeoFeatureLayerPtr)m_ipCurrentLayer == NULL)
return;
IFeatureLayerPtr ipFeatureLayer = (IFeatureLayerPtr) m_ipCurrentLayer;
IFeatureClassPtr ipFeatureClass;
result = ipFeatureLayer->get_FeatureClass(&ipFeatureClass);
if (ipFeatureClass == NULL)
return;
IDatasetPtr ipDataset = (IDatasetPtr)ipFeatureClass;
if (ipDataset == NULL)
return;
IWorkspacePtr ipWorkspace;
IWorkspaceEditPtr ipWorkspaceEdit;
result = ipDataset->get_Workspace(&ipWorkspace);
ipWorkspaceEdit = ipWorkspace;
VARIANT_BOOL IsBeingEdited;
result = ipWorkspaceEdit->IsBeingEdited(&IsBeingEdited);
if(!IsBeingEdited)
{
result = ipWorkspaceEdit->StartEditing(false);
}
result = ipWorkspaceEdit->StartEditOperation();
IFeaturePtr ipFeature;
IFeatureCursorPtr ipFeatureCursor;
result = ipFeatureClass->Search(NULL, false, &ipFeatureCursor);
result = ipFeatureCursor->NextFeature(&ipFeature);
while (ipFeature != NULL)
{
result = ipFeature->Delete();
result = ipFeatureCursor->NextFeature(&ipFeature);
}
result = ipWorkspaceEdit->StopEditOperation();
result = ipWorkspaceEdit->StopEditing(true);
m_ipMap->ClearSelection();
IActiveViewPtr ipActiveView = (IActiveViewPtr) m_ipMap;
result = ipActiveView->Refresh();
проблема возникаит при вызова функции
result =ipWorkspaceEdit->StopEditing(true);
после чего проподает изменение, а в C# все нормальною
Заранее спосибо