/// <summary> /// Draw the layer while in dynamic mode /// </summary> /// <param name="DynamicDrawPhase"></param> /// <param name="Display"></param> /// <param name="DynamicDisplay"></param> public override void DrawDynamicLayer(esriDynamicDrawPhase DynamicDrawPhase, IDisplay Display, IDynamicDisplay DynamicDisplay) { if (DynamicDrawPhase != esriDynamicDrawPhase.esriDDPCompiled) return; if (!m_bValid || !m_visible) return; if (m_bDDOnce) { m_dynamicGlyphFactory = DynamicDisplay.DynamicGlyphFactory as IDynamicGlyphFactory2; m_dynamicSymbolProperties = DynamicDisplay as IDynamicSymbolProperties2; m_dynamicCompoundMarker = DynamicDisplay as IDynamicCompoundMarker2; m_textGlyph = m_dynamicGlyphFactory.get_DynamicGlyph(1, esriDynamicGlyphType.esriDGlyphText, 1); // create glyph for the selection symbol if (m_selectionSymbol == null) InitializeSelectionSymbol(); m_selectionGlyph = m_dynamicGlyphFactory.CreateDynamicGlyph(m_selectionSymbol); m_bDDOnce = false; } m_display = Display; double lat, lon; int iconCode; int iconWidth = 0; bool selected; IDynamicGlyph dynamicGlyph = null; float symbolSized; string citiName = string.Empty; string temperature = string.Empty; //loop through the rows. Draw each row that has a shape foreach (DataRow row in m_table.Rows) { //get the Lat/Lon of the item lat = Convert.ToDouble(row[3]); lon = Convert.ToDouble(row[4]); //get the icon ID iconCode = Convert.ToInt32(row[8]); // get citiname and temperature citiName = Convert.ToString(row[2]); temperature = string.Format("{0} F", row[5]); //get the selection state of the item selected = Convert.ToBoolean(row[13]); //search for the symbol in the symbology table dynamicGlyph = GetDynamicGlyph(m_dynamicGlyphFactory, iconCode, row, out iconWidth); if (null == dynamicGlyph) continue; m_point.X = lon; m_point.Y = lat; m_point.SpatialReference = m_spatialRef; //reproject the point to the DataFrame's spatial reference if (null != m_spatialRef && m_mapSpatialRef.FactoryCode != m_layerSRFactoryCode) m_point.Project(m_mapSpatialRef); symbolSized = 1.35f * (float)(m_symbolSize / (double)iconWidth); // draw the weather item // 1. set the whether symbol properties m_dynamicSymbolProperties.set_DynamicGlyph(esriDynamicSymbolType.esriDSymbolMarker, dynamicGlyph); m_dynamicSymbolProperties.set_RotationAlignment(esriDynamicSymbolType.esriDSymbolMarker, esriDynamicSymbolRotationAlignment.esriDSRAScreen); m_dynamicSymbolProperties.set_Heading(esriDynamicSymbolType.esriDSymbolMarker, 0.0f); m_dynamicSymbolProperties.SetColor(esriDynamicSymbolType.esriDSymbolMarker, 1.0f, 1.0f, 1.0f, 1.0f); m_dynamicSymbolProperties.SetScale(esriDynamicSymbolType.esriDSymbolMarker, symbolSized, symbolSized); m_dynamicSymbolProperties.set_Smooth(esriDynamicSymbolType.esriDSymbolMarker, false); // 2. set the text properties m_dynamicSymbolProperties.set_DynamicGlyph(esriDynamicSymbolType.esriDSymbolText, m_textGlyph); m_dynamicSymbolProperties.set_RotationAlignment(esriDynamicSymbolType.esriDSymbolMarker, esriDynamicSymbolRotationAlignment.esriDSRAScreen); m_dynamicSymbolProperties.set_Heading(esriDynamicSymbolType.esriDSymbolText, 0.0f); m_dynamicSymbolProperties.SetColor(esriDynamicSymbolType.esriDSymbolText, 0.0f, 0.85f, 0.0f, 1.0f); m_dynamicSymbolProperties.SetScale(esriDynamicSymbolType.esriDSymbolText, 1.0f, 1.0f); m_dynamicSymbolProperties.set_Smooth(esriDynamicSymbolType.esriDSymbolText, false); m_dynamicSymbolProperties.TextBoxUseDynamicFillSymbol = false; m_dynamicSymbolProperties.TextBoxHorizontalAlignment = esriTextHorizontalAlignment.esriTHACenter; m_dynamicSymbolProperties.TextRightToLeft = false; // draw both the icon and the text as a compound marker m_dynamicCompoundMarker.DrawCompoundMarker2(m_point, temperature, citiName); if (selected) // draw the selected symbol { m_dynamicSymbolProperties.SetColor(esriDynamicSymbolType.esriDSymbolMarker, 0.0f, 1.0f, 1.0f, 1.0f); m_dynamicSymbolProperties.set_DynamicGlyph(esriDynamicSymbolType.esriDSymbolMarker, m_selectionGlyph); DynamicDisplay.DrawMarker(m_point); } } base.m_bIsCompiledDirty = false; }
/// <summary> /// DynamicMap AfterDynamicDraw event handler method /// </summary> /// <param name="DynamicMapDrawPhase"></param> /// <param name="Display"></param> /// <param name="dynamicDisplay"></param> 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; if (m_bOnce) { //get the device frame size m_deviceFrame = Display.DisplayTransformation.get_DeviceFrame(); //start listening to display events ((ITransformEvents_Event)Display.DisplayTransformation).DeviceFrameUpdated += new ITransformEvents_DeviceFrameUpdatedEventHandler(OnDeviceFrameUpdated); CreateDisplayLists(); m_bOnce = false; } GL.glPushMatrix(); GL.glLoadIdentity(); //draw the compass list GL.glPushMatrix(); GL.glTranslatef((float)m_deviceFrame.left + 70.0f, (float)m_deviceFrame.top + 70.0f, 0.0f); GL.glScalef(90.0f, 90.0f, 0.0f); GL.glRotatef((float)Display.DisplayTransformation.Rotation, 0.0f, 0.0f, 1.0f); GL.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); GL.glCallList(m_compassList); GL.glPopMatrix(); GL.glPopMatrix(); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message, "ERROR", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } }
private void OnTimerElapsed(IDisplay Display, IDynamicDisplay dynamicDisplay) { try { //make sure that the current tracking point index does not exceed the list index if (m_pointIndex == (m_points.Count - 1)) { m_pointIndex = 0; return; } //get the current and the next track location WKSPoint currentPoint = m_points[m_pointIndex]; WKSPoint nextPoint = m_points[m_pointIndex + 1]; //calculate the azimuth to the next location double azimuth = (180.0 / Math.PI) * Math.Atan2(nextPoint.X - currentPoint.X, nextPoint.Y - currentPoint.Y); //set the navigation data structure m_navigationData.X = currentPoint.X; m_navigationData.Y = currentPoint.Y; m_navigationData.Azimuth = azimuth; //update the map extent and rotation CenterMap(m_navigationData); //increment the tracking point index m_pointIndex++; } catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex.Message); } }
void OnAfterDynamicDraw(esriDynamicMapDrawPhase DynamicMapDrawPhase, IDisplay Display, IDynamicDisplay dynamicDisplay) { if (DynamicMapDrawPhase != esriDynamicMapDrawPhase.esriDMDPDynamicLayers) return; if (m_bDrawOnce) { //cast the DynamicDisplay into DynamicGlyphFactory m_dynamicGlyphFactory = dynamicDisplay.DynamicGlyphFactory as IDynamicGlyphFactory2; //cast the DynamicDisplay into DynamicSymbolProperties m_dynamicSymbolProps = dynamicDisplay as IDynamicSymbolProperties2; //create the VW dynamic marker glyph from the embedded bitmap resource Bitmap bitmap = new Bitmap(GetType(), "VW.bmp"); //get bitmap handler int hBmp = bitmap.GetHbitmap().ToInt32(); //set white transparency color IColor whiteTransparencyColor = ESRI.ArcGIS.ADF.Connection.Local.Converter.ToRGBColor(Color.FromArgb(0, 0, 0)) as IColor; //get the VM dynamic marker glyph m_VWmarkerGlyph = m_dynamicGlyphFactory.CreateDynamicGlyphFromBitmap(esriDynamicGlyphType.esriDGlyphMarker, hBmp, false, whiteTransparencyColor); m_bDrawOnce = false; } //set the symbol alignment so that it will align with towards the symbol heading m_dynamicSymbolProps.set_RotationAlignment(esriDynamicSymbolType.esriDSymbolMarker, esriDynamicSymbolRotationAlignment.esriDSRANorth); //set the symbol's properties m_dynamicSymbolProps.set_DynamicGlyph(esriDynamicSymbolType.esriDSymbolMarker, m_VWmarkerGlyph); m_dynamicSymbolProps.SetScale(esriDynamicSymbolType.esriDSymbolMarker, 1.3f, 1.3f); m_dynamicSymbolProps.SetColor(esriDynamicSymbolType.esriDSymbolMarker, 1.0f, 1.0f, 0.0f, 1.0f); // yellow //set the heading of the current symbol m_dynamicSymbolProps.set_Heading(esriDynamicSymbolType.esriDSymbolMarker, (float)m_navigationData.Azimuth); //draw the current location dynamicDisplay.DrawMarker(m_point); }
private void DrawLapInfo(IDynamicDisplay dynamicDisplay) { string lapCount; string lapInfo; string lapHeartRateInfo; lock (m_bikePositionInfo) { lapCount = string.Format("Lap #{0}", m_bikePositionInfo.lapCount); lapInfo = string.Format("Lap information:\nDistance: {0}m\nMaximum speed - {1}\nCalories - {2}", m_bikePositionInfo.lapDistanceMeters.ToString("#####.#"), m_bikePositionInfo.lapMaximumSpeed.ToString("###.#"), m_bikePositionInfo.lapCalories); lapHeartRateInfo = string.Format("Lap heart rate info:\nAverage - {0}\nMaximum - {1}", m_bikePositionInfo.lapAverageHeartRate, m_bikePositionInfo.lapMaximumHeartRate); } m_dynamicSymbolProperties.set_DynamicGlyph(esriDynamicSymbolType.esriDSymbolMarker, m_catGlyph); m_dynamicSymbolProperties.SetColor(esriDynamicSymbolType.esriDSymbolMarker, 1.0f, 1.0f, 1.0f, 1.0f); m_dynamicSymbolProperties.SetScale(esriDynamicSymbolType.esriDSymbolMarker, 1.0f, 1.0f); m_dynamicSymbolProperties.set_RotationAlignment(esriDynamicSymbolType.esriDSymbolMarker, esriDynamicSymbolRotationAlignment.esriDSRAScreen); m_dynamicSymbolProperties.set_Heading(esriDynamicSymbolType.esriDSymbolMarker, 0.0f); m_dynamicSymbolProperties.TextBoxUseDynamicFillSymbol = true; m_dynamicSymbolProperties.SetColor(esriDynamicSymbolType.esriDSymbolText, 0.0f, 0.8f, 0.0f, 1.0f); m_dynamicSymbolProperties.SetColor(esriDynamicSymbolType.esriDSymbolFill, 0.0f, 0.0f, 0.0f, 1.0f); m_dynamicSymbolProperties.TextBoxHorizontalAlignment = esriTextHorizontalAlignment.esriTHALeft; m_textGlyph.SetAnchor(0.0f, 0.0f); m_dynamicSymbolProperties.set_DynamicGlyph(esriDynamicSymbolType.esriDSymbolText, m_textGlyph); string[] strLapInfo = new string[] { lapCount, lapInfo, lapHeartRateInfo }; m_dynamicCompoundMarker.DrawScreenArrayMarker(m_additionalInfoPoint, ref nullString, ref nullString, ref strLapInfo, ref nullString, ref nullString); }
public override void DrawDynamicLayer(esriDynamicDrawPhase DynamicDrawPhase, IDisplay Display, IDynamicDisplay DynamicDisplay) { if (DynamicDrawPhase != esriDynamicDrawPhase.esriDDPImmediate) return; if (!m_bValid || !m_visible) return; IEnvelope visibleExtent = Display.DisplayTransformation.FittedBounds; if (m_bOnce) { IDynamicGlyphFactory dynamicGlyphFactory = DynamicDisplay.DynamicGlyphFactory; m_dynamicSymbolProps = DynamicDisplay as IDynamicSymbolProperties2; ICharacterMarkerSymbol markerSymbol = new CharacterMarkerSymbolClass(); markerSymbol.Font = ESRI.ArcGIS.ADF.Connection.Local.Converter.ToStdFont(new Font("ESRI Default Marker", 25.0f, FontStyle.Bold)); markerSymbol.Size = 25.0; // set the symbol color to white markerSymbol.Color = (IColor)ESRI.ArcGIS.ADF.Connection.Local.Converter.ToRGBColor(Color.FromArgb(255, 255, 255)); markerSymbol.CharacterIndex = 92; // create the dynamic glyph m_myGlyph = dynamicGlyphFactory.CreateDynamicGlyph((ISymbol)markerSymbol); Random r = new Random(); double X = visibleExtent.XMin + r.NextDouble() * visibleExtent.Width; double Y = visibleExtent.YMin + r.NextDouble() * visibleExtent.Height; m_point = new PointClass(); m_point.PutCoords(X, Y); m_stepX = visibleExtent.Width / 250; m_stepY = visibleExtent.Height / 250; // start the update timer m_updateTimer.Enabled = true; m_bOnce = false; } // draw the marker m_dynamicSymbolProps.set_DynamicGlyph(esriDynamicSymbolType.esriDSymbolMarker, m_myGlyph); m_dynamicSymbolProps.SetColor(esriDynamicSymbolType.esriDSymbolMarker, 1.0f, 0.0f, 0.0f, 1.0f); m_dynamicSymbolProps.SetScale(esriDynamicSymbolType.esriDSymbolMarker, 1.0f, 1.0f); DynamicDisplay.DrawMarker(m_point); // update the point location for the next draw cycle m_point.X += m_stepX; m_point.Y += m_stepY; // make sure that the point fall within the visible extent if (m_point.X > visibleExtent.XMax) m_stepX = -Math.Abs(m_stepX); if (m_point.X < visibleExtent.XMin) m_stepX = Math.Abs(m_stepX); if (m_point.Y > visibleExtent.YMax) m_stepY = -Math.Abs(m_stepY); if (m_point.Y < visibleExtent.YMin) m_stepY = Math.Abs(m_stepY); // set the dirty flag to false since drawing is done. base.m_bIsImmediateDirty = false; }
private void DrawHeartRateAnimation(IDynamicDisplay dynamicDisplay, IPoint bikePoint) { m_dynamicSymbolProperties.set_DynamicGlyph(esriDynamicSymbolType.esriDSymbolMarker, m_heartRateGlyph[m_heartRateCounter]); m_dynamicSymbolProperties.SetColor(esriDynamicSymbolType.esriDSymbolMarker, 1.0f, 1.0f, 1.0f, 1.0f); m_dynamicSymbolProperties.SetScale(esriDynamicSymbolType.esriDSymbolMarker, 1.0f, 1.0f); m_dynamicSymbolProperties.set_RotationAlignment(esriDynamicSymbolType.esriDSymbolMarker, esriDynamicSymbolRotationAlignment.esriDSRAScreen); m_dynamicSymbolProperties.set_Heading(esriDynamicSymbolType.esriDSymbolMarker, 0.0f); dynamicDisplay.DrawMarker(bikePoint); m_textGlyph.SetAnchor(-35.0f, -50.0f); m_dynamicSymbolProperties.set_DynamicGlyph(esriDynamicSymbolType.esriDSymbolText, m_textGlyph); m_dynamicSymbolProperties.TextBoxUseDynamicFillSymbol = true; m_dynamicSymbolProperties.SetColor(esriDynamicSymbolType.esriDSymbolText, 0.0f, 0.8f, 0.0f, 1.0f); m_dynamicSymbolProperties.SetColor(esriDynamicSymbolType.esriDSymbolFill, 0.0f, 0.0f, 0.0f, 1.0f); m_dynamicSymbolProperties.TextBoxHorizontalAlignment = esriTextHorizontalAlignment.esriTHALeft; dynamicDisplay.DrawText(bikePoint, m_heartRateString); m_textGlyph.SetAnchor(-20.0f, -30.0f); m_dynamicSymbolProperties.set_DynamicGlyph(esriDynamicSymbolType.esriDSymbolText, m_textGlyph); dynamicDisplay.DrawText(bikePoint, m_altitudeString); if (m_drawCycles % 5 == 0) { m_heartRateCounter++; if (m_heartRateCounter > 4) m_heartRateCounter = 0; } m_drawCycles++; if (m_drawCycles == 5) m_drawCycles = 0; }
private void DrawGPSInfo(IDynamicDisplay dynamicDisplay, IPoint gpsPosition) { // altitude is already available string course; string speed; lock (m_bikePositionInfo) { course = string.Format("Course {0} DEG", m_bikePositionInfo.course.ToString("###.##")); speed = string.Format("Speed {0} MPH", m_bikePositionInfo.speed.ToString("###.##")); } string gpsInfo = string.Format("{0}\n{1}\n{2}", course, speed, m_altitudeString); m_textGlyph.SetAnchor(-35.0f, -47.0f); m_dynamicSymbolProperties.set_DynamicGlyph(esriDynamicSymbolType.esriDSymbolText, m_textGlyph); m_dynamicSymbolProperties.TextBoxUseDynamicFillSymbol = true; m_dynamicSymbolProperties.set_Heading(esriDynamicSymbolType.esriDSymbolText, 0.0f); m_dynamicSymbolProperties.SetColor(esriDynamicSymbolType.esriDSymbolText, 0.0f, 0.8f, 0.0f, 1.0f); m_dynamicSymbolProperties.SetScale(esriDynamicSymbolType.esriDSymbolText, 1.0f, 1.0f); m_dynamicSymbolProperties.SetColor(esriDynamicSymbolType.esriDSymbolFill, 0.0f, 0.0f, 0.0f, 0.6f); m_dynamicSymbolProperties.TextBoxHorizontalAlignment = esriTextHorizontalAlignment.esriTHALeft; dynamicDisplay.DrawText(m_gpsPosition, gpsInfo); m_dynamicSymbolProperties.set_DynamicGlyph(esriDynamicSymbolType.esriDSymbolMarker, m_gpsGlyph); m_dynamicSymbolProperties.SetColor(esriDynamicSymbolType.esriDSymbolMarker, 1.0f, 1.0f, 1.0f, 1.0f); m_dynamicSymbolProperties.SetScale(esriDynamicSymbolType.esriDSymbolMarker, m_gpsSymbolScale, m_gpsSymbolScale); m_dynamicSymbolProperties.set_RotationAlignment(esriDynamicSymbolType.esriDSymbolMarker, esriDynamicSymbolRotationAlignment.esriDSRANorth); m_dynamicSymbolProperties.set_Heading(esriDynamicSymbolType.esriDSymbolMarker, (float)(m_heading - 90)); dynamicDisplay.DrawMarker(m_gpsPosition); if (m_drawCycles % 5 == 0) { // increment the symbol size m_gpsSymbolScale += 0.05f; if (m_gpsSymbolScale > 1.2f) m_gpsSymbolScale = 0.8f; } m_drawCycles++; if (m_drawCycles == 5) m_drawCycles = 0; }
void OnDynamicMapStarted(IDisplay Display, IDynamicDisplay dynamicDisplay) { lock (m_bikePositionInfo) { // update the bike position if (m_bikePositionInfo.positionCount != m_bikePositionCount) { // update the geometry m_gpsPosition.PutCoords(m_bikePositionInfo.position.X, m_bikePositionInfo.position.Y); // check if needed to update the map extent if (m_bTrackMode) { IEnvelope mapExtent = m_hookHelper.ActiveView.ScreenDisplay.DisplayTransformation.FittedBounds; mapExtent.CenterAt(m_gpsPosition); m_hookHelper.ActiveView.ScreenDisplay.DisplayTransformation.VisibleBounds = mapExtent; } // update the bike trail m_wksPoints[0] = m_bikePositionInfo.position; m_geometryBridge.AddWKSPoints(m_bikeRouteGeometry, ref m_wksPoints); // get the GPS altitude reading m_altitudeString = string.Format("Altitude: {0} m", m_bikePositionInfo.altitudeMeters.ToString("####.#")); if (m_playbackFormat == GPSPlaybackFormat.HST) { // calculate the heading m_heading = Math.Atan2(m_bikePositionInfo.position.X - m_wksPrevPosition.X, m_bikePositionInfo.position.Y - m_wksPrevPosition.Y); m_heading *= (180 / Math.PI); if (m_heading < 0) m_heading += 360; m_heartRateString = string.Format("{0} BPM", m_bikePositionInfo.heartRate); } else { m_heading = m_bikePositionInfo.course; m_speed = string.Format("Speed: {0} MPH", m_bikePositionInfo.speed.ToString("###.#")); } m_wksPrevPosition.X = m_bikePositionInfo.position.X; m_wksPrevPosition.Y = m_bikePositionInfo.position.Y; m_bikePositionCount = m_bikePositionInfo.positionCount; } } // explicitly call refresh in order to make the dynamic display fire AfterDynamicDraw event m_hookHelper.ActiveView.Refresh(); }
private void OnAfterDynamicDraw(esriDynamicMapDrawPhase DynamicMapDrawPhase, IDisplay Display, IDynamicDisplay dynamicDisplay) { if (DynamicMapDrawPhase != esriDynamicMapDrawPhase.esriDMDPDynamicLayers) return; // initialize symbology for dynamic drawing if (m_bOnce) { // create the glyphs for the bike position as well as for the route IDynamicGlyphFactory2 dynamicGlyphFactory = dynamicDisplay.DynamicGlyphFactory as IDynamicGlyphFactory2; IColor whiteTransparentColor = (IColor)ESRI.ArcGIS.ADF.Connection.Local.Converter.ToRGBColor(Color.FromArgb(255, 255, 255)); Bitmap bitmap = new Bitmap(GetType(), "Icons.bicycle-icon.bmp"); m_bikeGlyph = dynamicGlyphFactory.CreateDynamicGlyphFromBitmap(esriDynamicGlyphType.esriDGlyphMarker, bitmap.GetHbitmap().ToInt32(), false, whiteTransparentColor); bitmap = new Bitmap(GetType(), "Icons.cat.bmp"); m_catGlyph = dynamicGlyphFactory.CreateDynamicGlyphFromBitmap(esriDynamicGlyphType.esriDGlyphMarker, bitmap.GetHbitmap().ToInt32(), false, whiteTransparentColor); bitmap = new Bitmap(GetType(), "Icons.gps.png"); m_gpsGlyph = dynamicGlyphFactory.CreateDynamicGlyphFromBitmap(esriDynamicGlyphType.esriDGlyphMarker, bitmap.GetHbitmap().ToInt32(), false, whiteTransparentColor); ISymbol routeSymbol = CreateBikeRouteSymbol(); m_bikeRouteGlyph = dynamicGlyphFactory.CreateDynamicGlyph(routeSymbol); // create the heart rate glyphs series CreateHeartRateAnimationGlyphs(dynamicGlyphFactory); // get the default internal text glyph m_textGlyph = dynamicGlyphFactory.get_DynamicGlyph(1, esriDynamicGlyphType.esriDGlyphText, 1); // do one time casting m_dynamicSymbolProperties = dynamicDisplay as IDynamicSymbolProperties2; m_dynamicCompoundMarker = dynamicDisplay as IDynamicCompoundMarker2; m_dynamicScreenDisplay = dynamicDisplay as IDynamicScreenDisplay; m_bOnce = false; } // draw the trail m_dynamicSymbolProperties.set_DynamicGlyph(esriDynamicSymbolType.esriDSymbolLine, m_bikeRouteGlyph); m_dynamicSymbolProperties.SetColor(esriDynamicSymbolType.esriDSymbolLine, 1.0f, 1.0f, 1.0f, 1.0f); m_dynamicSymbolProperties.SetScale(esriDynamicSymbolType.esriDSymbolLine, 1.0f, 1.0f); m_dynamicSymbolProperties.LineContinuePattern = true; dynamicDisplay.DrawPolyline(m_bikeRouteGeometry); if (m_playbackFormat == GPSPlaybackFormat.HST) { // adjust the bike lap additional info point to draw at the top left corner of the window m_additionalInfoPoint.Y = Display.DisplayTransformation.get_DeviceFrame().bottom - 70; // draw additional lap information DrawLapInfo(dynamicDisplay); // draw the heart-rate and altitude DrawHeartRateAnimation(dynamicDisplay, m_gpsPosition); // draw the current position as a marker glyph m_dynamicSymbolProperties.set_DynamicGlyph(esriDynamicSymbolType.esriDSymbolMarker, m_bikeGlyph); m_dynamicSymbolProperties.SetColor(esriDynamicSymbolType.esriDSymbolMarker, 1.0f, 1.0f, 1.0f, 1.0f); m_dynamicSymbolProperties.SetScale(esriDynamicSymbolType.esriDSymbolMarker, 1.2f, 1.2f); m_dynamicSymbolProperties.set_RotationAlignment(esriDynamicSymbolType.esriDSymbolMarker, esriDynamicSymbolRotationAlignment.esriDSRANorth); m_dynamicSymbolProperties.set_Heading(esriDynamicSymbolType.esriDSymbolMarker, (float)(m_heading - 90)); dynamicDisplay.DrawMarker(m_gpsPosition); } else { DrawGPSInfo(dynamicDisplay, m_gpsPosition); } }
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); }
void dynamicMapEvents_AfterDynamicDraw(esriDynamicMapDrawPhase DynamicMapDrawPhase, IDisplay Display, IDynamicDisplay dynamicDisplay) { if (DynamicMapDrawPhase != esriDynamicMapDrawPhase.esriDMDPDynamicLayers) return; DrawDynamicLogo(dynamicDisplay); }
void DynamicMapEvents_DynamicMapStarted(IDisplay Display, IDynamicDisplay dynamicDisplay) { if (false == m_bIsAnimating) { m_dStepCount = 0; m_nTotalSteps = 0; return; } if (m_dStepCount >= m_nTotalSteps) { m_bIsAnimating = false; m_dStepCount = 0; m_nTotalSteps = 0; return; } // Increase the bounds by the step amount IActiveView activeView = m_hookHelper.FocusMap as IActiveView; IEnvelope newVisibleBounds = activeView.ScreenDisplay.DisplayTransformation.FittedBounds; // Smooth the zooming. Faster at higher scales, slower at lower double dSmoothZooom = activeView.FocusMap.MapScale / c_dSmoothFactor; if (dSmoothZooom < c_dMinimumSmoothZoom) dSmoothZooom = c_dMinimumSmoothZoom; newVisibleBounds.XMin = newVisibleBounds.XMin + (m_wksStep.XMin * dSmoothZooom); newVisibleBounds.YMin = newVisibleBounds.YMin + (m_wksStep.YMin * dSmoothZooom); newVisibleBounds.XMax = newVisibleBounds.XMax + (m_wksStep.XMax * dSmoothZooom); newVisibleBounds.YMax = newVisibleBounds.YMax + (m_wksStep.YMax * dSmoothZooom); activeView.ScreenDisplay.DisplayTransformation.VisibleBounds = newVisibleBounds; m_dStepCount = m_dStepCount + dSmoothZooom; }