<\/P>
この開発者向けサンプルは、Esri<\/A>のArcGIS API for JavaScript<\/A> バージョン4.3を使用して、三次元で多層建物とどのようにインタラクトするかを示しています。シンプルなクリック/タップとドラッグ操作で、建物を地球の表面上で直感的かつスムーズに再配置できます。各階は別々のグラフィックですが、操作時には単一のエンティティとして扱われることに注意してください。<\/P><\/P>ライブアプリケーションはこちら<\/A>をクリックしてください。<\/P>ソースコードはこちら<\/A>をクリックしてください。<\/P><\/P>このサンプルでは、この動作を実現するためにいくつかの未公開API呼び出しを使用していることが重要です。そのため、これらの呼び出しはサポートされておらず、近い将来変更される可能性が非常に高いため、本番環境での使用は推奨しません。<\/P><\/P>コード<\/A>は過剰または不必要に複雑に見えるかもしれませんが、以下はコードの概要です:<\/P>建物構築<\/STRONG>移植性の理由から、建物の階はハードコードされた値のセットから構築されています。各階は建物識別子が付与された個別のグラフィックであることが重要です。この識別子は、隣接するすべての階をグループ化してハイライトおよび空間的な移動を行うために使用されます。<\/LI>ドラッグ操作<\/STRONG>コードはSceneViewのdrag <\/A>イベントを使用して、ポインターのドラッグ操作の3つのフェーズ、すなわちstart<\/EM>、update<\/EM>、およびend<\/EM>に対応しています。「start」フェーズでは、ポインター下の建物階(存在する場合)を特定するためにhittest <\/A>が実行されます。階が見つかると、隣接する階が特定されハイライトされます。「update」フェーズでは、2つの未公開メソッドであるSceneView._stage.pick<\/EM> と SceneView._computeMapPointFromIntersectionResult<\/EM> を使用して実世界座標でポインターの変位を追跡します。これらのメソッドは特徴やグラフィックを無視してポインター直下の地図位置を直接返します。<\/SPAN><\/SPAN><\/LI>ポインターインタラクションの無効化/有効化<\/STRONG>建物が新しい場所にドラッグされたとき、地図がパンしないように地図操作を無効にする必要があります。これを実現するために別の未公開メソッドである SceneView.inputManager<\/EM> を使用してハンドラーを追加および復元しています。<\/LI>移動処理<\/STRONG>現在、既存グラフィックのジオメトリを更新することはできません。グラフィックが移動していることを表示するには、一度削除してから再追加する必要があります。これはやや面倒に思えるかもしれませんが、パフォーマンスへの影響はほとんどありません。<\/LI>スロットリング<\/STRONG>ドラッグイベントが発火する頻度は表示フレームレートを超える可能性があります。表示が毎秒60フレーム(またはそれ以上)で動作している場合、過剰なドラッグイベントは無視されます。<\/LI><\/UL><\/P>改めて強調したいのは、これはEsri JavaScript APIバージョン4.3専用の開発者サンプルであるということです。このアプリケーションで使用されているコードの一部は将来のリリースで廃止または冗長(またはその両方)になる可能性が非常に高いです。<\/P><\/P>A技術的専門知識についてJohannes Schmid<\/a0</A>氏に特別な感謝を申し上げます!
ライブアプリケーションは
ソースコードは
このサンプルでは、この動作を実現するためにいくつかの未公開API呼び出しを使用していることが重要です。そのため、これらの呼び出しはサポートされておらず、近い将来変更される可能性が非常に高いため、本番環境での使用は推奨しません。<\/P>
Vir Naidoo, I admire your curiosity and enthusiasm but I think that taking advantage of Esri's online training material might be a more effective way of gaining the necessary knowledge. On Esri's training page there are more than 30 JavaScript related courses most of which are either free or complimentary with a current maintenance subscription. For more information please contact your local Esri distributor.
and Richie Carmichael ,
Here is an another question, I have used your code,but the result is not right. the graphic.attributes.only have an OBJECTID attribute, did not include name or other.
So , how do you think to solve this??
thanks advance.
Hi Richie Carmichael ,
First, I am very grateful for your help , and this time i want to know is the graphic.attributes.name, where did it from ?
is it from the attributes table i have add it in my attributes table??
Vir Naidoo, to display the name of a clicked building you could do something like this:
_view.on("click", function (e) {
// Stop propagation.
e.stopPropagation();
// Perform hittest to get clicked building (if any).
_view.hitTest(e.screenPoint).then(function (p) {
if (!p || !p.results || p.results.length === 0) { return; }
var graphic = p.results[0].graphic;
if (!graphic) { return; }
// Popup name of clicked building.
alert(graphic.attributes.name);
});
I want to know if three is any way to achieve using click event in sceneView to find which building i have clicked? If so, how to achieve it,please show me the detail,thanks advance.
Vir Naidoo, click here to learn how to define a scene layer definition expression.
Hi Richie Carmichael ,
What you said is important to me , but how can i hide the building with definition query?
Do you have any demo that i can learn to??
thank you advance.
Hi Naidoo, no it is not possible to edit or move single features in a SceneLayer. But having said that I have seen one of my colleagues demonstrate a simulated editing workflow. When a user clicks on a building (from the SceneLayer) create a new graphic using the building's cloned geometry. Hide the clicked building using a definition query on the SceneLayer. Use the logic described in this post to translate the cloned building. Hope this helps!
I' d like to know could i use my buildings in sceneLayer to achieve this function???
サインインしたメンバーは投稿、更新のフォローなどができます。初めてですか?無料アカウントを登録してください。
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.