The following code draws an image at the clicked point when the mouse is pressed:
Void CAddBasicResourceTool: OnMouseDownMap (short Button, short Shift, float X, float Y)
{
CMapXFeature ftr;
CMapXStyle style;
If (! M_pView) return;
Float screenX, screenY;
Double mapX, mapY;
ScreenX = X;
ScreenY = Y;
CHtMapX & m_MapX = m_pView-> GetMapX ();
If (m_MapX.GetCurrentTool () = MAP_ADDBASICRESOURCE_TOOL ){
If (ftr. CreateDispatch (ftr. GetClsid ())){
Ftr = m_MapX.GetFeatureFactory (). CreateSymbol ();
Style = FTR. getstyle ();
Style. setsymbolbitmapname ("CAR1-32.BMP ");
Style. setsymbolbitmapsize (32 );
Style. setsymbolbitmaptransparent (true );
FTR. setstyle (style );
M_mapx.convertcoord (& screenx, & screeny, & MapX, & mapy, miscreentomap );
FTR. getpoint (). Set (MapX, mapy );
If (! M_mapx.layerexist ("tmp ")){
M_mapx.getlayers (). createlayer ("tmp", "layertmp ");
}
M_MapX.GetLayers (). Item ("tmp"). AddFeature (ftr );
}
}
}