Hello! I want to use ShapeEditor class to edit Shape (AddPoint, Edit vertices, Delete points), when call StarEdit() function, report error :Shape editor is not attached to a map
I don’t know how to attach a map, I didn’t find the attach method. This is my code:
m_sf.CreateInstance(__uuidof(::Shapefile));
m_sf->CreateNewWithShapeID("", ShpfileType::SHP_POLYGON);
m_shp.CreateInstance(__uuidof(::Shape));
m_shp->Create(ShpfileType::SHP_POLYGON);
m_sf->EditAddShape(m_shp);
//ConfigStyle();
m_LineHandle = m_map->AddLayer(m_sf, true);
m_se.CreateInstance(__uuidof(::ShapeEditor));
m_sf->PutInteractiveEditing(-1);
VARIANT_BOOL b = m_se->StartEdit(m_LineHandle, 0);
m_se->PutEditorBehavior(tkEditorBehavior::ebVertexEditor);
long err = m_se->GetLastErrorCode();
CString estr = m_se->GetErrorMsg(err);
TRACE(estr);