/// <summary> /// DynamicMap AfterDynamicDraw event handler method /// </summary> /// <param name="DynamicMapDrawPhase"></param> /// <param name="Display"></param> /// <param name="dynamicDisplay"></param> private void OnAfterDynamicDraw(esriDynamicMapDrawPhase DynamicMapDrawPhase, IDisplay Display, IDynamicDisplay dynamicDisplay) { try { if (DynamicMapDrawPhase != esriDynamicMapDrawPhase.esriDMDPDynamicLayers) { return; } //make sure that the display is valid as well as that the layer is visible if (null == dynamicDisplay || null == Display) { return; } tagRECT rect = Display.DisplayTransformation.get_DeviceFrame(); float rotation = (float)Display.DisplayTransformation.Rotation; if (m_bOnce) { //need to cache all the DynamicDisplay stuff m_dynamicGlyphFactory = dynamicDisplay.DynamicGlyphFactory; m_dynamicDrawScreen = (IDynamicDrawScreen)dynamicDisplay; m_dynamicSymbolProps = (IDynamicSymbolProperties)dynamicDisplay; //set the screen coordinates of the char symbol m_point = new ESRI.ArcGIS.Geometry.PointClass(); CreateDynamicGlyphs(m_dynamicGlyphFactory); m_bOnce = false; } //draw the OpenGL compass GL.glPushMatrix(); GL.glLoadIdentity(); //use OpenGL to do the drawings DrawTicks(rect, rotation); GL.glPopMatrix(); //please note that while you are rotating the map, the numbers showing in the HUD are //different than the number reported by the rotation tool. The reason for that is that //the reported map rotation is the mathematical angle while the HUD shows the angle from //the north (the map's azimuth). DrawAzimuths(rect, rotation); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message, "ERROR", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } }
private void DrawDynamicLogo(IDynamicDisplay dynamicDisplay) { if (m_bOnce) { //cast the DynamicDisplay into DynamicGlyphFactory m_dynamicGlyphFactory = dynamicDisplay.DynamicGlyphFactory; //cast the DynamicDisplay into DynamicSymbolProperties m_dynamicSymbolProps = dynamicDisplay as IDynamicSymbolProperties; m_dynamicDrawScreen = dynamicDisplay as IDynamicDrawScreen; //create the dynamic glyph for the logo m_logoGlyph = m_dynamicGlyphFactory.CreateDynamicGlyphFromFile(esriDynamicGlyphType.esriDGlyphMarker, m_logoPath, ESRI.ArcGIS.ADF.Connection.Local.Converter.ToRGBColor(Color.White)); m_point = new PointClass(); m_point.PutCoords(120, 160); m_bOnce = false; } m_dynamicSymbolProps.set_DynamicGlyph(esriDynamicSymbolType.esriDSymbolMarker, m_logoGlyph); m_dynamicSymbolProps.SetScale(esriDynamicSymbolType.esriDSymbolMarker, .435f, .435f); m_dynamicDrawScreen.DrawScreenMarker(m_point); }