阅读:2013回复:2
C# 单个图元如何旋转
现在是Winform AE开发,其中涉及一个单个图元旋转问题,哪位大侠能给个示例学习学习不,在线等候,谢谢!
|
|
|
1楼#
发布于:2013-02-26 10:23
是在arcengine中实现吗?
|
|
|
2楼#
发布于:2013-02-26 10:25
<p> 这个是帮助里的说明。</p><p> </p><p>The code below gets the Note currently selected, and uses the GeometryOperations class to rotate the Geometry of the Graphic of the Note. The code assumes you have using statements for the Application, Geometry and Mapping namespaces. </p><span id="cbc_1" x-lang="CSharp" codelanguage="CSharp"><p> </p><div class="highlight-title"><span tabindex="0" class="highlight-copycode"><img style="margin-right: 5px;" src="http://help.arcgis.com/en/arcgisexplorer/900/arcgisexplorer/sdk/icons/CopyCode.gif"/>Copy</span>C#</div><div class="code"><pre>SelectedItemsCollection selItems = ESRI.ArcGISExplorer.Application.Application.SelectedItems;
<span class="highlight-keyword">if</span> ((selItems.Count == <span class="highlight-number">1</span>) ;; (selItems[<span class="highlight-number">0</span>] <span class="highlight-keyword">is</span> Note)) { Note selected = selItems[<span class="highlight-number">0</span>] <span class="highlight-keyword">as</span> Note; <span class="highlight-comment">// Rotate the geometry</span> Geometry rotated = GeometryOperations.Rotate(selected.Graphic.Geometry, <span class="highlight-number">90</span>, Unit.Angular.Degrees); <span class="highlight-comment">// Alternatively, specify rotation in radians, e.g.</span> <span class="highlight-comment">// Geometry rotated = GeometryOperations.Rotate(selected.Graphic.Geometry, 1.570796);</span> <span class="highlight-comment">// Update the geometry of the graphic.</span> selected.Graphic.Geometry = rotated; }</pre></div></span><span id="cbc_2" x-lang="VisualBasic" codelanguage="VisualBasic"><div class="highlight-title"><span tabindex="0" class="highlight-copycode"><img style="margin-right: 5px;" src="http://help.arcgis.com/en/arcgisexplorer/900/arcgisexplorer/sdk/icons/CopyCode.gif"/>Copy</span>VB.NET</div><div class="code"><pre><span class="highlight-keyword">Dim</span> selItems <span class="highlight-keyword">As</span> SelectedItemsCollection = ESRI.ArcGISExplorer.Application.Application.SelectedItems <span class="highlight-keyword">If</span> selItems.Count = <span class="highlight-number">1</span> <span class="highlight-keyword">AndAlso</span> <span class="highlight-keyword">TypeOf</span> selItems(<span class="highlight-number">0</span>) <span class="highlight-keyword">Is</span> Note <span class="highlight-keyword">Then</span> <span class="highlight-keyword">Dim</span> selected <span class="highlight-keyword">As</span> Note = selItems(<span class="highlight-number">0</span>) <span class="highlight-keyword">Dim</span> rotated <span class="highlight-keyword">As</span> Geometry = GeometryOperations.Rotate(selected.Graphic.Geometry, <span class="highlight-number">90</span>, Unit.Angular.Degrees) <span class="highlight-comment">' Alternatively, specify rotation in radians, e.g.</span> <span class="highlight-comment">' Dim rotated As Geometry = GeometryOperations.Rotate(selected.Graphic.Geometry, 1.570796)</span> selected.Graphic.Geometry = rotated <span class="highlight-keyword">End</span> <span class="highlight-keyword">If</span></pre></div></span> |
|
|