#region Overridden Class Methods /// <summary> /// Occurs when this tool is created /// </summary> /// <param name="hook">Instance of the application</param> public override void OnCreate(object hook) { if (m_hookHelper == null) m_hookHelper = new HookHelperClass(); m_hookHelper.Hook = hook; // TODO: Add Tool1.OnCreate implementation } /// <summary> /// Occurs when this tool is clicked /// </summary> public override void OnClick() { // TODO: Add Tool1.OnClick implementation m_pRotateTracker = new EngineRotateTrackerClass(); //Desktopの場合はRotateTrackerClass } public override void OnMouseDown(int Button, int Shift, int X, int Y) { // TODO: Add Tool1.OnMouseDown implementation IGraphicsContainerSelect pGraContSel = (IGraphicsContainerSelect)m_hookHelper.ActiveView.GraphicsContainer; //Get the document's active Graphics Container IScreenDisplay pScreenDisplay = m_hookHelper.ActiveView.ScreenDisplay; //****** Set screen display of the tracker m_pRotateTracker.Display = pScreenDisplay; //****** Set origin of the rotation, add geometry m_pRotateTracker.ClearGeometry(); m_pSelElem = pGraContSel.SelectedElements.Next(); IGeometry pGeom = m_pSelElem.Geometry; m_pRotateTracker.Origin = pGeom.Envelope.LowerLeft; m_pRotateTracker.AddGeometry(pGeom); if (m_pRotateTracker != null) { m_pRotateTracker.OnMouseDown(); } } public override void OnMouseMove(int Button, int Shift, int X, int Y) { // TODO: Add Tool1.OnMouseMove implementation if (m_pRotateTracker != null) { IScreenDisplay pScreenDisplay = m_hookHelper.ActiveView.ScreenDisplay; IPoint pPoint = pScreenDisplay.DisplayTransformation.ToMapPoint(X, Y); m_pRotateTracker.OnMouseMove(pPoint); } } public override void OnMouseUp(int Button, int Shift, int X, int Y) { // TODO: Add Tool1.OnMouseUp implementation if (m_pRotateTracker != null) { bool bChanged = m_pRotateTracker.OnMouseUp(); if (!bChanged) { return; } ITransform2D pTransform2D = (ITransform2D)m_pSelElem; pTransform2D.Rotate(m_pRotateTracker.Origin, m_pRotateTracker.Angle); IGraphicsContainer pGraphicsContainer = m_hookHelper.ActiveView.GraphicsContainer; pGraphicsContainer.UpdateElement(m_pSelElem); m_hookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null); } } #endregion
回転フィードバック
2016/9/1 (木)