I have a tool,something like Edit Tool in ArcMap,when I double click on mouse,and it selects a feature (polyline for example) and draw a sketch on it too,but if I change zoom,the sketch disapears because I draw sketch on the scrren.I know if I can draw sketch on into selection cache (bitmap) it will stay till selection changes,so it doesn't disapear with changing zoom.here are the steps i pass to draw the sketch with current situation:
HRESULT hr;//Get handle to memory device contextHDC HandleDC;short cacheCount;this->m_ipSDisp->get_CacheCount(&cacheCount);short cacheIdx=cacheCount-1;this->m_ipSDisp->get_CacheMemDC(cacheIdx,(OLE_HANDLE*)&HandleDC);if(FAILED(hr=this->m_ipSDisp->StartDrawing((OLE_HANDLE)HandleDC,cacheIdx)))return hr;//Draw feature herethis->m_ipSDisp->FinishDrawing();.............................................
Because ArcMap has at least 3 caches,1st for feature,2nd for annotation and graphics and 3rd for selection,i supposed the last feature index must be for selection cach,if I choose another index less than this,it doesn't even draw any thing.I checked this number and it always returns 2 for cachecount,I think because I don't have any graphics or annotation on map,it returns 2(at least I wish it is a true consumption).
but unfortunately it draws polyline on the screen because drawn polyline disapears at the first refresh of map.Is there something wrong with these procedure? May you tell me how I can draw a sketch on the selected feature just like Edit Tool in ArcMap?
أكثر...
- I take cache count into cachecount variable using screen display object
- I take a handle to device countext for cacheIndex=cachecount-1
- start drawing using 2 parameters in steps 1 and 24.vdraw polyline using screen display DrayPolyline
- FinishDrawing
HRESULT hr;//Get handle to memory device contextHDC HandleDC;short cacheCount;this->m_ipSDisp->get_CacheCount(&cacheCount);short cacheIdx=cacheCount-1;this->m_ipSDisp->get_CacheMemDC(cacheIdx,(OLE_HANDLE*)&HandleDC);if(FAILED(hr=this->m_ipSDisp->StartDrawing((OLE_HANDLE)HandleDC,cacheIdx)))return hr;//Draw feature herethis->m_ipSDisp->FinishDrawing();.............................................
Because ArcMap has at least 3 caches,1st for feature,2nd for annotation and graphics and 3rd for selection,i supposed the last feature index must be for selection cach,if I choose another index less than this,it doesn't even draw any thing.I checked this number and it always returns 2 for cachecount,I think because I don't have any graphics or annotation on map,it returns 2(at least I wish it is a true consumption).
but unfortunately it draws polyline on the screen because drawn polyline disapears at the first refresh of map.Is there something wrong with these procedure? May you tell me how I can draw a sketch on the selected feature just like Edit Tool in ArcMap?
أكثر...