public void Apply(IAGAnimationTrack pTrack, IAGAnimationContainer pContainer, object pObject) { SetBrightness((ILayer)pObject, brightness); SetContrast((ILayer)pObject, contrast); pContainer.RefreshObject(pObject); return; }
private void RecreateLineGeometry(IElement elem, IAGAnimationTrack pTrack, IAGKeyframe pKeyframe, IPoint new_pos) { IGeometry newGeometry = new PolylineClass(); IPointCollection newPointCol = (IPointCollection)newGeometry; IAGAnimationTrackKeyframes trackKeyframes = (IAGAnimationTrackKeyframes)pTrack; int tCount = trackKeyframes.KeyframeCount; object missing = Type.Missing; for (int i = 0; i < tCount; i++) { IAGKeyframe tempKeyframe = trackKeyframes.get_Keyframe(i); newPointCol.AddPoint((IPoint)tempKeyframe.get_PropertyValue(0), ref missing, ref missing); if ((IPoint)tempKeyframe.get_PropertyValue(0) == (IPoint)pKeyframe.get_PropertyValue(0)) { break; } } if (new_pos != null) { newPointCol.AddPoint(new_pos, ref missing, ref missing); } elem.Geometry = newGeometry; }
public void Apply(IAGAnimationTrack pTrack, IAGAnimationContainer pContainer, object pObject) { IElement elem = (IElement)pObject; UpdateGraphicObject(elem, pContainer, pTrack, Position, Rotation); return; }
public void Apply(IAGAnimationTrack pTrack, IAGAnimationContainer pContainer, object pObject) { IElement elem = (IElement) pObject; UpdateGraphicObject(elem,pContainer,pTrack,Position,Rotation); return; }
public void SetObjects(ISet Objects) { int count = Objects.Count; Objects.Reset(); for (int i = 0; i < count; i++) { object obj = Objects.Next(); targetTrack = (IAGAnimationTrack)obj; if (targetTrack != null) { break; } } propPage.Init(targetTrack); }
public void Init(IAGAnimationTrack track) { targetTrack = track; IAGAnimationTrackExtensions trackExtensions = (IAGAnimationTrackExtensions)targetTrack; IMapGraphicTrackExtension trackExtension; if (trackExtensions.ExtensionCount == 0) //if there is no extension, add one { trackExtension = new MapGraphicTrackExtension(); trackExtensions.AddExtension(trackExtension); } else { trackExtension = (IMapGraphicTrackExtension)trackExtensions.get_Extension(0); } this.checkBoxTrace.Checked = trackExtension.ShowTrace; }
public void Interpolate(IAGAnimationTrack pTrack, IAGAnimationContainer pContainer, object pObject, int propertyIndex, double time, IAGKeyframe pNextKeyframe, IAGKeyframe pPrevKeyframe, IAGKeyframe pAfterNextKeyframe) { if (time < TimeStamp || time > pNextKeyframe.TimeStamp) { return; } IElement elem = (IElement)pObject; IPoint new_pos = new PointClass(); if (propertyIndex == 0) { double x1; double y1; IPoint nextPosition = (IPoint)pNextKeyframe.get_PropertyValue(0); double timeFactor; timeFactor = (time - TimeStamp) / (pNextKeyframe.TimeStamp - TimeStamp); //ignoring pPrevKeyframe and pAfterNextKeyframe x1 = Position.X * (1 - timeFactor) + nextPosition.X * timeFactor; y1 = Position.Y * (1 - timeFactor) + nextPosition.Y * timeFactor; new_pos.PutCoords(x1, y1); if (!(elem is ILineElement)) { MoveElement(elem, new_pos, pContainer); TracePath(elem, new_pos, pContainer, pTrack, this); bObjectsNeedRefresh = true; } } if (propertyIndex == 1) { //this property only applies to the point graphic if (!(elem is ILineElement)) { RotateElement(elem, Rotation, pContainer); bObjectsNeedRefresh = true; } } return; }
public void Interpolate(IAGAnimationTrack pTrack, IAGAnimationContainer pContainer, object pObject, int propertyIndex, double time, IAGKeyframe pNextKeyframe, IAGKeyframe pPrevKeyframe, IAGKeyframe pAfterNextKeyframe) { if (time < TimeStamp || time > pNextKeyframe.TimeStamp) { return; } double timeFactor; timeFactor = (time - TimeStamp) / (pNextKeyframe.TimeStamp - TimeStamp); //ignoring pPrevKeyframe and pAfterNextKeyframe if (propertyIndex == 0) //interpolate brightness { short brightnessInterpolated; short brightnessStart; short brightnessEnd; brightnessStart = brightness; brightnessEnd = System.Convert.ToInt16(pNextKeyframe.get_PropertyValue(0)); brightnessInterpolated = System.Convert.ToInt16(timeFactor * (brightnessEnd - brightnessStart) + brightnessStart); SetBrightness((ILayer)pObject, brightnessInterpolated); bObjectsNeedRefresh = true; } else //interpolate contrast { short contrastInterpolated; short contrastStart; short contrastEnd; contrastStart = contrast; contrastEnd = System.Convert.ToInt16(pNextKeyframe.get_PropertyValue(1)); contrastInterpolated = System.Convert.ToInt16(timeFactor * (contrastEnd - contrastStart) + contrastStart); SetContrast((ILayer)pObject, contrastInterpolated); bObjectsNeedRefresh = true; } return; }
public void Deactivate() { targetTrack = null; propPage.Dispose(); }
public void RefreshObject(IAGAnimationTrack pTrack, IAGAnimationContainer pContainer, object pObject) { bObjectsNeedRefresh = false; pContainer.RefreshObject(pObject); }
private void TracePath(IElement elem, IPoint new_pos, IAGAnimationContainer pContainer, IAGAnimationTrack pTrack, IAGKeyframe pKeyframe) { IAGAnimationTrackExtensions trackExtensions = (IAGAnimationTrackExtensions)(pTrack); IMapGraphicTrackExtension graphicTrackExtension; if (trackExtensions.ExtensionCount == 0) //if there is no extension, add one { graphicTrackExtension = new MapGraphicTrackExtension(); trackExtensions.AddExtension(graphicTrackExtension); } else { graphicTrackExtension = (IMapGraphicTrackExtension)trackExtensions.get_Extension(0); } ILineElement path = graphicTrackExtension.TraceElement; bool showTrace = graphicTrackExtension.ShowTrace; if (!showTrace) { if (CheckGraphicExistance((IElement)path, pContainer)) { RemoveGraphicFromDisplay((IElement)path, pContainer); } return; } //Add the path to the graphic container if (!CheckGraphicExistance((IElement)path, pContainer)) { AddGraphicToDisplay((IElement)path, pContainer); } RecreateLineGeometry((IElement)path, pTrack, pKeyframe, new_pos); }
private void RecreateLineGeometry(IElement elem, IAGAnimationTrack pTrack, IAGKeyframe pKeyframe, IPoint new_pos) { IGeometry newGeometry = new PolylineClass(); IPointCollection newPointCol = (IPointCollection)newGeometry; IAGAnimationTrackKeyframes trackKeyframes = (IAGAnimationTrackKeyframes)pTrack; int tCount = trackKeyframes.KeyframeCount; object missing = Type.Missing; for (int i = 0; i < tCount; i++) { IAGKeyframe tempKeyframe = trackKeyframes.get_Keyframe(i); newPointCol.AddPoint((IPoint)tempKeyframe.get_PropertyValue(0), ref missing, ref missing); if ((IPoint)tempKeyframe.get_PropertyValue(0) == (IPoint)pKeyframe.get_PropertyValue(0)) break; } if (new_pos != null) newPointCol.AddPoint(new_pos, ref missing, ref missing); elem.Geometry = newGeometry; }
public void UpdateTrackExtensions(IAGAnimationTrack pTrack) { return; }
public void RefreshObject(IAGAnimationTrack pTrack, IAGAnimationContainer pContainer, object pObject) { RefreshGraphicObject((IElement)pObject, pContainer); }
private void UpdateGraphicObject(IElement elem, IAGAnimationContainer pContainer, IAGAnimationTrack pTrack, IPoint new_pos, double new_angle) { if (elem == null || new_pos == null) { return; //invalidate parameter } MoveElement(elem, new_pos, pContainer); RotateElement(elem, new_angle, pContainer); return; }
public void Interpolate(IAGAnimationTrack pTrack, IAGAnimationContainer pContainer, object pObject, int propertyIndex, double time, IAGKeyframe pNextKeyframe, IAGKeyframe pPrevKeyframe, IAGKeyframe pAfterNextKeyframe) { if (time < TimeStamp || time > pNextKeyframe.TimeStamp) return; IElement elem = (IElement)pObject; IPoint new_pos = new PointClass(); if (propertyIndex == 0) { double x1; double y1; IPoint nextPosition = (IPoint)pNextKeyframe.get_PropertyValue(0); double timeFactor; timeFactor = (time - TimeStamp) / (pNextKeyframe.TimeStamp - TimeStamp); //ignoring pPrevKeyframe and pAfterNextKeyframe x1 = Position.X * (1 - timeFactor) + nextPosition.X * timeFactor; y1 = Position.Y * (1 - timeFactor) + nextPosition.Y * timeFactor; new_pos.PutCoords(x1, y1); if (!(elem is ILineElement)) { MoveElement(elem, new_pos, pContainer); TracePath(elem, new_pos, pContainer, pTrack, this); bObjectsNeedRefresh = true; } } if (propertyIndex == 1) { //this property only applies to the point graphic if (!(elem is ILineElement)) { RotateElement(elem, Rotation, pContainer); bObjectsNeedRefresh = true; } } return; }
private void UpdateGraphicObject(IElement elem, IAGAnimationContainer pContainer, IAGAnimationTrack pTrack, IPoint new_pos, double new_angle) { if (elem == null||new_pos==null) return; //invalidate parameter MoveElement(elem, new_pos, pContainer); RotateElement(elem, new_angle, pContainer); return; }
public static void CreateMapGraphicTrack(ICreateGraphicTrackOptions pOptions, IAGAnimationTracks tracks, IAGAnimationContainer pContainer) { pOptions.PathGeometry = SimplifyPath2D(pOptions.PathGeometry, pOptions.ReverseOrder, pOptions.SimplificationFactor); IAGAnimationType animType = new AnimationTypeMapGraphic(); //remove tracks with the same name if overwrite is true if (pOptions.OverwriteTrack == true) { IArray trackArray = new ArrayClass(); trackArray = tracks.get_TracksOfType(animType); int count = trackArray.Count; for (int i = 0; i < count; i++) { IAGAnimationTrack temp = (IAGAnimationTrack)trackArray.get_Element(i); if (temp.Name == pOptions.TrackName) { tracks.RemoveTrack(temp); } } } //create the new track IAGAnimationTrack animTrack = tracks.CreateTrack(animType); IAGAnimationTrackKeyframes animTrackKeyframes = (IAGAnimationTrackKeyframes)animTrack; animTrackKeyframes.EvenTimeStamps = false; animTrack.Name = pOptions.TrackName; IGeometry path = pOptions.PathGeometry; IPointCollection pointCollection = (IPointCollection)path; ICurve curve = (ICurve)path; double length = curve.Length; double accuLength = 0; //loop through all points to create the keyframes int pointCount = pointCollection.PointCount; if (pointCount <= 1) { return; } for (int i = 0; i < pointCount; i++) { IPoint currentPoint = pointCollection.get_Point(i); IPoint nextPoint = new PointClass(); if (i < pointCount - 1) { nextPoint = pointCollection.get_Point(i + 1); } IPoint lastPoint = new PointClass(); if (i == 0) { lastPoint = currentPoint; } else { lastPoint = pointCollection.get_Point(i - 1); } IAGKeyframe tempKeyframe = animTrackKeyframes.CreateKeyframe(i); //set keyframe properties double x; double y; currentPoint.QueryCoords(out x, out y); tempKeyframe.set_PropertyValue(0, currentPoint); tempKeyframe.Name = "Map Graphic keyframe " + i.ToString(); //set keyframe timestamp accuLength += CalculateDistance(lastPoint, currentPoint); double timeStamp = accuLength / length; tempKeyframe.TimeStamp = timeStamp; double x1; double y1; double angle; if (i < pointCount - 1) { nextPoint.QueryCoords(out x1, out y1); if ((y1 - y) > 0) { angle = Math.Acos((x1 - x) / Math.Sqrt((x1 - x) * (x1 - x) + (y1 - y) * (y1 - y))); } else { angle = 6.2832 - Math.Acos((x1 - x) / Math.Sqrt((x1 - x) * (x1 - x) + (y1 - y) * (y1 - y))); } tempKeyframe.set_PropertyValue(1, angle); } else { IAGKeyframe lastKeyframe = animTrackKeyframes.get_Keyframe(i - 1); tempKeyframe.set_PropertyValue(1, lastKeyframe.get_PropertyValue(1)); } } //attach the point element if (pOptions.PointElement != null) { animTrack.AttachObject(pOptions.PointElement); } //attach the track extension, which contains a line element for trace IMapGraphicTrackExtension graphicTrackExtension = new MapGraphicTrackExtension(); graphicTrackExtension.ShowTrace = pOptions.AnimatePath; IAGAnimationTrackExtensions trackExtensions = (IAGAnimationTrackExtensions)animTrack; trackExtensions.AddExtension(graphicTrackExtension); }
public void Interpolate(IAGAnimationTrack pTrack, IAGAnimationContainer pContainer, object pObject, int propertyIndex, double time, IAGKeyframe pNextKeyframe, IAGKeyframe pPrevKeyframe, IAGKeyframe pAfterNextKeyframe) { if (time < TimeStamp || time > pNextKeyframe.TimeStamp) return; double timeFactor; timeFactor = (time - TimeStamp) / (pNextKeyframe.TimeStamp - TimeStamp); //ignoring pPrevKeyframe and pAfterNextKeyframe if (propertyIndex == 0) //interpolate brightness { short brightnessInterpolated; short brightnessStart; short brightnessEnd; brightnessStart = brightness; brightnessEnd = System.Convert.ToInt16(pNextKeyframe.get_PropertyValue(0)); brightnessInterpolated = System.Convert.ToInt16(timeFactor * (brightnessEnd - brightnessStart) + brightnessStart); SetBrightness((ILayer)pObject, brightnessInterpolated); bObjectsNeedRefresh = true; } else //interpolate contrast { short contrastInterpolated; short contrastStart; short contrastEnd; contrastStart = contrast; contrastEnd = System.Convert.ToInt16(pNextKeyframe.get_PropertyValue(1)); contrastInterpolated = System.Convert.ToInt16(timeFactor * (contrastEnd - contrastStart) + contrastStart); SetContrast((ILayer)pObject, contrastInterpolated); bObjectsNeedRefresh = true; } return; }