ProConcepts 3.0 Migration Guide - EsriJapan/arcgis-pro-sdk GitHub Wiki
ArcGISPro 3.0 ã¯ãå€æŽç¹ã®å€ããªãªãŒã¹ã§ãã3.0 API ã®å€æŽç¹ããã³ 2.x ã¢ãã€ã³ãã³ã³ãã£ã°ã¬ãŒã·ã§ã³ãã³ã¢ãã¹ã ã¢ããªã±ãŒã·ã§ã³ãããã³ãã©ã°ã€ã³ ããŒã¿ãœãŒã¹ ãšã¯ã¹ãã³ã·ã§ã³ã®ç§»è¡æé ã«ã€ããŠã¯ããã®ããã¥ã¡ã³ãã§èª¬æããŸãããã®ããã¥ã¡ã³ãã®ç§»è¡æé ã¯ã2.x ã¢ãã€ã³ãä»»æã® 3.x ãªãªãŒã¹ã«ç§»è¡ããå Žåã«é©çšãããŸãã
Language: C#
Subject: Framework
Contributor: ArcGIS Pro SDK Team <[email protected]>
Organization: Esri, http://www.esri.com
Date: 10/06/2024
ArcGIS Pro: 3.4
Visual Studio: 2022
ãããã¯
- æŠèŠ
-
Pro 3.x ãžã®ç§»è¡
- Pro ãš Pro SDK for 3.x ã®ã€ã³ã¹ããŒã«
-
ã¹ããã 1 å€æ
-
å€æã¡ã¢
- ã¿ãŒã²ãã ãã¬ãŒã ã¯ãŒã¯
- Config.daml ã® desktopVersion ãš Config.xml ã® version å±æ§
- Config.xml ã® language å±æ§
- AddinContent
- ã¿ãŒã²ãã "AfterBuild"
- Pro SDK Nuget ãªãã¡ã¬ã³ã¹
- ãã®ä»ã®ã«ã¹ã¿ã ã³ã³ãã³ã
- ããŒãžãšããŠããŒã¯ããã XAML ãªãœãŒã¹
- ãµãŒãããŒãã£ã®ãªãã¡ã¬ã³ã¹ãš Esri 以å€ã® DLL
- æªäœ¿çšã®ãã¡ã€ã«
- ããŒã«ã«ã«ã³ããŒæ©èœãåäœããªã
-
å€æã¡ã¢
- ã¹ããã 2 åã³ã³ãã€ã«ãš API ã®é倧ãªå€æŽç¹ã®ä¿®æ£
-
ã¢ã»ã³ããªã®é倧ãªå€æŽç¹
- ArcGIS.Core.dll
- ArcGIS.CoreHost.dll
- ArcGIS.Desktop.Catalog.dll
- ArcGIS.Desktop.Core.dll
- ArcGIS.Desktop.DataReviewer.dll
- ArcGIS.Desktop.Editing.dll
- ArcGIS.Desktop.Extensions.dll
- ArcGIS.Desktop.Framework.dll
- ArcGIS.Desktop.Geoprocessing.dll
- Esri.ArcGIS.ItemIndex.dll
- ArcGIS.Desktop.Layout.dll
- ArcGIS.Desktop.Mapping.dll
- ArcGIS.Desktop.TaskAssistant.dll
- ArcGIS.Desktop.Workflow.dll
- CIM ã®æ°žç¶æ§
- è¿œå ã®ç§»è¡ã«é¢ãã泚æäºé
ArcGIS Pro 㯠3.0 ã§ã.NET 6 ã«ç§»è¡ããŸããããã㯠Microsoft ã®ææ°ããŒãžã§ã³ã® .NET (æ§ç§°ã.NET Coreã) ã§ãããé·æãµããŒã (LTS) ãé©çšãããŸããããã¯ã次ã®ããšãæå³ããé倧ãªãªãªãŒã¹å€æŽã§ãã
- Pro ã®ããŒãžã§ã³ 2.x ã§ã³ã³ãã€ã«ãããã¢ãã€ã³ãæ§æããã©ã°ã€ã³ ããŒã¿ãœãŒã¹ãããã³ã³ã¢ãã¹ã ã¢ããªã±ãŒã·ã§ã³ã¯ãPro 3.0 以éã§ã¯ åäœããŸããã
- ãããªã㯠API (Pro ã®) 㯠change ã®å¯Ÿè±¡ãšãªããŸãã
- Pro ã®ã¡ãžã£ãŒ ããŒãžã§ã³ã®ã€ã³ã¯ãªã¡ã³ã㯠2.x ãã 3.x ã«å€æŽãããŸãã
泚: ArcGIS Pro 3.3 㧠Pro 㯠.NET 6 ãã .NET 8 ã«ç§»è¡ããŸãããArcGIS Pro 3.3 以é 㧠Pro 2.x ãã移è¡ããå Žåã¯ãäžè¬çã«ããã®ããã¥ã¡ã³ãã«èšèŒãããŠããæé å 㧠.NET 6 ã®ä»£ããã« .NET 8 ã䜿çšããŠãã ããã
ArcGIS Pro 3.0 ã§ã¯ãArcGIS Pro ãããžã§ã¯ãããããžã§ã¯ã ãã³ãã¬ãŒããããã±ãŒãžãã¬ã€ã€ãŒãããã³ããã ãã¡ã€ã« (.aprxã.ppkxã.aptxã.pagxã.lyrxã.mapx ãªã©) ã®ããã¥ã¡ã³ã ããŒãžã§ã³ã 3.0 ã«å€æŽãããŸãããArcGIS Pro 3.0 ã䜿çšããŠäœæãŸã㯠ä¿å ããããããžã§ã¯ãããã³ãã¬ãŒããããã±ãŒãžãªã©ã¯ãããã¥ã¡ã³ã ããŒãžã§ã³ 3.0 ã§ä¿åãããŸããããã«ã¯ãããã¥ã¡ã³ã ããŒãžã§ã³ 2.x ã 3.0 ã§éãããã¡ã€ã«ãããã±ãŒãžããã³ãã¬ãŒããªã©ãå«ãŸããŸãã詳现ã«ã€ããŠã¯ãPro ãã«ãã® ArcGIS Pro 移è¡ãã«ã ããã㯠ãåç §ããŠãã ããã
泚: 2.x ã§äœæãããããããã¬ã€ã¢ãŠããããã³ã¬ã€ã€ãŒ (.mapxã.pagxã.lyrx) ããã³ããã±ãŒãž (.mpkxã.lpkx) ã¯ã3.0 㧠å€æŽãªãã« å ¬é API ããèªã¿èŸŒãããšãã§ããŸããããã«ã€ããŠã¯ããã®ããã¥ã¡ã³ãã® ããããã¬ã€ã¢ãŠããããã³ã¬ã€ã€ãŒ ãã¡ã€ã«ãšããã±ãŒãž ã»ã¯ã·ã§ã³ã§èª¬æãããŠããŸãã
ã¢ãã€ã³ãæ§æãããã³ãã©ã°ã€ã³ ããŒã¿ãœãŒã¹ã¯ãPro ã® ãã€ã㌠ãªãªãŒã¹ éã§ã®ã¿åæ¹äºææ§ããããŸããã¡ãžã£ãŒ ãªãªãŒã¹éã§ã®åæ¹äºææ§ã¯ãããŸããã2.9 ãã 3.0 ãžã®ç§»è¡ã¯ ã¡ãžã£ãŒ ãªãªãŒã¹ã§ãããããPro ã® 2.x ããŒãžã§ã³ã«å¯ŸããŠã³ã³ãã€ã«ãããã¢ãã€ã³ãæ§æããã©ã°ã€ã³ ããŒã¿ãœãŒã¹ãããã³ã³ã¢ãã¹ã ã¢ããªã±ãŒã·ã§ã³ã¯ãPro 3.x ã« ç§»è¡ ã åã³ã³ãã€ã« ããå¿ èŠããããŸãã
移è¡æé ã«ã€ããŠã¯ã以äžã® Pro 3.0 ãžã®ç§»è¡ ã»ã¯ã·ã§ã³ã§è©³ãã説æããŠããŸãã
2.x ã®ã¢ãã€ã³ãæ§æããŸãã¯ãã©ã°ã€ã³ ããŒã¿ãœãŒã¹ã Pro 3.x ã«å¯ŸããŠç»é²ããããšãããšãå±éã¯ãããŸããç»é²ã«å€±æããŸããRegisterAddin.exe ã¯ãã€ã³ã¹ããŒã«ããããšããŠããã¢ãã€ã³ãŸãã¯æ§æãçŸåšã®ããŒãžã§ã³ã® Pro ãšäºææ§ããªããããèŠåã¡ãã»ãŒãžããããã¢ãã衚瀺ããŸãã
ã€ã³ã¹ããŒã«ãç¶è¡ãããšãã¢ãŒã«ã€ã ãã¡ã€ã«ãããããã®ãã©ã«ããŒã«å±éãããŸãããPro ã®èµ·åæã«èªã¿èŸŒã¿ã¯ãããŸããã
å€ãã®å ŽåãPro ã 3.x ã«ã¢ããã°ã¬ãŒããããšãã«ã2.x ãªãªãŒã¹ãããã§ã«ã¢ãã€ã³ãŸãã¯æ§æããã·ã³ã«ã€ã³ã¹ããŒã«ãããŠããå¯èœæ§ããããŸãã2.x ãªãªãŒã¹ããã€ã³ã¹ããŒã«ãããã¢ãã€ã³ãæ§æãããã³ãã©ã°ã€ã³ããŒã¿ãœãŒã¹ã¯ãPro 3.x ã§ã¯èªã¿èŸŒãŸããŸãããçŸåšã®ãªãªãŒã¹ãšäºææ§ã®ãªãã¢ãã€ã³ã¯ãPro ã®ã¢ãã€ã³ ãããŒãžã£ãŒã®ããã¯ã¹ããŒãž ã¿ãã«ç¡å¹ãšè¡šç€ºãããŸããã¢ãã€ã³ã¯ãããŒãããåã« Pro 3.x ã«ç§»è¡ ããå¿ èŠããããŸããæ§æããã©ã°ã€ã³ ããŒã¿ãœãŒã¹ãããã³ã³ã¢ãã¹ã ã¢ããªã±ãŒã·ã§ã³ã«ã€ããŠãåæ§ã§ã*ã
*ã³ã¢ ãã¹ã ã¢ããªã±ãŒã·ã§ã³ã¯ç§»è¡ããå¿ èŠããããŸãããPro ã«ãã£ãŠèªã¿èŸŒãŸããããç»é²ããããããããšã¯ãããŸããã
泚: ProConcepts Advanced Topics, manual configuration of a build server ã«åŸã£ãŠãArcGISSignAddIn.exe ã 2.x 㧠(ArcGIS Pro ãã€ã³ã¹ããŒã«ããã«) 䜿çšãããããã«ã ãµãŒããæ§æããã«ã¯ãåç §ãããµãŒããŒã® Pro bin ãã©ã«ããŒã«ã DADFLib.dll ãš zlibwap.dll ãçšæ (ã³ã³ãã€ã«ã®ç®çã§) ããããšãå¿ èŠã«ãªããŸããã
3.x ã§ãArcGISSignAddIn.exe ã䜿çšããŠã¢ãã€ã³ã«çœ²åããã«ã¯ãArcGISSignAddIn.exeãArcGISSignAddIn.dllãArcGISSignAddIn.runtimeconfig.jsonãããã³ DADFLib.dll ããµãŒããŒã® Pro bin ãã©ã«ããŒã«ã³ããŒããŸãã詳现ã«ã€ããŠã¯ãåè¿°ã® ProConcepts Advanced Topics ãåç §ããŠãã ããã
2.x ã®ã¢ãã€ã³ãæ§æããã©ã°ã€ã³ ããŒã¿ãœãŒã¹ãããã³ã³ã¢ãã¹ã ã¢ããªã±ãŒã·ã§ã³ã¯ãPro ã¢ããªã±ãŒã·ã§ã³ã§ (ãŸã㯠Pro ã¢ããªã±ãŒã·ã§ã³äžã§) å®è¡ããåã«ãPro 3.x ã«ç§»è¡ããå¿ èŠããããŸãã移è¡ã®ããã»ã¹ã¯ããã®ããã¥ã¡ã³ãã®äž»é¡ã§ãããéåžžã次㮠2 ã€ã®ã¹ãããã«åŸããŸãã
- ã¢ãã€ã³ãæ§æããã©ã°ã€ã³ ããŒã¿ãœãŒã¹ãããã³ã³ã¢ãã¹ã ã¢ããªã±ãŒã·ã§ã³ã¯ã.NET Framework 4.x ãã .NET 6 ã«å€æããå¿ èŠããããŸãã
- ã¢ãã€ã³ãæ§æããã©ã°ã€ã³ ããŒã¿ãœãŒã¹ãããã³ã³ã¢ãã¹ã ã¢ããªã±ãŒã·ã§ã³ã 3.x ã«å¯ŸããŠåã³ã³ãã€ã«ããçµæãšããŠçããã³ã³ãã€ã« ãšã©ãŒ (API ã®é倧ãªå€æŽã«ãã) ãä¿®æ£ããå¿ èŠããããŸãã
ãã®ããã¥ã¡ã³ãã§ã¯ãPro ã® 4 ã€ã®æ¡åŒµãã¿ãŒã³ - ã¢ãã€ã³ãæ§æããã©ã°ã€ã³ ããŒã¿ãœãŒã¹ãããã³ã³ã¢ãã¹ã ã¢ããªã±ãŒã·ã§ã³ - ããŸãšããŠãã¢ãã€ã³ããšåŒã³ãŸããç¹å¥ãªæ³šæã®ããã«å ·äœçã«èšåãããŠããŸãã
3.0以äžã®ã¢ãã€ã³ã移è¡ããã«ã¯ã3.x Pro SDKãã€ã³ã¹ããŒã«ããå¿ èŠããããŸãã3.x ã® Pro SDK ã®æå° èŠä»¶ 㯠Visual Studio 2022 ãš .NET 6 ã§ãã2.x ãã ArcGIS Pro 3.x SDK ãžã®ç§»è¡ã¯ãã¢ããã°ã¬ãŒãã§ã¯ãããŸããã2.x ãã ArcGIS Pro 3.x SDK ãã€ã³ã¹ããŒã«ããã«ã¯ããšã¯ã¹ãã³ã·ã§ã³ > ãšã¯ã¹ãã³ã·ã§ã³ã®ç®¡ç > ãªã³ã©ã€ã³ã䜿çšããŠãVisual Studio ããŒã±ãããã¬ã€ã¹ãã Pro SDK vsixs ãæ€çŽ¢ããå¿ èŠããããŸããæ€çŽ¢æååã¯ãArcGIS Pro SDKãã䜿çšããŸããã€ã³ã¹ããŒã«ã§ãããšã¯ã¹ãã³ã·ã§ã³ã¯ 3 ã€ã«åãããŸãïŒ
- ArcGIS Pro SDK for .NET,
- ArcGIS Pro SDK for .NET (Utilities)
- ArcGIS Pro SDK for .NET (Migration).
ããã€ã泚æç¹ããããŸãïŒ ArcGIS Pro 3.x SDK ã«ã¯ Visual Studio 2022 ãå¿ èŠã§ããVisual Studio 2022 å 㧠ArcGIS Pro SDK ãæ€çŽ¢ããªããšãArcGIS Pro 2.9 SDK ã衚瀺ãããããšã確èªããŠãã ããããŸãã.NET 6.0.5 ãã€ã³ã¹ããŒã«ãããŠããããbetter ã§ããããšã確èªããŠãã ãããæ§ããŒãžã§ã³ã® SDK ãã€ã³ã¹ããŒã«ãããèªåæŽæ°ãããªã³ã«ããŠããŠããVisual Studio ããã®æŽæ°éç¥ã¯ãããŸããã
Pro 3.x ãžã®ç§»è¡ã¯ãã¢ãã€ã³ã .NET Framework ãã .NET 6 ã«å€æããããšããå§ãŸããŸããã¢ãã€ã³ã æå 㧠.NET 6 ã«ç§»è¡ããŠãåé¡ãããŸããããã®å ŽåãPro SDK ãã³ãã¬ãŒãã䜿çšããŠæ°ããã¢ãã€ã³ (ãŸãã¯æ§æããã©ã°ã€ã³ããŸãã¯ã³ã¢ãã¹ã) ãããžã§ã¯ããäœæããé¢é£ãããœãŒã¹ ãã¡ã€ã«ããµãŒã ããŒãã£ã®äŸåé¢ä¿ (.NET ããµããŒãããããã«å¿ èŠã«å¿ããŠæŽæ°)ãNuget åç §ãªã©ãã³ããŒãã2.x ãããžã§ã¯ãã® 3.x ããŒãžã§ã³ãåæ§ç¯ããŸããããã¯ãã¢ãã€ã³ã«ç¹å®ã®ç¹ç°æ§ãããå Žåãã.NET çšã«æåã§åæ§æããå¿ èŠãããç¹å¥ãªèšå®ãããå Žåã«é©ããŠããŸãããã以å€ã®å Žåã¯ããã®ç¹å®ã®ã»ã¯ã·ã§ã³ã®æ®ãã®éšåã§çŠç¹ãåœãŠãŠãããPro Migrate ProjectããŠãŒãã£ãªãã£ã䜿çšããŠãã ããã
泚: ã¢ãã€ã³éçºè ã¯ãmigration utility ãå®è¡ããåã«ãå¿ èŠã«å¿ããŠãå€æåã®ãããžã§ã¯ãã®ããã¯ã¢ãããŸãã¯ã³ããŒãäœæããå¿ èŠããããŸããã¢ãã€ã³ã®ã¢ã»ã³ã㪠ãã¹ãæŽæ°ããå¿ èŠãããå Žå (2.x ã¢ãã€ã³ãä»ã®ãã·ã³ããã³ããŒããå Žåãªã©)ã移è¡ããŒã«ãå®è¡ããåã« Pro Fix References (proapp-sdk-utilities.vsix ãã) ãå®è¡ã㊠2.x.csproj/.vbproj ã®ã¢ã»ã³ã㪠ãã¹ãæŽæ°ããŠãã ããã
ãPro Migrate Projectããã€ã³ã¹ããŒã«ããã«ã¯ãPro SDK 3.x ã«ä»å±ã®ãproapp-sdk-migration.vsixããå®è¡ããŸããããã«ãããVisual Studio 2022 ãããžã§ã¯ãã®ã³ã³ããã¹ã ã¡ãã¥ãŒã«ãŠãŒãã£ãªãã£ãè¿œå ãããŸã (ä»ã® Pro SDK ã³ã³ããã¹ã ã¡ãã¥ãŒ ãªãã·ã§ã³ãšå ±ã«)ã
migration utility ãå®è¡ããã«ã¯ãVisual Studio 2022 ã§ããããã®ã¢ãã€ã³ãæ§æããã©ã°ã€ã³ ããŒã¿ãœãŒã¹ããŸãã¯ã³ã¢ãã¹ã ã¢ããªã±ãŒã·ã§ã³ ãããžã§ã¯ããéããŸãã次ã«ãå³ã¯ãªã㯠> [Pro Migrate Project] ãªãã·ã§ã³ãå®è¡ããã¢ãã€ã³ ãããžã§ã¯ã (ã¢ãã€ã³ãæ§æããã©ã°ã€ã³ ããŒã¿ãœãŒã¹ããŸãã¯ã³ã¢ãã¹ã ã¢ããªã±ãŒã·ã§ã³) ã .NET 6 ã«å€æããŸããå€æãŠãŒãã£ãªãã£ã䜿çšããŠãC# ãš VB.Net ã®äž¡æ¹ã® 2.x ã¢ãã€ã³ ãããžã§ã¯ããå€æã§ããŸãã
ãPro Migrate Projectãå€æãŠãŒãã£ãªãã£ãå®è¡ãããšãç¶è¡ãããã©ããããŠãŒã¶ãŒã«ç¢ºèªããã¡ãã»ãŒãžã衚瀺ãããŸãã
[Yes] ãéžæãããŠããå Žåãå€æãŠãŒãã£ãªãã£ã¯ãã¢ãã€ã³ ãããžã§ã¯ããã .NET 6 ãžã®é¢é£ããå€æãå®è¡ããŸãããŠãŒã¶ãŒã¯ã[migration completed successfully] ããã³ããã確èªããVisual Studio ããã³ãã㧠[Reload] ãã¯ãªãã¯ããŠãããžã§ã¯ããåèªã¿èŸŒã¿ããå¿ èŠããããŸããå€æåŸ:
- 察象ãã¬ãŒã ã¯ãŒã¯ã¯ .NET 6.0 ã«å€æŽãããŸãã
- åºåã¢ãã€ã³ .csproj ãŸã㯠.vbproj 㯠.NET ãããžã§ã¯ã圢åŒã«å€æãããŸã (.NET Framework 圢åŒãšã¯å€§ããç°ãªããŸã)ã
- ãããžã§ã¯ãã® References ãã©ã«ããŒã¯ .NET Dependencies ãã©ã«ããŒã«å€æŽãããŸãã
- Config.daml ã®
desktopVersion
å±æ§ã 3.x ã«å€æŽãããŸã - ãã©ã°ã€ã³ã®å Žåã
version
å±æ§ã¯ 3.x ã«å€æŽãããŸã - ãã©ã°ã€ã³ã®å Žåã
language
å±æ§ã¯CLR:PluginDS
ã«å€æŽãããŸãã - Build Action "AddinContent" 㯠Build Action "Content" ã«å€æŽãããŸãã(詳现ã«ã€ããŠã¯ãAddinContent ãåç §ããŠãã ãã)
- ã«ã¹ã¿ã ã¿ãŒã²ããã¯ã
<Target Name="AfterBuild" ...>
ãé€ããŠå€æŽãããã«ã³ããŒãããŸãã<Target Name="SignAddin" ...>
ã«å€æŽãããŸãã - Pro SDK Nuget ãªãã¡ã¬ã³ã¹ã¯ã3.x Nuget ãªãã¡ã¬ã³ã¹ã«æŽæ°ãããŸããPro SDK 3.x Nuget ã®è©³çŽ°ã«ã€ããŠã¯ãProGuide ArcGIS Pro Extensions Nuget ãåç §ããŠãã ããã
- ãããžã§ã¯ãã® xaml ãªãœãŒã¹ ãã£ã¯ã·ã§ããªã¯ããã«ã ã¢ã¯ã·ã§ã³ "Resource" ãããã«ã ã¢ã¯ã·ã§ã³ "Page" ã«å€æŽãããŸãã
- å€éšãªã³ã¯ã¯å€éšãªã³ã¯ã®ãŸãŸã§ãã
- ãµãŒã ããŒãã£ã® DLL åç §ã¯å€æãããŸããå¿ èŠã«å¿ããŠãæåã§è¿œå ããå¿ èŠããããŸãã*
移è¡ã®æåŸã«ã移è¡ã¹ããŒã¿ã¹ ã¬ããŒã (html ããã³ txt 圢åŒã®äž¡æ¹) ã Visual Studio ãããžã§ã¯ã TOC ã«è¿œå ãããŸãã æåã§è§£æ±ºããå¿ èŠãããã移è¡ããŒã«ãç¹å®ããæªè§£æ±ºã®å€æã®åé¡ããªããã移è¡ã¹ããŒã¿ã¹ ã¬ããŒãã確èªããŸãã äŸãã°ãPro SDK Nuget ãªãã¡ã¬ã³ã¹ã 3.x ã«æŽæ°ããŸãã
*2.x Visual Studio ãããžã§ã¯ãã§ãµãŒã ããŒãã£ã® Nuget ããã±ãŒãžããŸãã¯ç¹å®ã®ã«ã¹ã¿ã ãŸã㯠Microsoft 以å€ã® .NET Framework ã©ã€ãã©ãªãš dll ã䜿çšãããã¹ãŠã®ã¢ãã€ã³ã¯ãé©å㪠.NET 6 çžåœç©ãåç §ããããã«å¿ èŠãªå€æŽã æå㧠è¡ãå¿ èŠããããŸãã
2.x ã¢ãã€ã³ã® Visual Studio TOC ã®å€æåãšå€æåŸã®ãã¥ãŒ:
ã¢ãã€ã³ã®å€æã«é¢ããè¿œå ã®æ³šæäºé ã
ã¢ãã€ã³ .csproj ããã³ .vbproj ã®ã¿ãŒã²ãã ãã¬ãŒã ã¯ãŒã¯ã¯ãçŸåš 2.x ã§äœ¿çšããŠãã .NET Framework ã®ããŒãžã§ã³ (ã»ãšãã©ã®å Žåã.NET Framework ããŒãžã§ã³ 4.8) ãã .NET 6 ã«å€æŽããå¿ èŠããããŸããPro Migrate Project ãŠãŒãã£ãªãã£ã¯ãã¿ãŒã²ãã ãã¬ãŒã ã¯ãŒã¯ãèªåçã«å€æŽããŸãããã以å€ã®å Žåã¯ãæåã§å€æŽããå¿ èŠããããŸã*ã
*Visual Studio .NET Framework ãããžã§ã¯ããš Visual Studio .NET (ãŸã㯠".NET Core") ãããžã§ã¯ãã®éã«ã¯æ§é äžã®éãããããŸããPro Migrate Project ãŠãŒãã£ãªãã£ã䜿çšããªãããšãéžæããå Žåã¯ã.NET 6 ã¿ãŒã²ãã ãã¬ãŒã ã¯ãŒã¯ ã»ããã䜿çšããŠæ°ãã Visual Studio 2022 ã¢ãã€ã³ ãããžã§ã¯ããäœæããé¢é£ãã 2.x ã¢ãã€ã³ ã³ã³ãã³ããæåã§ã³ããŒããå¿ èŠããããŸãã
3.0 ããåã«äœæãããã¢ãã€ã³ãšæ§æã§ã¯ãConfig.daml ã®ãdesktopVersionãå€ã 2.9 以äžã«ãªããŸãã3.0 ããåã«äœæããããã©ã°ã€ã³ ããŒã¿ãœãŒã¹ã«ã¯ã2.9 以äžã® Config.xml ã® <Target ...>
èŠçŽ ã« version
å±æ§ããããŸããå€æãŠãŒãã£ãªãã£ã¯ãConfig.daml desktopVersion
ããã³ Config.xml version
(ãã©ã°ã€ã³ ããŒã¿ãœãŒã¹çš) ã 3.x ã«å€æŽããŸãããã以å€ã®å Žåããããã®å€æŽã¯æåã§è¡ãå¿
èŠããããŸãã
ããŒãžã§ã³ç®¡çã®è©³çŽ°ã«ã€ããŠã¯ãPro Concepts Advanced Topics, Add-in Versioning ãåç §ããŠãã ããã
ããã«ãPro Migrate Project ãŠãŒãã£ãªãã£ã䜿çšã㊠2.x ã¢ãã€ã³ã 3.2 ã«ç§»è¡ããå Žåãconfig.daml ã® dekstopVersion å±æ§ãæ£ããèšå®ãããŠããªãå¯èœæ§ããããŸãã3.2 ã§ã¯ã移è¡ããŒã«ã dekstopVersion å±æ§ã«ãã«ãçªå·ã 2 åæžã蟌ãã§ããå¯èœæ§ããããŸããäŸãã°ã以äžã®ã¹ããããã§ã¯ãdesktopVersion
å±æ§ã®ãã«ãçªå·ã 3.2.0.49743
ã§ããã¹ããšããã3.2.0.49743.49743
ãšéè€ããŠããããšã«æ³šæããŠãã ããã
<AddInInfo id="{xxxx-xxx}" version="1.0" desktopVersion="3.2.0.49743.49743"
ãã®åé¡ã解決ããã«ã¯ãåã« desktopVersion
å±æ§ã®ãã«ãçªå·ã®éè€ããå€ãåé€ããŸãã以äžã®ã¹ããããã¯ãdesktopVersion å±æ§ã®æ£ãããã©ãŒãããã瀺ããŠããŸãïŒãã«ãçªå·ã®éè€ã¯åé€ãããŠããŸãïŒ
<AddInInfo id="{xxxx-xxx}" version="1.0" desktopVersion="3.2.0.49743"
泚ïŒãã®åé¡ã¯ã3.2 ã®Pro Migrate Project ãŠãŒãã£ãªãã£ã§ã®ã¿ç¢ºèªãããŠããŸãããã®åé¡ã¯ 3.0 ãŸãã¯3.1 ã§ã¯ç¢ºèªãããŠããŸããã
3.0 以éã§ã¯ã2ïŒx ã®Config.xml ã® <AddIn language="CLR4.X.X" ...>
å±æ§ã CLR:PluginDS
ã«å€æŽããå¿
èŠããããŸããå€æãŠãŒãã£ãªãã£ã¯ããã®å€æŽã Config.xml ã«èªåçã«è¡ããŸãããã以å€ã®å Žåã¯ãæåã§å€æŽããå¿
èŠããããŸãã
Config.xml
<!-- before at 2.x -->
<AddIn language="CLR4.7.2" library="AcmePluginDatasource.dll" namespace="AcmePluginDatasource">
<ArcGISPro>
...
<!-- at 3.x -->
<AddIn language="CLR:PluginDS" library="AcmePluginDatasource.dll" namespace="AcmePluginDatasource">
<ArcGISPro>
...
3.0 以éã§ã¯ãã«ã¹ã¿ã Visual Studio ãã«ã ã¢ã¯ã·ã§ã³ AddinContent ã¯ãµããŒããããªããªããŸããã ã¢ãã€ã³ ã¢ãŒã«ã€ãå ã«ã«ã¹ã¿ã ã³ã³ãã³ããåã蟌ãã«ã¯ãã¢ãã€ã³ã¯ä»£ããã«çµã¿èŸŒã¿ã®ãã«ã ã¢ã¯ã·ã§ã³ Content ã䜿çšããå¿ èŠããããŸãã
Pro SDK ã® "Pro Migrate Project" ããŒã«ã¯ãå€æããã .csproj ããã³ .vbproj 㧠AddinContent ã¿ã€ãã Content ã«èªåçã«å€æããŸãããã以å€ã®å Žåãå€æŽã¯æåã§è¡ãå¿ èŠããããŸãã
<!-- At 2.x -->
<ItemGroup>
<AddInContent Include="ReadMe.md" />
</ItemGroup>
<!-- At 3.x -->
<ItemGroup>
<Content Include="ReadMe.md" />
</ItemGroup>
ã¢ãã€ã³ãŸãã¯æ§æã .csproj ãŸã㯠.vbproj å
㧠<Target Name="AfterBuild" ...>
èŠçŽ ã䜿çšããŠããå Žå (ã€ãŸã ProGuide Digitally Signed Addins and Configrations 2.x) ã«èšèŒãããŠãããšããã®å Žåããã® ã¿ãŒã²ããèŠçŽ ã¯ã<Target Name="AfterBuild" DependsOnTargets="PackageArcGISContents">
ãã <Target Name="SignAddIn" AfterTargets="PackageArcGISContents">
ã«å€æŽãããŸãããã®å€æŽã¯ãåè¿°ã® ProGuide for 3.x ã«ãåæ§ã«åæ ãããŠããŸãã
ä»ã®ãã¹ãŠã® <Target ...>
èŠçŽ ã¯å€æŽãããã«ã³ããŒãããŸããäžèšã® <Target Name="AfterBuild" ...>
ãå«ã all ã¿ãŒã²ããèŠçŽ ã®å
容ããå€æŽãããã«ã³ããŒãããŸã (äŸãã°ããã¹ãŠã® <Exec ...>
èŠçŽ )ããããã¯ã.NET ã«é¢é£ããã¿ãŒã²ãã ã³ã³ãã³ãèªäœã®ç¹ç°æ§ã«å¿ããŠãæåã§å€æŽããå¿
èŠãããå Žåãšãªãå ŽåããããŸãã
MSBuild ã§ã® Target èŠçŽ ã®äœ¿çšã®è©³çŽ°ã«ã€ããŠã¯ãTarget Element - MSBuild ãåç §ããŠãã ããã
ResourceãContentãAddinContent (äžèšåç §)ããŸã㯠None ãšããŠè¿œå ãããã«ã¹ã¿ã .csproj ãŸã㯠.vbproj ã³ã³ãã³ãã¯ã移è¡ããŒã«ã«ãã£ãŠå€æããã .csproj ãŸã㯠.vbproj ã«ç§»è¡ãããŸãããåºåãã£ã¬ã¯ããªã«ã³ããŒãèšå®ãä¿æãããŸã*ã
* Visual Studio ããŒãžã§ã³ 17.0.0 ïœ 17.1.2 ã«ãã°ããããŸãã åºåãã£ã¬ã¯ããªã«ã³ããŒãããšãã¢ã€ãã ã®ãããã㣠ãŠã£ã³ããŠã«åžžã«ããªãããšè¡šç€ºãããŸãã [åºåãã£ã¬ã¯ããªã«ã³ããŒ] ãé©åã«èšå®ãããŠãããã©ãããå€æããã«ã¯ã.csproj ãŸã㯠.vbproj ãã¡ã€ã«ã®ã¢ã€ãã å®çŸ©ã衚瀺ããŸãã 以äžã® xml ã®ããã«ãªããŸãã
<!-- content type None, CopyToOutputDirectory 'Copy Always' -->
<ItemGroup>
<None Include="Content\MS_Word_Doc.docx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<!-- content type None, CopyToOutputDirectory 'Copy if Newer' -->
<ItemGroup>
<None Include="Content\MS_Word_Doc.docx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Visual Studio 2019 | 2017 ããã³ .NET Framework ãããžã§ã¯ãã§ã¯ãxaml ãªãœãŒã¹ (ã€ãŸããããªãœãŒã¹ ãã£ã¯ã·ã§ããªã) ããResourceãã¿ã€ãã®ãã«ã ã¢ã¯ã·ã§ã³ã§ãããžã§ã¯ãã«è¿œå ãããŸããVisual Studio 2022 ããã³ .NET 6 ã®å Žåãxaml ãªãœãŒã¹ã¯ãã«ã ã¢ã¯ã·ã§ã³ãPageããšããŠããŒã¯ããå¿ èŠããããŸããããã«ã¯ãDAML ã®ã£ã©ãªãŒãšã³ã³ã ããã¯ã¹ã® xaml ãã³ãã¬ãŒããå«ãŸããŸãã.NET 6 ãããžã§ã¯ãã§ãResourceããšããŠããŒã¯ããããŸãŸã® Xaml ãã³ãã¬ãŒãã¯èªã¿èŸŒãŸããããã㯠Uri 㯠null ãè¿ããŸãã
2x ãã 3.x ã«ç§»è¡ããå Žåã移è¡ããŒã«ã«ãã£ãŠ xaml ãªãœãŒã¹ã®ãã«ã ã¢ã¯ã·ã§ã³ãèªåçã«å€æŽãããŸãããã¢ãã€ã³ãæåã§å€æããå Žåã¯ãxaml ãªãœãŒã¹ããã«ã ã¢ã¯ã·ã§ã³ãPageãã«å€æŽãããŠããããšã確èªããŠãã ããã
Visual Studio 2022 é ç®ãã³ãã¬ãŒããä»ã㊠3.x ã§æ°ãããªãœãŒã¹ ãã£ã¯ã·ã§ããªãè¿œå ãããšãVisual Studio ã¯èªåçã«æ£ãããã«ã ã¢ã¯ã·ã§ã³ãèšå®ãããããæ°ãã xaml ãªãœãŒã¹åç §ãå€æŽããå¿ èŠã¯ãããŸããã
移è¡ããŒã«ã¯ãç¹å®ã® DLL åç §ã .NET ãšäºææ§ããããã©ãããèå¥ã§ããŸããããããã£ãŠããã¹ãŠã®ãµãŒã ããŒãã£ã®åç § (ã€ãŸããEsri 以å€) ã¯ãå€æããã .csproj/.vbproj ããé€å€ãããŸããã¢ãã€ã³éçºè ã¯ãé¢é£ããåç §ãå€æããããããžã§ã¯ãã«æåã§è¿œå ããå¿ èŠããããŸãã éçºè ã¯ãåãçç±ã§ Nuget ããã±ãŒãžåç §ãåæ§ã«è¿œå ãçŽãå¿ èŠãããå ŽåããããŸãã
.NET 6 ããã³ Visual Studio 2022 ã§ã¯ãæ¢å®ã§ ãããžã§ã¯ã ãã©ã«ããŒå ã®ãã¹ãŠã®ãœãŒã¹ ãã¡ã€ã«ãèªåçã«ãã«ãã«å«ãŸããŸãã.NET Framework Visual Studio 2017/2019 ãããžã§ã¯ãã§ã¯ããããžã§ã¯ã ãã©ã«ããŒã«ååšãããã2.9 ãããžã§ã¯ã ãã¡ã€ã«ã§ æ瀺çã« åç §ãããŠããªããœãŒã¹ ãã¡ã€ã«ã¯ããã«ãã«ãã£ãŠç¡èŠãããããã䜿çšãããŸãããããã®ããã移è¡ããŒã«ããããžã§ã¯ã ãã©ã«ããŒå ã« "æªäœ¿çš" ã®ãœãŒã¹ ãã¡ã€ã«ãèŠã€ããå Žåããããã .NET 6/3.x ãã«ãããé€å€ããããŸãŸã«ãªãããã« ".NotUsed" æ¡åŒµåãè¿œå ãããŸãã 詳现ã«ã€ããŠã¯ãMSBuild EnableDefaultItems ãåç §ããŠãã ããã
ããŒã«ã« ã³ããŒã¯ãMicrosoft Visual Studio 2022 ããŒãžã§ã³ 17.1.6 以åã§ã¯æ£ããæ©èœããŸãããArcGIS Pro ã§ã¯ã"CopyLocal=No" ã®èšå®ã䜿çšããŠãArcGIS Pro ã¢ã»ã³ããªãè¿œå ã®ã¢ãŒã«ã€ãã«æžãåºãããªãããã«ããŸããåºæ¬çã«ãå®è¡æã« Pro ã¢ã»ã³ããªåç §ãã¢ãã€ã³ ã¢ã»ã³ã㪠ãã£ãã·ã¥ã«æžã蟌ãŸããããšã¯æãŸãããããŸããã代ããã«ãPro ã¢ããªã±ãŒã·ã§ã³ã (Pro bin ãã©ã«ããŒãã) æ¢ã«èªã¿èŸŒãã§ãã Pro ã¢ã»ã³ããªãã¢ãã€ã³ã§äœ¿çšããå¿ èŠããããŸããããã«ã"CopyLocal=No" ã¯ãã¢ã»ã³ããªãã¢ãã€ã³ ã¢ãŒã«ã€ãã«å«ãŸããªããããã¢ãã€ã³ ã¢ãŒã«ã€ãã®ãµã€ãºãå€§å¹ ã«åæžããŸãã
ãã®åé¡ã解決ããã«ã¯ãVisual Studio 2022 ã 17.2 以äžã«ã¢ããã°ã¬ãŒãããããšããå§ãããŸãã Visual Studio 2022 ãã¢ããã°ã¬ãŒãããåŸãã¢ãã€ã³ ãããžã§ã¯ãã "ã¯ãªãŒã³" ãããããžã§ã¯ãå ã® "obj" ãã©ã«ããŒãåé€ãããŠããããšã確èªããŸãã.csproj ãŸã㯠.vbproj å ã®ãã¹ãŠã® Pro ã¢ã»ã³ããªåç §ããããã£ã確èªããCopyLocal ã No ã«èšå®ãããŠããããšã確èªããŸãããããžã§ã¯ããåæ§ç¯ããŸãã
17.1.6 以äžã䜿çšããŠããå Žåã移è¡ããŒã«ã¯ã移è¡äžã®ã¢ãã€ã³ ãããžã§ã¯ãã«æ¢ã«ååšããã¢ã»ã³ããªåç §ã®ã³ã㌠ããŒã«ã«åäœã "ä¿®æ£" ããŸãããã ããè¿œå ã®ã¢ã»ã³ããªåç § (Esri 以å€ã®åç §ãå«ã) ã移è¡ã®å®è¡åŸã«ãããžã§ã¯ãã«è¿œå ããCopyLocal = No ã®å Žåã¯ãæåã§ä¿®æ£ããå¿ èŠããããŸã (Visual Studio 2022 ã 17.1.2 ã«ã¢ããã°ã¬ãŒãããªãéã)ã
CopyLocal=No ã§ã¢ã»ã³ããªåç
§ãä¿®æ£ããã«ã¯ãé¢é£ããã¢ã»ã³ããª|ã¢ã»ã³ããªã® .csproj/.vbproj ãšã³ããªãç·šéãããšã³ããªã« <Private>False</Private>
ãè¿œå ããŠãCopyLocal=No ã®åäœã匷å¶ããŸã (泚: CopyLocal Yes\No ã¯ãããžã§ã¯ã ãã¡ã€ã«ã« True|False ãšããŠä¿åãããŸã)ã<Private>
ã¯ãCopy Local ãå¶åŸ¡ããããã«äœ¿çšããé©å㪠MSBuild ã®ããã¥ã¡ã³ãåãããã¿ã° ã§ãã<CopyLocal>
ã¿ã°ãååšããå Žåãignored ã«ãªããŸãã
ä¿®æ£åãšä¿®æ£åŸã®ã¢ã»ã³ããªåç §ã®ååŸã®äŸã次ã«ç€ºããŸãã
ãããããã©ã«ãã§ã - ã³ã㌠ããŒã«ã«ãæå®ãããŠããªããããåäœã¯ããã©ã«ã㧠true ãŸã㯠"Yes" ã«ãªããŸãã
<Reference Include="ArcGIS.Desktop.Framework">
<HintPathC:\Program Files\ArcGIS\Pro\bin\ArcGIS.Desktop.Framework.dll</HintPath>
</Reference>
ãã®äŸã§ã¯ããŠãŒã¶ãŒã¯ VS 2022 UI ãä»ã㊠UI ã§ãCopyLocal=Noããèšå®ããŠããŸããVS 2022 ãã¢ã»ã³ããªåç §ã«ãFalseãã¿ã°ãè¿œå ããŠããããšã«æ³šæããŠãã ãããããã«ãããVisual Studio UI ãæ£ããåæãããŸãããæ®å¿µãªãããMSBuild ã§ã¯ç¡èŠãããã¢ã»ã³ããªã¯ãšã«ããããŒã«ã«ã«ã³ããŒãããŸãããã㯠Visual Studio ã® ãã° ã§ã"Private" ã¿ã°ã®ä»£ããã« "CopyLocal" ã¿ã°ãè¿œå ãããŸããããã©ã€ããŒããã¿ã°ã䜿çšããå¿ èŠããããŸãã
<Reference Include="ArcGIS.Desktop.Framework">
<HintPathC:\Program Files\ArcGIS\Pro\bin\ArcGIS.Desktop.Framework.dll</HintPath>
<CopyLocal>False</CopyLocal> <!-- this tag is -ignored- -->
</Reference>
ãã®ãªãã¡ã¬ã³ã¹ã¯ãã³ã㌠ããŒã«ã«ãç¡å¹ã«ããããã«ãæ¬ èœããŠãã <Private>False</Private>
ã¿ã°ãå«ãããã«æäœæ¥ã§ä¿®æ£ããå¿
èŠããããŸãã"" ã¯ã³ã㌠ããŒã«ã«ã®åäœãå¶åŸ¡ããããã® MSBuildã§ææžåãããã¿ã° ã§ãã
<Reference Include="ArcGIS.Desktop.Framework">
<HintPathC:\Program Files\ArcGIS\Pro\bin\ArcGIS.Desktop.Framework.dll</HintPath>
<CopyLocal>False</CopyLocal> <!-- this tag is -ignored- -->
<Private>False</Private> <!-- to prevent copy local, this tag is -required- -->
</Reference>
å¿ èŠã«å¿ããŠãCopyLocalãã¿ã°ãåé€ããããšãã§ããŸãããUI ã® CopyLocal éžæã«ã¯ç©ºçœã衚瀺ãããŸã (ãªãã·ã§ã³ãéžæãããŠããŸãã)ã
<Reference Include="ArcGIS.Desktop.Framework">
<HintPathC:\Program Files\ArcGIS\Pro\bin\ArcGIS.Desktop.Framework.dll</HintPath>
<!-- to prevent copy local, this tag is -required- -->
<Private>False</Private> <!-- note: CopyLocal tag has been deleted -->
</Reference>
ã¢ãã€ã³ãå€æããããã2 çªç®ã®æé ãšããŠãã¢ãã€ã³ãã³ã³ãã€ã«ãã.NET 6 ãžã®å€æã«èµ·å ãããã¹ãŠã®ã³ã³ãã€ã© ãšã©ãŒãä¿®æ£ããŸããé倧ãªå€æŽã¯ãéåžžã次㮠4 ã€ã®ã«ããŽãªã®ããããã«åé¡ãããŸãã
- .NET Framework 4.x ãã .NET 6 ãžã®åãæ¿ãã«é¢é£ããå€æŽ (ãã€ããŒ)ãMicrosoft Windows äºææ©èœãã㯠nuget ããããžã§ã¯ãã«è¿œå ããå¿ èŠãããå ŽåããããŸãã
- 以åã« 2.x ãªãªãŒã¹ã§å»æ¢ãããã¯ã©ã¹ãã¡ãœãããããã³ããããã£ã¯ã3.0 㧠åé€ ãããŸããã
- 3.0 ã® Pro API ã§ã¯ããªããžã§ã¯ã ID ã 64 ããã (ãã³ã°) ãšããŠå®çŸ©ãããããã«ãªããŸããããããªã㯠API ã®ãã®ãextra widthãã¯ããžãªããŒã¿ããŒã¹ããã³åºç€ãšãªãããŒã¿ããŒã¹ã® 64 ããã oid ã«å¯ŸããçŸåšããã³å°æ¥ã®å€æŽã«å¯Ÿå¿ããããã®ãã®ã§ãã
- äžè²«æ§ãå質ãæ¹åããéè€ããæ©èœãåé€ããããã®åœåããã©ã¡ãŒã¿ãŒã®é åºãªã©ã«é¢é£ãã API ã®å€æŽãããã«ã¯ã3.0 ã§ã® CIM XML æ°žç¶æ§ã®åé€ã«é¢é£ããé倧ãªå€æŽãå«ãŸããŸãã
ã³ã³ãã€ã© ãšã©ãŒãä¿®æ£ããã«ã¯ãå€ãåç § (ã¯ã©ã¹ãã¡ãœãããããããã£ãåæåãªã©) ãæ°ããåç §ã«å€æŽããå¿ èŠããããŸãããããã®åã«ããŽãªã®æŠèŠã¯æ¬¡ã®ãšããã§ãã
泚: Python ããŒã«ããã¯ã¹ãã«ã¹ã¿ã ãããžã§ã¯ããããã³ 3.x ã§äœ¿çšããã¢ããªã±ãŒã·ã§ã³ ããããã£ãªã©ã®ã«ã¹ã¿ã ã¢ãã€ã³ ã³ã³ãã³ãã®ç§»æ€ã«é¢é£ããŠãå³å¯ã«ã¯ API (é倧ãª) å€æŽã§ã¯ãªããä»ã®å€æŽãå¿ èŠã«ãªãå ŽåããããŸãããããã®èæ ®äºé ã¯ããã®ããã¥ã¡ã³ãã® è¿œå ã®ç§»è¡ã«é¢ãã泚æäºé ã»ã¯ã·ã§ã³ã§èª¬æãããŠããŸãã
.NET 6 ãžã®åãæ¿ãã«é¢é£ããé倧ãªå€æŽã¯æ¯èŒç軜埮ã§ããã圱é¿ãåããå¯èœæ§ã®ããé倧ãªå€æŽãããã€ãæ®ã£ãŠããŸããäŸãã°ã.NET ã§å©çšã§ããªã API ãŸãã¯ãã¯ãããžã䜿çšãããµãŒã ããŒãã£ã®ãŠãŒã¶ãŒ ã³ã³ãããŒã«ãŸãã¯ãµãŒã ããŒãã£ã®ã©ã€ãã©ãªã¯ã.NET ã®åçã®ã³ã³ãããŒã«ãŸãã¯ã©ã€ãã©ãªã«åãæ¿ããå¿
èŠããããŸããWindows åºæã®ãã¯ãããžã«äŸåããŠãããããMicrosoft ã«ãã£ãŠ .NET ã«ç§»æ€ãããªãã£ã API ã«ã¯ãWindows ã¬ãžã¹ããªãš GDI+ (äŸãã°ãSystem.Drawing
) ãå«ãŸããŸããå®å
šãªãªã¹ãã«ã€ããŠã¯ã.NET 6 ã«ããã Microsoft ã®ç Žå£çå€æŽ ãåç
§ããŠãã ããã
Microsoft ãæäŸãã Windows äºææ©èœãã㯠Nuget ããããžã§ã¯ãã«è¿œå ãããšã.NET Framework ãã .NET ãžã®é倧ãªå€æŽã®åé¡ã®å€ãã«èªåçã«å¯ŸåŠã§ããŸããWindows äºææ©èœããã¯ã®è©³çŽ°ã«ã€ããŠã¯ããã¡ã ããMicrosoft ã® .NET Framework ãã .NET ãžã®ç§»è¡ããŸãã¯ã移æ€ãã¬ã€ããã«ã€ããŠã¯ ãã¡ã ãåç
§ããŠãã ããã Pro SDK 3.x ã®ãµã³ãã«ãšã¹ããããããWindows äºææ©èœãã㯠Nuget ãå©çšããŠããŸããã¢ãã€ã³å
ã§äœ¿çšãããå¯èœæ§ã®ãããããäžè¬ç㪠Windows API ã®ãã¡ãWindows äºææ©èœããã¯ãå¿
èŠãšãããã®ã¯ System.Drawing
ãš Registry access ã® 2 ã€ã§ãã
éæšå¥šã®åãšã¡ã³ããŒã¯ 3.0 ã§åé€ãããŸãããéæšå¥šã®åãŸãã¯ã¡ã³ããŒã䜿çšãããšã以å㯠Visual Studio ã§ã³ã³ãã€ã©ã®èŠåãšããŠè¡šç€ºãããŠããŸãããéæšå¥šã®åãŸãã¯ã¡ã³ããŒãåç §ããã³ãŒãã¯ããã®ä»£ããã䜿çšããããã«å€æŽããå¿ èŠããããŸãã以åã« [Obsolete] ãšããŒã¯ããããã¹ãŠã®åãšã¡ã³ããŒã¯åé€ãããŸãããã¯ã©ã¹ãã¡ãœããããŸãã¯ããããã£ãããŒã¯ãããŠããå Žåã2.x ã§å»æ¢ãããã³ã³ãã³ããåç §ããŠããã¢ãã€ã³ã¯éåžžãã³ã³ãã€ã©ã®èŠå ãåãåããŸããã³ãŒã ããŒã¹ã§ Obsolete å±æ§ ã䜿çšããŸãã
ãããªã㯠API ã®é倧ãªå€æŽã«ã€ããŠã¯ãã¢ã»ã³ããªã®é倧ãªå€æŽç¹ ã»ã¯ã·ã§ã³ã§è©³ãã説æããŠããŸãã
ãžãªããŒã¿ããŒã¹ã®çŸåšããã³å°æ¥ã®æ¡åŒµã«å¯Ÿå¿ããŠã64 ãããã®ãªããžã§ã¯ã ID (oids) ã䜿çšã§ããããã«ããããã«ããããªã㯠API ã¯ãoidããã©ã¡ãŒã¿ãŒã®åç
§ãšæ»ãå€ã Int32 ãã long ã«åãæ¿ããŸãããããã«ã¯ãSelection.GetCount()
topic7637.htmlãããã¯ããã®å€æŽã®åœ±é¿ãåããã¢ãã€ã³ã®ã³ãŒãã§ã¯ãããªãæ©æ¢°çãªå€æŽã«ãªãã¯ãã§ããæé»çã«åæå®ãããå€æ° ã䜿çšããããã« var
ã䜿çšããã¢ãã€ã³ã«ã€ããŠã¯ãã³ã³ãã€ã©ãèªåçã« "var" ã®æé»ã®åã int ãã long ã«å€æŽãããããç®ç«ã£ãã³ãŒãã®å€åã¯ãããŸããããã以å€ã®å Žåãå€æ° oid ã "count" ãæ瀺çã« int
ãšããŠå®£èšãããŠããå Žåãã¢ãã€ã³ã¯é¢é£ããå€æ°ã long
ãšããŠå®£èšããããã«é©åãªå€æŽãè¡ãå¿
èŠããããŸããlong ã int å€ã«ä»£å
¥ããããšãããšãCannot implicitly convert type 'long' to 'int'. An explicit conversion exists (are you missing a cast?)
ã®ãããªã³ã³ãã€ã© ãšã©ãŒãçºçããŸããç¬èªã®ããŒã¿ ã¹ãã¢ãã«ã¹ã¿ã (é esri) ããŒã¿ ã¹ãã¢ã« oid å€ãæ ŒçŽããã¢ãã€ã³ã¯ãé¢é£ããã¹ããŒããå€æŽããŠãint å€ã§ã¯ãªã long å€ã«å¯Ÿå¿ããå¿
èŠãããå ŽåããããŸãã
ãã©ã°ã€ã³ ããŒã¿ãœãŒã¹
ãã©ã°ã€ã³ ããŒã¿ãœãŒã¹ã®ã«ã¹ã¿ã ããŒãã« ãã³ãã¬ãŒã ã¯ã©ã¹ã¯ãArcGIS.Core.Data.PluginDatastore.PluginTableTemplate
ãã掟çããå¿
èŠããããŸãã3.0 以éã§ã¯ãPluginTableTemplate ã 64 ããã ãªããžã§ã¯ã ID ã䜿çšããŸãããããã£ãŠãå¿
èŠã«å¿ããŠãã©ã°ã€ã³ ããŒã¿ãœãŒã¹ã®ã«ã¹ã¿ã ã³ãŒãã«å€æŽãå ããŠã64 ããã OID ã«å¯Ÿå¿ããå¿
èŠããããŸããå
·äœçã«ã¯ãPluginTableTemplate.GetNativeRowCount 㯠long ãè¿ããSearch ãã PluginRow ã® [Values] ã§è¿ãããã³ã¬ã¯ã·ã§ã³ã® oid å€ã 64 ããã (ã€ãŸã long) ã§ããå¿
èŠããããŸããQueryFilter ã® ObjectIDs ããããã£ã long åã«ãªããŸãã
//At 2.x
public override int GetNativeRowCount() {
//your implementation here...
...
}
//3.x - note the return type
public override long GetNativeRowCount() {
//your implementation here...
...
}
è¿œå ã® API ã®é倧ãªå€æŽ (ã€ãŸãã.Net 6 ã§ã®éæšå¥šã®ã³ã³ãã³ããããã³ 64 ããã oid ã«é¢é£ãããã®ä»¥å€ã®é倧ãªå€æŽ) ã«ã¯ã次ã®ãã®ããããŸãã
- API ã®äžè²«æ§ãåäžãããããã®ååã®å€æŽãŸãã¯ã倧æå/å°æåãã®å€æŽã
- 2.x ãªãªãŒã¹ã®éçšã§äœæãããå€ãã®ãªãŒããŒããŒããšé¢æ°ã®çµ±åãã€ãã³ãã«ã€ããŠãåæ§ã§ãã
- ãã©ã¡ãŒã¿ãšæ»ãå€ã®å€æŽ (äŸ: é åãã IEnumerable ãŸãã¯ãªã¹ããž)
- å Žåã«ãã£ãŠã¯ã3.0 ã§ã®è¿œå æ©èœãŸãã¯æ¹åãããæ©èœã«å¯Ÿå¿ããããã«ãã¯ã©ã¹ãã¡ãœãããããããã£ãªã©ãååå€æŽã§ã¯ãªã眮ãæããããŠããŸãã
- å Žåã«ãã£ãŠã¯ãäžè²«æ§ãåäžãããããã«ã¯ã©ã¹ã®åå空éãå€æŽãããŠããŸãã
äž»ãªé倧ãªå€æŽã«ã€ããŠã¯ã次㮠ã¢ã»ã³ããªã®é倧ãªå€æŽç¹ ã»ã¯ã·ã§ã³ã§èª¬æããŸãã
ãŸããArcGIS Pro ã® CIM æ°žç¶æ§ã¢ãã«ã 2.x ã® xml ãã 3.0 以é ã® json ã«å€æŽãããããšã«é¢é£ããå€æŽããããŸããCIM æ°žç¶æ§ã®äœ¿çšã«é¢é£ããå€æŽã«ã€ããŠã¯ãCIM ã®æ°žç¶æ§ ã»ã¯ã·ã§ã³ã§èª¬æããŸãã
ãã®ç§»è¡ã¬ã€ãã§æäŸãããæ å ±ä»¥å€ã«ããã¢ãã€ã³éçºè 㯠Pro SDK Community Samples ã Pro Snippets ãåç §ãããšäŸ¿å©ã§ãããããã¯ãã¹ãŠ 3.x ã«å€æãããŠããŸãã
API ãªãã¡ã¬ã³ã¹ã® What's New for Developers at 3.0 ã«ã¯ã3.0 ã§çºçãããã¹ãŠã® API ã®å€æŽã® å®å šãª ãªã¹ããå«ãŸããŠããŸãã
ãã®ã»ã¯ã·ã§ã³ã§ã¯ã3.x ã¢ãã€ã³ã®ç§»è¡ãæ¯æŽããããã«ãã¢ã»ã³ããªããšã«äž»èŠãªé倧ãªå€æŽã®æŠèŠã瀺ããŸãã3.0 ã§ã® API ã®å€æŽç¹ã®å®å šãªãªã¹ãã«ã€ããŠã¯ãAPI ãªãã¡ã¬ã³ã¹ã® What's New ãåç §ããŠãã ããã
CIM
3.0 ã§ã¯ãã¢ãã€ã³ã¯æ°žç¶å圢åŒãšã㊠json ã䜿çšããå¿
èŠããããŸãã2.x ã§ä¿åãããŠããã·ãªã¢ã©ã€ãºããã CIM xml ã 3.x CIM ãªããžã§ã¯ã ã€ã³ã¹ã¿ã³ã¹ã«å€æããã«ã¯ãã¢ãã€ã³ã¯ 3.0 ã§è¿œå ããã ArcGIS.Core.CIM.XmlUtils.UpgradeAndDeserializeCIMObject(xml)
, topic 75062 ã䜿çšããå¿
èŠããããŸãã
CIM æ°žç¶æ§ã®äœ¿çšã«é¢ããå€æŽç¹ã¯ãCIM æ°žç¶æ§ ã®ã»ã¯ã·ã§ã³ã§è©³ãã説æãããŠããŸããããããåºæ¬çãªäŸã¯æ¬¡ã®ãšããã§ããã
//At 2.x - persistence using xml - cimObject.ToXml()
simpleRenderer.ToXml()
//and the derived static CIMObject.FromXml() method
//eg for CIMSimpleRenderer
var simpleRenderer = CIMSimpleRenderer.FromXml(xml_string);
//At 3.x
//addins should use cimObject.ToJson()
simpleRenderer.ToJson();
//and the derived static CIMObject.FromJson() method
//eg for CIMSimpleRenderer
var simpleRenderer = CIMSimpleRenderer.FromJson(json_string);
//use to convert CIM xml previously persisted at 2.x -consult the
//CIM Persistence section for more details
var simpleRenderer = (CIMSimpleRenderer)ArcGIS.Core.CIM.XmlUtils.UpgradeAndDeserializeCIMObject(
simple_renderer_xml_from_2x);
3.0 ã§ã¯ãCIMGenericView
ã§äœ¿çšããã XML æ°žç¶æ§ã¢ãã«ã«å€æŽããããTOCMapPaneProviderPane
ãã掟çããã«ã¹ã¿ã ããã ãã€ã³ ãã¥ãŒ ã¢ãã«ã䜿çšããããã ãã€ã³åœè£
ã®å®è£
ããããŸãã ããã㯠16597ãã«ã¹ã¿ã ããã ãã€ã³ãšåœè£
ããã ãã€ã³ã¯ãããã㯠1481 ã® CIMGenericView
ãšããŠä¿æãããŸãã.aprx é¢é£ããå€æŽã«ã€ããŠã¯ããã®ããã¥ã¡ã³ãã® ã«ã¹ã¿ã CIMGenericView ãš ViewXML ã»ã¯ã·ã§ã³ãåç
§ããŠãã ããã
3.0 ã§ã¯ãArcGIS.Core.CIM.CIMObjectMarker3D
ãåé€ãããŸãããã¢ãã€ã³ã¯ã代ããã« ArcGIS.Core.CIM.CIMMglTFMarker3D
ã䜿çšããå¿
èŠããããŸãã GL Transmission Format (.glTF ãã¡ã€ã«) ã¯ã3D ã¢ãã«ã転éããããã®æ¥çæšæºã®äº€æ圢åŒã§ãã.glTF ã®è©³çŽ°ã«ã€ããŠã¯ããã¡ã ãåç
§ããŠãã ãããããã«ãCIMObjectMarker3D.ExportWeb3DObjectResource()
ã¡ãœããã䜿çšã㊠3D Esri Javascript 圢åŒã§äœ¿çšããããã« 3D ã·ã³ãã«ã json 圢åŒã«ãšã¯ã¹ããŒãããŠããå Žåã¯ã代ããã« Web ã¹ã¿ã€ã« (ãããã®ããŒã«ãŒçš) ã®äœæã«åãæ¿ããå¿
èŠããããŸããWeb ã¹ã¿ã€ã«ã䜿çšãã 3D ã·ã³ãã«ã®å
¬éã®è©³çŽ°ã«ã€ããŠã¯ã次ã®ãªã³ã©ã€ã³ ããã¥ã¡ã³ããåç
§ããŠãã ãã: Web ã¹ã¿ã€ã«ã®å
±æããŸãããã®ããã°èšäºãåèã«ãªããŸã: 3D ã·ã³ãã«ãå«ã Web ã¹ã¿ã€ã«ãå
¬éããæ¹æ³ã
Data / Geodatabase
ãžãªããŒã¿ããŒã¹ã®çŸåšããã³å°æ¥ã®æ¡åŒµã«å¯Ÿå¿ããŠã64 ãããã®ãªããžã§ã¯ã ID (oids) ã䜿çšã§ããããã«ããããã«ããããªã㯠API ã¯ãoidããã©ã¡ãŒã¿ãŒã®åç §ãšæ»ãå€ã Int32 ãã long ã«åãæ¿ããŸãããããã«ã¯ãã¬ã³ãŒãæ°ãšãã£ãŒãã£æ°ãå«ãŸããlong ãšããŠãè¿ãããããã«ãªããŸãããããã«ã€ããŠã¯ããã®ããã¥ã¡ã³ãã®ååã® 64 ãããã®ãªããžã§ã¯ã ID ã»ã¯ã·ã§ã³ã§èª¬æããŸããã
3.0 ã§ã¯ãReconcile ãš Post ã«é¢ãã API ã匷åãããŸãããPost ã¯ããããªã㯠API 㧠Reconcile ãšã¯å¥ã®ã¢ã¯ã·ã§ã³ãšããŠå®è¡ã§ããããã«ãªããŸãããããã¯ã以åã« ReconcileDescription
ã¯ã©ã¹ãš version.Reconcile()
ã¡ãœããã䜿çšããŠããã³ãŒãã«åœ±é¿ããŸãã詳现ã«ã€ããŠã¯ãProConcepts Geodatabase ãåç
§ããŠãã ããã
//At 2.x -
ReconcileDescription reconcileDescription = new ReconcileDescription(parentVersion);
reconcileDescription.ConflictResolutionMethod = ConflictResolutionMethod.Continue; //continue if
reconcileDescription.WithPost = true; //conflicts are found
// Reconcile and post
ReconcileResult reconcileResult = currentVersion.Reconcile(reconcileDescription);
ReconcileResult.HasConflicts can be checked as-needed
//At 3.x use ReconcileOptions
var reconcileOptions = new ReconcileOptions(parentVersion);
reconcileOptions.ConflictResolutionMethod = ConflictResolutionMethod.Continue; //continue if
//conflicts are found
reconcileOptions.ConflictDetectionType = ConflictDetectionType.ByRow; //Default
reconcileOptions.ConflictResolutionType = ConflictResolutionType.FavorTargetVersion;//or FavorEditVersion
// Reconcile and post as two separate actions
ReconcileResult reconcileResult = currentVersion.Reconcile(reconcileOptions);
if (!reconcileResult.HasConflicts) {
//No conflicts, perform the post
var postOptions = new PostOptions(parentVersion);
//var postOptions = new PostOptions(); for default version
postOptions.ServiceSynchronizationType = ServiceSynchronizationType.Synchronous;//Default
currentVersion.Post(postOptions);
}
//Reconcile and post as a single action (similar to 2.x)
ReconcileResult reconcileResult = currentVersion.Reconcile(reconcileOptions, postOptions);
if (reconcileResult.HasConflicts) {
//TODO resolve conflicts
}
ArcGIS.Core.Data.GeodatabaseException
ãã掟çããArcGIS.Core.Data.GeodatabaseException
ãå«ããã¹ãŠã®ãžãªããŒã¿ããŒã¹äŸå€ã¯ã©ã¹ã¯ãäžè²«æ§ãä¿ã€ããã«æ°ããåå空é ArcGIS.Core.Data.Exceptions ã«ç§»åãããŸããã
//At 2.x
using ArcGIS.Core.Data;
...
try {
...
} catch(GeodatabaseException ge) {
//At 3.x
using ArcGIS.Core.Data;
using ArcGIS.Core.Data.Exceptions
try {
...
} catch(GeodatabaseException ge) {//or use explicit reference
//ArcGIS.Core.Data.Exceptions.GeodatabaseException
Utility Network
åå空é ArcGIS.Core.Data.UtilityNetwork.NetworkDiagrams
㯠ArcGIS.Core.Data.NetworkDiagrams ã«çœ®ãæãããŸããã
Geometry
ãžãªã¡ããªãšæŽŸçãžãªã¡ããªã¯ã©ã¹ã® ToXML()
ã¡ãœãã㯠ToXml()
ã«ååãå€æŽãããŸãã (倧æåãšå°æåã®å€æŽã«æ³šæããŠãã ãã)ãToXML()
ãåç
§ããŠããã¢ãã€ã³ã¯ã代ããã« ToXml()
ãåç
§ããããã«ã³ãŒããå€æŽããå¿
èŠããããŸããããã«ãSpatialReferenceBuilder.FromXML()
㯠SpatialReferenceBuilder.FromXml()
ã«ååãå€æŽãããŸããã
//At 2.x
var xml = geometry.ToXML();
var xml = envelope.ToXML();
var xml = mapPoint.ToXML();
var xml = polygon.ToXML();
var xml = polyline.ToXML();
//At 3.x
var xml = geometry.ToXml();
var xml = envelope.ToXml();
var xml = mapPoint.ToXml();
var xml = polygon.ToXml();
var xml = polyline.ToXml();
ArcGIS.Core.Geometry.GeometryException
ããã³æŽŸçãããžãªã¡ããªäŸå€ã¯ãæ°ããåå空é ArcGIS.Core.Geometry.Exceptions ã«ç§»åãããŸãããæ¢åã®ãžãªã¡ããªäŸå€ãžã®åç
§ã¯ãããã«åãããŠå€æŽããŠãã ããã
// At 2.x
using ArcGIS.Core.Geometry;
...
try {f
...
} catch(GeometryException ge) {
// At 3.x
using ArcGIS.Core.Geometry;
using ArcGIS.Core.Geometry.Exceptions
try {
...
} catch(GeometryException ge) {//or use explicit reference
//ArcGIS.Core.Data.Exceptions.GeometryException
3.x ã§ã¯ãæ¥é èŸ esri
ãæã€ãžãªã¡ããªåæåã¯æ¥é èŸ Esri
ãæã€ããã«å€æŽãããããæ¥é èŸ esri
ãé€å»ãããŸãããããã¯ãenum ã®å€ãå«ã¿ãŸãã
enum esriArcOrientation --> enum ArcOrientation also, `esri` value prefix has been removed
enum esriClothoidCreateMethod -->enum ClothoidCreateMethod
enum esriCurveDensifyMethod -->enum CurveDensifyMethod
enum esriPatchType -->enum PatchType
enum esriTextureCompressionType -->enum TextureCompressionType
enum EsriShapeExportFlags --> all value prefixes changed from `esri` to `Esri`
enum EsriShapeImportFlags --> all value prefixes changed from `esri` to `Esri`
ãã®ä»ãenum ã®å€æŽ:
enum GeometryDimension --> enum GeometryDimensionType
enum JSONExportFlags --> enum JsonExportFlags - all value prefixes changed from `json` to `Json`
enum JSONImportFlags --> enum JsonImportFlags - all value prefixes changed from `json` to `Json`
enum Monotonic --> enum MonotonicType
enum SegmentExtension --> enum SegmentExtensionType
enum WKBExportFlags --> enum WkbExportFlags - all value prefixes changed from `WKB` to `Wkb`
3.0 ã§ã¯ãæ§äžä»£ã®ãžãªã¡ããªããã³ã»ã°ã¡ã³ã ãã«ããŒã¯åé€ãããŸãããæ§äžä»£ã®ãã«ããŒã䜿çšããŠãžãªã¡ããªãã»ã°ã¡ã³ããäœæããã¢ãã€ã³ã¯ãæ°ãããExããã«ããŒã䜿çšããããã«å€æŽããå¿ èŠããããŸãã2.5+ ããã¯ãæ°äžä»£ã®ãã«ã㌠(ProConcepts-Geometry#second generation-builder-classes) ããããªã㯠API ã«å°å ¥ãããŠããŸãããããã®ãæ°ããããã«ããŒã¯ãååã«ãExããè¿œå ãããŠãããPolygonBuilderEx, PolylineBuilderEx, EnvelopeBuilderEx ãšãã£ãããã«ããæ°ããããã«ããŒãè¿œå ãããŠããŸãã
æ°ãããžãªã¡ã㪠ãã«ããŒãšã»ã°ã¡ã³ã ãã«ããŒã¯ããã«ããŒã MCT* ã§äœæãããå¿
èŠããªããªããŸãããã€ãŸããQueuedTask* ã ãã§ãªãã_ä»»æã®ã¹ã¬ãã_ã§å®è¡ã§ããŸãããã«ããŒã®ãExã㯠IDisposable ã§ã¯ãªããããå€ããã«ããŒã®æå¹æéã using(....)
ã¹ããŒãã¡ã³ãã§ã¹ã³ãŒããã 2.x ã³ãŒãã¯ãæ°ãããã«ããŒãæ±ããšãã« "using" ãåé€ããå¿
èŠããããŸãã2.x ã¢ãã€ã³ã¯æ¢ã«ãã«ããŒãExãã䜿çšããŠãããå€æŽã¯ãããŸããã
//At 2.x ---> 3.0
class MapPointBuilder --- > class MapPointBuilderEx
class MultipointBuilder --- > class MultipointBuilderEx
class LineBuilder --- > class LineBuilderEx
class EllipticArcBuilder --- > class EllipticArcBuilderEx
class CubicBezierBuilder --- > class CubicBezierBuilderEx
class PolylineBuilder --- > class PolylineBuilderEx
class EnvelopeBuilder --- > class EnvelopeBuilderEx
class PolygonBuilder --- > class PolygonBuilderEx
class GeometryBagBuilder --- > class GeometryBagBuilderEx
class MultipatchBuilder --- > class MultipatchBuilderEx
//class SpatialReferenceBuilder is not replaced
ããã¯ãå€ããã«ããŒã䜿çšãã 2.x ã¢ãã€ã³ ã³ãŒãã®äŸã§ããããã«ããŒã®ãExãçžåœã䜿çšã㊠3.0 ã³ãŒãã«å€æãããŸãã
//2.x
QueuedTask.Run(() => {
//Builders at 2.x are IDisposable - can scope lifetime with a "using" block
using (PolylineBuilder polylineBuilder = new PolylineBuilder(polyline)) {
polylineBuilder.ReverseOrientation();
var reversedPolyline = polylineBuilder.ToGeometry();
}
});
QueuedTask.Run(() => {
//Run on the MCT
var circularArc = EllipticArcBuilderEx.CreateEllipticArcSegment(segment1, segment2, maxRadius, hintPoint);
//etc
});
//At 3.x - no using(...) - Builder "Ex" are not IDisposable
var polylineBuilder = new PolylineBuilderEx(polyline);
polylineBuilder.ReverseOrientation();
var reversedPolyline = polylineBuilder.ToGeometry();
// Most of the BuilderEx convenience methods do not need the MCT.
var circularArc = EllipticArcBuilderEx.CreateCircularArc(
segment1, segment2, maxRadius, hintPoint);
//However, this particular EllipticArcBuilderEx constructor _does_ need the MCT. Please refer
//to the API reference as needed. There are only a handful of such cases
QueuedTask.Run(() => {
var cab = new EllipticArcBuilderEx(segment1, segment2, maxRadius, hintPoint);
var otherCircularArc = cab.ToSegment();
//etc
});
泚: SpatialReferenceBuilder ã¯ããExãã«çžåœãããã®ã«çœ®ãæããããŸãããGeometry API ã®è©³çŽ°ã«ã€ããŠã¯ãProConcepts: Geometry ãåç §ããŠãã ããã
*MCT ãå¿ èŠãšãããã«ã㌠Ex ã¡ãœãããšã³ã³ã¹ãã©ã¯ã¿ãŒããŸã ããã€ããããŸããããã¯ãEllipticArcBuilderExãPolylineBuilderEx ããã³ PolygonBuilderEx ã¯ã©ã¹ã§ããæ®ãã®ã¹ã¬ãã ã¢ãã£ããã£ã¯ãä»åŸã® 3.x ãªãªãŒã¹ã§åé€ãããŸãã
Licensing
3.0 ã§ã¯ã2.8 ã§å»æ¢ããã LicensingInformation.IsAvailable(licenseCode)
ã¡ãœãããåé€ãããŸãããã¢ãã€ã³ã¯ã代ããã« LicenseInformation.IsCheckedOut(licenseCode)
ã¡ãœãã ããã㯠72618 ã䜿çšããå¿
èŠããããŸãã
3.0 ã§ã® API ã®å€æŽç¹ã®å®å šãªãªã¹ãã«ã€ããŠã¯ãAPI ãªãã¡ã¬ã³ã¹ã® What's New ãåç §ããŠãã ããã
3.0 ã§ã® API ã®å€æŽç¹ã®å®å šãªãªã¹ãã«ã€ããŠã¯ãAPI ãªãã¡ã¬ã³ã¹ã® What's New ãåç §ããŠãã ããã
3.0 ã§ã¯ãArcGIS.Desktop.Catalog.OpenItemDialog.Items
ããã®æ»ãå€ã IEnumerable<Item>
ãã IList<Item>
ã«å€æŽãããŸããã
ArcGIS.Desktop.Catalog.ItemFilters
ãããã㣠ã¯ãã£ã¡ã« ã±ãŒã¹ã«å€æŽãããŠããŸããäŸãã°ã次ã®ããã«ãªããŸãã
// At 2.x At 3.x
ItemFilters.annotation => ItemFilters.Annotation
ItemFilters.cad=> ItemFilters.Cad
ItemFilters.composite_addToMap => ItemFilters.Composite_AddToMap
...
3.0 ã§ã® API ã®å€æŽç¹ã®å®å šãªãªã¹ãã«ã€ããŠã¯ãAPI ãªãã¡ã¬ã³ã¹ã® What's New ãåç §ããŠãã ããã
Cef ãš Cef Sharp ã®äœ¿çšã¯ 2.9 ã§å»æ¢ãããŸããã3.0 ã§ã¯ãCef ã¯ãµããŒããããªããªããŸãããã¡ãœãã ProApp.InitializeCef()
ã¯åé€ãããŸããã
ArcGISPortal
ã¡ãœããã®ã¹ã¬ããå¶éãå€æŽãããŸããã
ArcGIS.Desktop.Core.ArcGISPortal.SignIn()
, topic 14680 ãå€æŽãããŸãããåŒã³åºãå
ãæ§æã® OnApplicationInitializing ã³ãŒã«ããã¯å
ã«ãªãéããSignIn()
㯠QueuedTask ã§åŒã³åºãããŸãããã®ã¹ã¬ããå¶é㯠2.x ã§ã¯é©çšãããŸããã§ããã
ArcGIS.Desktop.Core.ArcGISPortal.SignOut()
, topic 14682 ãå€æŽãããŸãããåŒã³åºãå
ãæ§æã® OnApplicationInitializing ã³ãŒã«ããã¯å
ã«ãªãéããSignOut()
㯠QueuedTask ã§åŒã³åºãããŸãããã®ã¹ã¬ããå¶é㯠2.x ã§ã¯é©çšãããŸããã§ããã
ArcGIS.Desktop.Core.ArcGISPortal.GetSignOnUsername()
, topic 14676 ãå€æŽãããŸãããåŒã³åºãå
ãæ§æã® OnApplicationInitializing ã³ãŒã«ããã¯å
ã«ãªãéããGetSignOnUsername()
㯠QueuedTask ã§åŒã³åºãããŸãããã®ã¹ã¬ããå¶é㯠2.x ã§ã¯é©çšãããŸããã§ããã
ArcGIS.Desktop.Core.ArcGISPortal.GetToken()
, topic 14677 ãå€æŽãããŸãããåŒã³åºãå
ãæ§æã® OnApplicationInitializing ã³ãŒã«ããã¯å
ã«ãªãéããGetToken()
㯠QueuedTask ã§åŒã³åºãããŸãããã®ã¹ã¬ããå¶é㯠2.x ã§ã¯é©çšãããŸããã§ããã
3.0 ã§ã®ã«ã¹ã¿ã ã¢ã€ãã ã®å®è£
ã«é¢é£ãã IMappableItem
ããã³ IMappableItemEx
ãžã®å€æŽã«ã€ããŠã¯ãArcGIS.Desktop.Mapping.dll ãåç
§ããŠãã ããã
3.0 ã§ã® API ã®å€æŽç¹ã®å®å šãªãªã¹ãã«ã€ããŠã¯ãAPI ãªãã¡ã¬ã³ã¹ã® What's New ãåç §ããŠãã ããã
3.0 ã§ã® API ã®å€æŽç¹ã®å®å šãªãªã¹ãã«ã€ããŠã¯ãAPI ãªãã¡ã¬ã³ã¹ã® What's New ãåç §ããŠãã ããã
3.0 ã§ã¯ã(ArcGIS.Desktop.Editing.Templates.EditingTemplate
, topic 9918) ãã掟çãã掟çãã³ãã¬ãŒã ã¯ã©ã¹ ArcGIS.Desktop.Editing.Templates.EditingFeatureTemplate
ã ArcGIS.Desktop.Editing.Templates.EditingRowTemplate
, topic 76314 ã«å€æŽãããŸãããããã¯ã2.9 ã§å°å
¥ãããã¹ã¿ã³ãã¢ãã³ ããŒãã«ã§ã®ãã³ãã¬ãŒãã®ãµããŒãã«å¯Ÿå¿ããããã§ããEditingFeatureTemplate ã®åºã«ãªã CIM å®çŸ©ãCIMEditingTemplate
, topic 1174 ã䜿çšããç·šéæäœã®ãªãŒããŒããŒã ã¯ã©ã¹ãå€ãããŸãããå€æŽã®å€§éšåã¯ãäžè²«æ§ãåäžãããããã®ååãã¹ãã«ãããã³å€§æåãšå°æåã®å€æŽã§ããããã«ã¯ãArcGIS.Core.CIM.CIMExtensions editing ã¢ã»ã³ããªå
ã®ã¯ã©ã¹ã§å©çšå¯èœãªç·šéãã³ãã¬ãŒãã® extension ã¡ãœãããå«ãŸããŸãã2.x ã§ã¯ããããã®ã¡ãœãã㯠ArcGIS.Core.CIM.EditingTemplateCIMExtensions
ã¯ã©ã¹ãä»ããŠå©çšå¯èœã§ããã
2.x ã® CIMEditingTemplate ãã掟çãã CIMFeatureTemplate
ã䜿çšããŠããã¢ãã€ã³ã¯ã3.x ã® CIMRowTemplate
, topic 74946 ã«åç
§ãå€æŽããå¿
èŠããããŸãã
äŸã¯æ¬¡ã®ãšããã§ãã
using ArcGIS.Desktop.Editing.Templates;
...
// retrieve the CIM edit template definition - CIMEditingTemplate
var template = mapTool.CurrentTemplate;
var templateDef = template.GetDefinition();
//Property and extension method name changes
//At 2.x
templateDef.ToolProgID = toolContentGUID;
var toolIds = cimEditTemplate.GetExcludedToolDamlIds().ToList();
cimEditTemplate.SetExcludedToolDamlIds(toolIds.ToArray());
cimEditTemplate.AllowToolDamlID("esri_editing_SketchLineTool");
//get a template definition the feature layer
var resTemplate = featLayer.GetTemplate("Residential");
var resTempDef = resTemplate.GetDefinition() as CIMFeatureTemplate;
//use: var newTemplate = new CIMFeatureTemplate(); to create a new one
//EditOperation.Merge(...)
mergeFeatures.Merge(this.CurrentTemplate as EditingFeatureTemplate, featureLayer,
new List<long>() { 10, 96, 12 });
//At 3.x
templateDef.DefaultToolGUID = toolContentGUID;
var toolIds = cimEditTemplate.GetExcludedToolIDs().ToList();
cimEditTemplate.SetExcludedToolIDs(toolIds.ToArray());
cimEditTemplate.AllowToolID("esri_editing_SketchLineTool");
//get a template definition the feature layer
var resTemplate = featLayer.GetTemplate("Residential");
var resTempDef = resTemplate.GetDefinition() as CIMRowTemplate;
//use: var newTemplate = new CIMRowTemplate(); to create a new one
//EditOperation.Merge(...)
mergeFeatures.Merge(this.CurrentTemplate as EditingRowTemplate, featureLayer,
new List<long>() { 10, 96, 12 });
2.x ã§ã¯ãArcGIS.Desktop.Editing.Attributes.Inspector
ããã©ã«ã ã³ã³ã¹ãã©ã¯ã¿ãŒãããªãã·ã§ã³ã® bool isFeatureEditing = true
ãã©ã°ãåé€ãããŸããã3.0 ã§ã¯ãInspector ã¯åžžã«ã€ã³ã¹ã¿ã³ã¹åããããã£ãŒãã£ãŸãã¯è¡ãæŽæ°ã§ããããã«ãªããŸãã
//at 2.x
var insp = new Inspector(true | false);
//At 3.x
var insp = new Inspector();//isFeatureEditing = true is just assumed.
3.0 ã§ã¯ãEditOperation.Create ãªãŒããŒããŒãã ArcGIS.Desktp.Editing.RowToken
ãè¿ãããã«ãªã, topic 19317ãããã䜿ã£ãŠæ°ããäœæãããã£ãŒãã£ã® ObjectID ãš GlobalID (ç·šéæäœãæåãããšã) ãååŸã§ããããã«ãªããŸããã2.x ã§ã¯ããªããžã§ã¯ã ID ãååŸããã«ã¯ãAction<long> result
ãã©ã¡ãŒã¿ã䜿çšããå¿
èŠããããŸãããaction ãã©ã¡ãŒã¿ã¯ 3.x ã§åé€ãããŸããã
泚: chaining ç·šéæäœã®éã«ã¯ãæ°ããäœæããããã£ãŒãã£/è¡ã®ãªããžã§ã¯ã ID ãååŸããå¿ èŠããããŸãã
//At 2.x
long newFeatureID = -1;
editOp.Create(featLayer, poly, (oid) => newFeatureID = oid);
if (editOp.Execute()) {
//operation executed successfully
WriteToLog($"{featLayer.Name}: new feature: {newFeatureID}");
//At 3.x
long newFeatureID = -1;
var rowToken = editOp.Create(featLayer, poly);
if (editOp.Execute()) {
//operation executed successfully
long newFeatureID = (long)rowToken.ObjectID;
WriteToLog($"{featLayer.Name}: new feature: {newFeatureID}");
2.x ã§ã¯ãè€æ°ã® EditOperation ã¯ã©ã¹ã®ã¡ãœããããMapMembers ã® IEnumerable ãšã察å¿ãããªããžã§ã¯ã ID ã®ãªã¹ã IEnumerable<KeyValuePair<MapMember,List<long>>>
ããã©ã¡ãŒã¿ãŒãšããŠäœ¿çšããŠããŸãããäŸ: EditOperation.SplitãEditOperation.MoveãEditOperation.RotateãEditOperation.ReshapeãEditOperation.ScaleãEditOperation.Delete ãªã©ããã® IEnumerable ãã©ã¡ãŒã¿ãŒã¯ãMapView.SelectFeatures ãªã©ã® MapView ã® éžæã¡ãœããããã®éžæåºåãšäžèŽããŸãããMapView.SelectFeaturesExã3.0 ã§ã¯ãMapView ã®éžæã¯ãäžè¬ç㪠.NET ã³ã¬ã¯ã·ã§ã³ã§ã¯ãªããSelectionSet ã¯ã©ã¹ ã«ãã£ãŠãµããŒããããŸãã2.x ã§ãžã§ããªã㯠.NET ã³ã¬ã¯ã·ã§ã³/IEnumerable ã䜿çšããŠããç·šéæäœã¯ã3.0 㧠SelectionSet ã¯ã©ã¹ã䜿çšããããã«å€æŽãããŸãããSelectionSet
é¢é£ã®å€æŽã«ã€ããŠã¯ãArcGIS.Desktop.Mapping.dll ã»ã¯ã·ã§ã³ã§ã説æããŠããŸãã
//At 2.x - construct an enumerable of key value pairs from the mapview selection
var selFeatures = MapView.Active.GetFeatures(intersectPolygon).Select(
k => new KeyValuePair<MapMember, List<long>>(k.Key as MapMember, k.Value));
//pass to edit operation
editOp.Split(selFeatures, ...);
editOp.Move(selFeatures, ...);
editOp.Rotate(selFeatures, origin, ...);
editOp.Reshape(selFeatures, ...);
editOp.Scale(selFeatures, ...);
//At 3.x, MapView will return SelectionSet
var selSet = MapView.Active.GetFeatures(intersectPolygon);
//pass to edit operation
editOp.Split(selSet, ...);
editOp.Move(selSet, ...);
editOp.Rotate(selSet, origin, ...);
editOp.Reshape(selSet, ...);
editOp.Scale(selSet, ...);
3.0 ã§ã¯ãeditOperation.IsCancelled
ãã©ã°ã editOperation.IsCanceled
ã«å€æŽãããŸããã
3.0 ã§ã¯ãeditOperation.Duplicate(...)
ãåé€ãããŸããã2.x 㧠editOperation.Duplicate ã䜿çšããã¢ãã€ã³ã¯ã3.0 ã§ã³ã㌠+ 移åãŸãã¯äœæ + 移åç·šéæäœã¡ãœããã®çµã¿åããã䜿çšããå¿
èŠããããŸãã
var editOp = new EditOperation();
editOp.Name = "Duplicate Features";
//At 2.x
editOp.Duplicate(featureLayer, oid, 500.0, 500.0, 0.0);
//At 3.x, use either of a copy + move or a create + move
//in this example, an inspector is being used to access the feature attributes
//
var insp = new Inspector();
insp.Load(featureLayer, oid);
//make a copy using create + attributes
var rtoken = editOp.Create(featureLayer, insp.ToDictionary(a => a.FieldName, a => a.CurrentValue));
if (editOp.Execute()) {
//do a move - chain to keep the two operations as a single undo
var modifyOp = editOp.CreateChainedOperation();
modifyOp.Modify(featureLayer, (long)rtoken.ObjectID, GeometryEngine.Instance.Move(geom, 500.0, 500.0));
modifyOp.Execute();
}
3.0 ã§ã¯ãeditOperation.Transform(...)
ãš editOperation.TransformAffine(...)
ã editOperation.Transform(...)
ã®ãªãŒããŒããŒãã«çœ®ãæããããŸãã topic 9562ã[TransformMethod](https://pro.arcgis.com/en/pro-app/latest ã䜿çš) /sdk/api-reference/topic76186.html)ã3.0 以éã§ã¯ãTransformByLinkLayer ãŸã㯠TransformByLinkLines - å€æãã©ã¡ãŒã¿ãŒãå®çŸ©ããŸããtransformMethod.TransformType ã䜿çšããŠãå®è¡ããå€æã®ã¿ã€ããå®çŸ©ããŸã (TransformMethodType.Affine
ãŸã㯠TransformMethodType.Similarity
)ã
var editOp = new EditOperation();
editOp.Name = "Transform Features";
//At 2.x
var transformSelection = MapView.Active.GetFeatures(polygon).Select(
k => new KeyValuePair<MapMember, List<long>>(k.Key as MapMember, k.Value));
editOp.Transform(transformSelection, linkLayer);
//Transform just a layer
editOp.Transform(featureLayer, linkLayer);
//Perform an affine transformation
editOp.TransformAffine(featureLayer, linkLayer);
//At 3.x
//Define the transform method
var affine_transform = new TransformByLinkLayer() {
LinkLayer = linkLayer,
TransformType = TransformMethodType.Affine //or TransformMethodType.Similarity
};
//Transform a selected set of features
editOp.Transform(MapView.Active.GetFeatures(polygon), affine_transform);
//Perform an affine transformation
editOp.Transform(featureLayer, affine_transform);
//Execute to execute the operation
//Must be called within QueuedTask.Run
editOp.Execute();
//or use async flavor
//await editOp.ExecuteAsync();
2.x ã§ã¯ãäœå³ããŒã«ã¯ EmbeddableControl ã䜿çšããŠãæ§æå¯èœãªã«ã¹ã¿ã UI ããã£ãŒãã£äœæãã€ã³ãšãã³ãã¬ãŒã UI å
ã«ãã¹ãã§ããŸãããåã蟌ã¿å¯èœã³ã³ãããŒã«ã¯ãIEditingCreateToolControl
ããã³ IEditingCreateToolMultiple
ãå®è£
ããŠããã£ãŒãã£äœæãã€ã³ããã³/ãŸãã¯ãã³ãã¬ãŒãã®ãããã㣠ãã€ã¢ãã° UI ã«åã蟌ã¿å¯èœã³ã³ãããŒã« UI ããã¹ãããŸãã
3.0 ã§ã¯ãIEditingCreateToolControl
ãš IEditingCreateToolMultiple
ãåé€ãããŸããã代ããã«ã (Embeddable ã³ã³ãããŒã«å
ã«å®è£
ããã) æ§æå¯èœãª UI ãæã€äœå³ããŒã«ã¯ããã®åã蟌ã¿å¯èœãªã³ã³ãããŒã«ã«å¯Ÿã㊠ToolOptionsEmbeddableControl ã掟çãããé¢é£ãããªãŒããŒã©ã€ããå®è£
ããå¿
èŠããããŸãã
\\At 2.x - embeddable controls associated with construction tools
\\implement IEditingCreateToolControl and IEditingCreateToolMultiple to
\\display configurable UIs
internal class CustomToolToolOptionsViewModel : EmbeddableControl,
IEditingCreateToolControl {//most common
...
internal class CustomToolToolOptionsViewModel : EmbeddableControl,
IEditingCreateToolControl, IEditingCreateToolMultiple {//less common - tool supports multiple templates
...
\\At 3.x, derive from ToolOptionsEmbeddableControl, no interfaces needed
internal class CustomToolToolOptionsViewModel : ToolOptionsEmbeddableControl {
//Occurs when a tool options control is initialized
public override void OnInitialize(ToolOptions options, bool hostIsActiveTmplatePane) {
//TODO
base.OnInitialize(options, hostIsActiveTmplatePane);
}
//Occurs when a tool options control is initialized
public override void OnInitialize(IEnumerable<ToolOptions> optionsCollection,
bool hostIsActiveTmplatePane) {
//TODO - handle when the tool options control is initialized
}
//Gets and sets the valid state of the tool options - default is true
public virtual bool IsValid { get; set; } = true;
//Gets and sets the dirty state of the tool options - default is false
public virtual bool IsDirty { get; set; }
//Gets and sets whether the tool options should auto open in the Active Template
//pane when the associated tool is activated - default is false
public virtual bool IsAutoOpen(string toolID) => false;
//Gets the icon to display when the tool options are displayed in the Active Template pane.
public override ImageSource SelectorIcon => ... ;
//Gets a working copy of the ToolOptions
protected internal ToolOptions ToolOptions { get; }
// Called at the end of <see cref="OpenAsync"/>, implementations should obtain and interpret the
//options stored in the current <see cref="ToolOptions"/> using
//protected T GetToolOption<T>(string key, T defaultValue, T differentValue = default(T))
protected override Task LoadFromToolOptions() {
//eg, this tool checks if it has a stored default value for a "Buffer" option
double? buffer = GetToolOption<double?>("Buffer", 25.0, null);
if (buffer.HasValue) {//there is a default
...
}
return Task.CompletedTask;
}
2.x ã§ã® IEditingCreateToolControl
ã¡ãœããã®å®è£
:
public virtual bool InitializeForActiveTemplate(ToolOptions options)
public virtual bool AutoOpenActiveTemplatePane(string toolID)
åã蟌ã¿å¯èœãªã³ã³ãããŒã«ã§ãããã® ToolOptionsEmbeddableControl
ãªãŒããŒã©ã€ãã䜿çšããŸãã
public override void OnInitialize(IEnumerable<ToolOptions> optionsCollection, bool hostIsActiveTemplatePane)
public override bool IsAutoOpen(string toolID)
Config.daml ã§ã¯ãåã蟌ã¿å¯èœãªã³ã³ãããŒã«ã¯ esri_editing_tool_options
ã«ããŽãªã«ç»é²ãããdaml-id 㯠2.x ã§è¡ãããã®ãšåãäœå³ããŒã«ã® content ã¿ã°ã® toolOptionsID
å±æ§ã«å²ãåœãŠãããŸãã
3.0 ã§ã¯ãArcGIS.Desktop.Extensions.Controls.BurgerButton
ã³ã³ãããŒã«ãåé€ãããŸããã ãããã³ã° ãŠã£ã³ã㊠(ãã³ããŒã¬ãŒ ãã¿ã³ä»ã) ã³ã³ãããŒã«ããŸã åç
§ããŠãã 2.x ã¢ãã€ã³ã¯ãArcGIS.Desktop.Framework.Controls.BurgerButton
ã«åãæ¿ããå¿
èŠããããŸãããFrameworkãã®ãããã³ã° ãŠã£ã³ã㊠(ãã³ããŒã¬ãŒ ãã¿ã³ä»ã) ã³ã³ãããŒã«ã¯ã2.2ã2.3 ã¿ã€ã ãã¬ãŒã ã§å
ã®ãExtensionsãã³ã³ãããŒã«ã眮ãæããŸããã
ãããã³ã° ãŠã£ã³ã㊠(ãã³ããŒã¬ãŒ ãã¿ã³ä»ã) ã³ã³ãããŒã«ã¯ããããã¢ãã ã¡ãã¥ãŒã®ãããã³ã° ãŠã£ã³ããŠå ã§äœ¿çšãããŸããã»ãšãã©ã®å Žåããããã³ã° ãŠã£ã³ã㊠ãŠãŒã¶ãŒ ã³ã³ãããŒã« xaml ã§åç §ãããŸãã次ã«äŸã瀺ããŸãã
<!-- change this at 2.x -->
<UserControl x:Class="DockPaneBookmarkAdvanced.BookmarkView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
...
xmlns:extensionsControls="clr-namespace:ArcGIS.Desktop.Extensions.Controls;assembly=ArcGIS.Desktop.Extensions"
... >
<!-- to this at 3.x -->
<UserControl x:Class="DockPaneBookmarkAdvanced.BookmarkView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
...
xmlns:extensionsControls="clr-namespace:ArcGIS.Desktop.Framework.Controls;assembly=ArcGIS.Desktop.Framework"
... >
3.0 ã® API ã®å€æŽç¹ã®å®å šãªãªã¹ãã«ã€ããŠã¯ãAPI ãªãã¡ã¬ã³ã¹ã® What's New ãåç §ããŠãã ããã
3.0 ã§ã¯ã2.9 ã§å»æ¢ããã ArcGIS.Desktop.Framework.Controls.ChromiumWebBrowser
ã³ã³ãããŒã«ãåé€ãããŸãããã¢ãã€ã³ã¯ä»£ããã« ArcGIS.Desktop.Framework.Controls.WebViewBrowser
ã³ã³ãããŒã« ã䜿çšããå¿
èŠããããŸãã
3.x ã§ã¯ãã¢ããªã±ãŒã·ã§ã³ã®ã¿ã€ãã«ãšååã®åäœãå€æŽãããŸããã3.x ã§ã¯ãFrameworkApplication.Title
ãæå®ãããŠããå Žåãã¢ããªã±ãŒã·ã§ã³ã®ã¿ã€ãã« ããŒã¯ããã©ã«ãã§ã¿ã€ãã«ã®ã¿ã衚瀺ããååãšãµãã¿ã€ãã«ã¯è¡šç€ºãããŸããã
//At 2.x, this code would show Name-Title-Subtitle
//At 3.x, only title will show.
var date_time = System.DateTime.Now.ToString("g");
FrameworkApplication.Name = date_time;
FrameworkApplication.SubTitle = "MyMap";
FrameworkApplication.Title = Project.Current.Name;
//At 3.x, title is set to "", title defaults to FrameworkApplication.Name
var date_time = System.DateTime.Now.ToString("g");
FrameworkApplication.Name = date_time;
FrameworkApplication.SubTitle = "MyMap";
FrameworkApplication.Title = "";//no title
//At 3.x Subtitle is ignored in the bar
var date_time = System.DateTime.Now.ToString("g");
FrameworkApplication.Name = "";//no name
FrameworkApplication.SubTitle = "MyMap";
FrameworkApplication.Title = "";//no title
3.x ã§ã¯ãConfigurations ãš ConfigurationManager
ã®æ°ããã¿ã€ãã«ã®åäœã«ãããConfigurationManager.ApplicationName ãã¿ã€ãã« ããŒã«è¡šç€ºãããŸãã2.x ã§ã¯ãConfigurationManager.ApplicationName
ã䜿çšããŠã¿ã€ãã« ããŒã®ããã¹ãããªãŒããŒã©ã€ãã§ããŸããããã ãã3.x ã§ã¯ãã¿ã€ãã« ããŒã«ã¯ã¢ããªã±ãŒã·ã§ã³ title (ã¿ã€ãã«ãå®çŸ©ãããŠããå Žå) ãã衚瀺ãããªããããæ§æã® ApplicationName 㯠ignored ã«ãªããŸãã3.x 㧠ApplicationName ã衚瀺ããã«ã¯ãæ§æã§æ°ãã TitleBarText ã®ãªãŒããŒã©ã€ããå®è£
ããå¿
èŠããããŸãã
configManager.TitleBarText
ããããã£ã®äžéšãšã㊠configManager.ApplicationName
ãå«ããŸããããã«ã€ããŠã¯ãProConcepts ConfigurationsãTitleBarText ã»ã¯ã·ã§ã³ã§è©³ãã説æããŠããŸãã
3.0 ã§ã¯ã(files ãåç
§ããã®ã§ã¯ãªã) ãã©ã«ããŒãåç
§ããããã® ArcGIS.Desktop.Framework.Dialogs.BrowseForFolder
ãåé€ãããŸãããã¢ãã€ã³ã¯ã代ããã« Windows API ãš System.Windows.Forms.FolderBrowserDialog
ã䜿çšããå¿
èŠããããŸãã以äžã«äŸã瀺ããŸãã
using System.Windows.Interop;// for WindowInteropHelper
//Get a handle to the Pro app window
var parentWindow = new WindowInteropHelper(
FrameworkApplication.Current.MainWindow).Handle;
//At 2.x
//using ArcGIS.Desktop.Framework.Dialogs;
//
//var browseDialog = new BrowseForFolder();
//var selectedFolder = browseDialog.SelectFolder(
// "Please select an output folder", @"C:\\The\\Initial\\Path", IntPtr.Zero);
//....or, use the Pro application window handle
//var selectedFolder = browseDialog.SelectFolder(
// "Please select an output folder", @"C:\\The\\Initial\\Path", parentWindow);
//At 3.x
using System.Windows.Forms;
...
var parentWindow = new WindowInteropHelper(
FrameworkApplication.Current.MainWindow).Handle;
var browseDialog = new FolderBrowserDialog() {
InitialDirectory = @"C:\\The\\Initial\\Path",
Description = "Please select an output folder",
UseDescriptionForTitle = true
};
var selectedFolder = "";
if (folderBrowserDialog1.ShowDialog(
new WindowWrapper(parentWindow)) == DialogResult.OK) {
selectedFolder = folderBrowserDialog1.SelectedPath;
}
//TODO - use selected folder path
...
// http://stackoverflow.com/questions/315164/how-to-use-a-folderbrowserdialog-from-a-wpf-application
public class WindowWrapper : System.Windows.Forms.IWin32Window {
IntPtr _handle = IntPtr.Zero;
public WindowWrapper(IntPtr handle) {
_handle = handle;
}
IntPtr System.Windows.Forms.IWin32Window.Handle => _handle;
}
3.0 ã® API ã®å€æŽç¹ã®å®å šãªãªã¹ãã«ã€ããŠã¯ãAPI ãªãã¡ã¬ã³ã¹ã® What's New ãåç §ããŠãã ããã
3.0 ã§ã¯ã2.1 ã§å»æ¢ããã ArcGIS.Desktop.Geoprocessing.HistoryProjectItem
ãåé€ãããŸããã
3.0 ã® API ã®å€æŽç¹ã®å®å šãªãªã¹ãã«ã€ããŠã¯ãAPI ãªãã¡ã¬ã³ã¹ã® What's New ãåç §ããŠãã ããã
3.0 ã® API ã®å€æŽç¹ã®å®å šãªãªã¹ãã«ã€ããŠã¯ãAPI ãªãã¡ã¬ã³ã¹ã® What's New ãåç §ããŠãã ããã
3.0 ã§ã¯ãLayoutElementFactory
ã®ååã ElementFactory
ã«å€æŽãããŸãã, topic 76396ã
ãŸãã2.x ã§ã¯ãLayoutElementFactory ã¯ãGraphicElement
äœæ (ã€ãŸãããã€ã³ããã©ã€ã³ãããªãŽã³ãããã³ããã¹ã ã°ã©ãã£ã㯠ãšã¬ã¡ã³ã) çšã®éåžžã«ç²ç²åºŠã®ãã¯ããå€æ°æäŸããŸããããããã®ãã¯ãã¯ã2ã€ã®æ±çšãã¯ãã«çµ±åãããŸããããã€ã³ããã©ã€ã³ãããªãŽã³ã¯ CreateGraphicElement ãããã¹ã㯠CreateTextGraphicElement ã§äœæãããŸããCreateGraphicElement
ãš CreateTextGraphicElement
ã¯ã3.x ã§æ°ãããã©ã¡ãŒã¿ ã¯ã©ã¹ã§ãã ElementInfo ãåãåãããšã¬ã¡ã³ãã®äœææã«ãããã€ãã®åæããããã£ãåãã£ãŠæå®ããããšãã§ããããã«ãªããŸããã
2.x ã§ã¯ãLayoutsãGroupElementsãGraphicsLayer ãç°ãªãã³ã³ãããŒãšããŠäœ¿çšããã«ã¯ãåå¥ã® LayoutElementFactory ãã¯ãã®ãªãŒããŒããŒããå¿
èŠã§ãããLayout ããã³ GroupElement ãã¯ãã«ã¯ãILayoutElementContainer
åã®ç¬¬äžåŒæ°ãæã¡ãGraphicsLayer ã«ã¯ãGraphicElementContainer
åã®ç¬¬äžåŒæ°ãæã£ãŠããŸããã3.0 ã§ã¯ãILayoutElementContainer
ãš GraphicElementContainer
㯠IElementContainer
åã®åäžã®ã³ã³ããã«çœ®ãæããããŸãã, topic 76912 ãããã£ãŠãElementFactory
ã䜿ããšãã« 3.0 ã§ç°ãªãã³ã³ãããåºå¥ããå¿
èŠããªããªããŸããã
Examples follow:
//At 2.x
QueuedTask.Run(()=> {
//Create point, line, polygon graphic elements - we typically match specific geometries
//with specific macros. Overloads for layout, group element, graphics layer as the container
LayoutElementFactory.Instance.CreateGraphicElement(layout, ...);
LayoutElementFactory.Instance.CreateGraphicElement(layout, graphic);
LayoutElementFactory.Instance.CreatePointGraphicElement(layout, ...);
LayoutElementFactory.Instance.CreateLineGraphicElement(layout, ...);
LayoutElementFactory.Instance.CreatePolygonGraphicElement(layout, ...);
LayoutElementFactory.Instance.CreateBezierCurveGraphicElement(layout, ...);
LayoutElementFactory.Instance.CreateCircleGraphicElement(layout, ...);
LayoutElementFactory.Instance.CreateEllipseGraphicElement(layout, ...);
LayoutElementFactory.Instance.CreateFreehandGraphicElement(layout, ...);
LayoutElementFactory.Instance.CreateLassoGraphicElement(layout, ...);
LayoutElementFactory.Instance.CreateRectangleGraphicElement(layout, ...);
//At 3.x use CreateGraphicElement with (optional) ElementInfo. No need for separate
//overloads for layout, group element, graphics layer as the container at 3.x
var container = ....;//Layout, GroupElement, or GraphicsLayer
ElementFactory.Instance.CreateGraphicElement(container, bezPl, lineSym, "New Bezier Curve");
ElementFactory.Instance.CreateGraphicElement(container, linePl, lineSym, "New Freehand");
ElementFactory.Instance.CreateGraphicElement(container, env, polySym, "New Polygon");
//and with ElemInfo...
var elemInfo = new ElementInfo() {
Anchor = Anchor.CenterPoint,
Rotation = 45
};
ElementFactory.Instance.CreateGraphicElement(container, env, polySym, "New Polygon", true, elemInfo);
//Or, instead of a geometry + symbol, use a CIMGraphic
var graphic = new CIMPointGraphic() { ..... };
ElementFactory.Instance.CreateGraphicElement(container, graphic);
//At 2.x - create text graphic elements
LayoutElementFactory.Instance.CreateCurvedTextGraphicElement(container, ...);
LayoutElementFactory.Instance.CreatePointTextGraphicElement(container, ...);
LayoutElementFactory.Instance.CreateCircleParagraphGraphicElement(container, ...);
LayoutElementFactory.Instance.CreatePolygonParagraphGraphicElement(container, ...);
LayoutElementFactory.Instance.CreateEllipseParagraphGraphicElement(container, ...);
LayoutElementFactory.Instance.CreateRectangleParagraphGraphicElement(container, ...);
//At 3.x - use CreateTextGraphicElement and TextType enum to specify the type of
//text to create
ElementFactory.Instance.CreateTextGraphicElement(
container, TextType.SplinedText, bezPl, sym, "Curved Text", "New Splined Text");
ElementFactory.Instance.CreateTextGraphicElement(
container, TextType.RectangleParagraph, poly, sym, text, "New Polygon Text");
ElementFactory.Instance.CreateTextGraphicElement(
container, TextType.CircleParagraph, polyCir, sym, text, "New Circle Text");
//and with ElementInfo
var elemInfo = new ElementInfo() {
Anchor = Anchor.CenterPoint,
Rotation = 45
};
ElementFactory.Instance.CreateTextGraphicElement(
container, TextType.PointText, coord2D.ToMapPoint(), sym, textString, "New Point Text", true, elemInfo);
//At 2.x - create map frame and associated surrounds
LayoutElementFactory.Instance.CreateMapFrame(layout, env, mfMap);
LayoutElementFactory.Instance.CreateLegend(layout, env, mapFrame);
LayoutElementFactory.Instance.CreateScaleBar(layout, center, mapFrame, sbStyleItm);
LayoutElementFactory.Instance.CreateNorthArrow(layout, center, mapFrame, naStyleItm);
LayoutElementFactory.Instance.CreateTableFrame(layout, env, mapFrame, featLayer, layerFields);
LayoutElementFactory.Instance.CreateChartFrame(layout, ...);
//At 3.x, use CreateMapFrameElement and CreateMapSurroundElement along with the
//relevant ArcGIS.Desktop.Layouts.MapSurroundInfo
var mfElm = ElementFactory.Instance.CreateMapFrameElement(layout, env, map, "New Map Frame");
var legInfo = new LegendInfo() { MapFrameName = mfElm.Name};
var sbInfo = new ScaleBarInfo() { MapFrameName = mfElm.Name, ScaleBarStyleItem = sbStyleItm};
var naInfo = new NorthArrowInfo() { MapFrameName = mfElm.Name, NorthArrowStyleItem = naStyleItm};
var tfInfo = new TableFrameInfo() { MapFrameName = mfElm.Name,
MapMemberUri = featLayer.URI, FieldNames = layerFields};
var cfInfo = new ChartFrameInfo() { MapFrameName = mfElm.Name, MapMemberUri = featLayer.URI};
var legendElm = ElementFactory.Instance.CreateMapSurroundElement(
layout, env, legInfo, "New Legend") as Legend;
var sbElm = ElementFactory.Instance.CreateMapSurroundElement(
layout, center.ToMapPoint(), sbInfo, "New Scale Bar") as ScaleBar;
var arrowElm = ElementFactory.Instance.CreateMapSurroundElement(
layout, center.ToMapPoint(), naInfo, "New North Arrow") as NorthArrow;
var tabFrame = ElementFactory.Instance.CreateMapSurroundElement(
layout, env, tfInfo) as TableFrame;
var chartFrame = ElementFactory.Instance.CreateMapSurroundElement(
layout, env, cfInfo) as ChartFrame;
//At 2.x - CreateGroupElement has an overload that takes a single element (to be "grouped)
LayoutElementFactory.Instance.CreateGroupElement(container, titleElm);
//At 3.x, a list of elements to be grouped must be provided
ElementFactory.Instance.CreateGroupElement(container, new List<Element>() { titleElm });
3.x ã§ã¯ãã¬ã€ã¢ãŠããšãšã¬ã¡ã³ãã®ã€ãã³ããçµ±åãããã¢ãã€ã³éçºè
ã (ã¬ã€ã¢ãŠããšãšã¬ã¡ã³ãã®ç¶æ
ããã³ã³ã³ããã¹ãã®å€æŽããªãã¹ã³ããããã«) æ¶è²»ããªããã°ãªããªãã€ãã³ãã®æ°ãæžããŸããã3.x ã§ã¯ãã¢ãã€ã³éçºè
ã¯æ¬¡ã® 3 ã€ã®ã€ãã³ãã«ãµãã¹ã¯ã©ã€ãããã ãã§æžã¿ãŸããLayoutEvent
topic76584.html, LayoutViewEvent
topic18642.html ããã³ ElementEvent
topic76570.html.
LayoutAdded ãš LayoutRemoved ã®åçæ§ã«ã€ããŠã¯ãã¢ãã€ã³ã¯ 3.0 㧠ArcGIS.Desktop.Core.Events.ProjectItemsChangedEvent ã䜿çšããå¿ èŠããããŸãã
//Layout events
// At 2.x -- At 3.x
LayoutAddedEvent ProjectItemsChangedEvent, hint: NotifyCollectionChangedAction.Add
LayoutRemovedEvent ProjectItemsChangedEvent, hint: NotifyCollectionChangedAction.Remove
LayoutChangedEvent LayoutEvent, hint: LayoutEventArgs.LayoutEventHint
LayoutClosing LayoutViewEvent, hint: LayoutViewEventArgs.LayoutViewEventHint.Closing
LayoutClosed LayoutViewEvent, hint: LayoutViewEventArgs.LayoutViewEventHint.Closed
LayoutPauseDrawingChangedEvent LayoutViewEvent,
hint: LayoutViewEventArgs.LayoutViewEventHint.PauseDrawingChanged
LayoutViewEvent LayoutViewEvent, hint: LayoutViewEventArgs.LayoutViewEventHint
MapSeriesEvent LayoutEvent, hint: LayoutEventArgs.LayoutEventHint
PageChangedEvent LayoutEvent, hint: LayoutEventArgs.LayoutEventHint
ActiveLayoutViewChangedEvent LayoutViewEvent,
hint: LayoutViewEventArgs.LayoutViewEventHint.Activated, Deactivated
ActiveMapFrameEvent **ElementEvent** (not LayoutViewEvent)
hint: ElementEventArgs.ElementEventHint.MapFrameActivated, MapFrameDeactivated
//Element events
// At 2.x -- At 3.x
ElementAddedEvent ElementEvent, hint: ElementEventArgs.ElementEventHint.ElementAdded
ElementRemovedEvent ElementEvent, hint: ElementEventArgs.ElementEventHint.ElementRemoved
ElementsUpdatedEvent ElementEvent, hint: ElementEventArgs.ElementEventHint
ElementStyleChangedEvent ElementEvent, hint: ElementEventArgs.ElementEventHint.StyleChanged
ElementsPlacementChangedEvent ElementEvent, hint: ElementEventArgs.ElementEventHint.PlacementChanged
//At 2.x
LayoutSelectionChangedEvent (deprecated at 2.6)
ArcGIS.Desktop.Mapping.Events.ElementSelectionChangedEvent
// At 3.x use:
ElementEvent, hint: ElementEventArgs.ElementEventHint.SelectionChanged
3.x ã§ã¯ãReportElementFactory
ãã¯ã ãå€æŽãããIElementContainer
åã®ã³ã³ãããŒã䜿çšããããã«ãªããŸããã
3.0 ã® API ã®å€æŽç¹ã®å®å šãªãªã¹ãã«ã€ããŠã¯ãAPI ãªãã¡ã¬ã³ã¹ã® What's New ãåç §ããŠãã ããã
3.0 ã§ã¯ãLayerFactory
ã®ã¬ã€ã€ãŒäœæãã¯ãã LayerCreationParams ã¯ã©ã¹ãšé¢é£ãã掟çäœæã® "param" ã¯ã©ã¹ã«çµ±åãããŸããããparamãã¯ã©ã¹ã¯ãå
ã®åã
ã®ã¬ã€ã€ãŒäœæãã¯ã (ãããã眮ãæãã) ãããå¹
åºãäœæããããã£ãæäŸããŸããèšå®ããããparamãã¯ã©ã¹ã¯ãCreateLayer<t> ã«æž¡ãããŸãããªãŒããŒããŒã ã䜿çšããŠã¬ã€ã€ãŒãäœæããŸãããTããŸãã¯ãã³ãã¬ãŒãåãããã¿ã€ãã¯ãäœæããã¬ã€ã€ãŒ ã¿ã€ãã«çœ®ãæããå¿
èŠããããŸã (é©åãªã¬ã€ã€ãŒäœæãparamãã¯ã©ã¹ãšäžèŽããå¿
èŠããããŸã)ã 2.x ã® create "XXX" ã¬ã€ã€ãŒ ãã¯ãã®ãããããåŒã³åºãã¢ãã€ã³ã¯ã3.0 㧠LayerCreationParam ãã¿ãŒã³ã䜿çšããããã«åãæ¿ããå¿
èŠããããŸãã
3.xã§ã¯ãLayerCreationParamsã«MapMemberIndexãšMapMemberPositionããããã£ãå«ãŸããããã«ãªããŸããã以åã2.x ã§ã¯ããããã¯æ§ã
㪠LayerFactory
ã®ã¬ã€ã€ãŒäœæãã¯ãã®ãªãŒããŒããŒãã§åå¥ã®ãã©ã¡ãŒã¿ãšããŠèšå®ãããŠããŸããã
äŸã¯æ¬¡ã®ãšããã§ãã
//At 2.x CreateLayer<T>(...) does not include a LayerPosition position default parameter
//At 3.0, addins should use the LayerCreationParams MapMemberPosition instead.
//At 2.x - Addins using
LayerFactory.Instance.CreateLayer(item, ....);
LayerFactory.Instance.CreateLayer(cimDataConnection, ....);
//should use layer creation params.
//Note: set MapMemberIndex or MapMemberPosition on the LayerCreationParams
//if the addin was using the relevant parameter at 2.x
var layerParams = new LayerCreationParams(item | cimDataConnection) {
MapMemberIndex = -1
};
var layer = LayerFactory.Instance.CreateLayer<Layer>(layerParams, ...);
//Note, 3.x provides the following overload of CreateLayer for scenarios where
//addins want to create a layer via a path or Uri to the underlying data source
Layer CreateLayer(Uri dataUri, ILayerContainerEdit container, int index = 0, string layerName = "");
//At 2.x - Addins using
LayerFactory.Instance.CreateFeatureLayer(featClass, ....);
LayerFactory.Instance.CreateFeatureLayer(item, ....);
LayerFactory.Instance.CreateFeatureLayer(uri, ....);
LayerFactory.Instance.CreateFeatureLayer(cimDataConnection, ....);
//At 3.x
//use feature layer creation params
//Note: set MapMemberIndex, MapMemberPosition, and RendererDefinition on the
//FeatureLayerCreationParams if the addin was using the relevant Create method parameter at 2.x
var layerParams = new FeatureLayerCreationParams(featClass |item | uri | cimDataConnection) {
MapMemberPosition = MapMemberPosition.AddToBottom
};
var layer = LayerFactory.Instance.CreateLayer<FeatureLayer>(layerParams, ...);
//At 2.x - Addins using
LayerFactory.Instance.CreateRasterLayer(item, ....);
LayerFactory.Instance.CreateRasterLayer(uri, ....);
LayerFactory.Instance.CreateRasterLayer(cimDataConnection, ....);
//At 3.x, should use raster layer creation params.
//Note: set MapMemberIndex, MapMemberPosition, and ColorizerDefinition on the
//RasterLayerCreationParams if the addin was using the relevant Create method parameter at 2.x
var layerParams = new RasterLayerCreationParams(raster |item | uri | cimDataConnection) {
MapMemberPosition = MapMemberPosition.AddToBottom
};
var layer = LayerFactory.Instance.CreateLayer<BasicRasterLayer>(layerParams, ...);
//At 2.x - Addins using
LayerFactory.Instance.CreateMosaicLayer(item, ....);
LayerFactory.Instance.CreateMosaicLayer(uri, ....);
LayerFactory.Instance.CreateMosaicLayer(cimDataConnection, ....);
//At 3.x, should use mosaic layer creation params.
//Note: set MapMemberIndex, MapMemberPosition, and ColorizerDefinition on the
//MosaicLayerCreationParams if the addin was using the relevant Create method
//parameter at 2.x
var layerParams = new MosaicLayerCreationParams(item | uri | cimDataConnection) {
MapMemberPosition = MapMemberPosition.AddToBottom
};
var layer = LayerFactory.Instance.CreateLayer<MosaicLayer>(layerParams, ...);
//At 3.x CreateGroupLayer is unchanged
LayerFactory.Instance.CreateGroupLayer(map, 0, "Group 1");//same as was at 2.x
3.x ã§ã¯ãStandaloneTableFactory ã¡ãœããã®ãªãŒããŒããŒã㯠StandaloneTableCreationParams ãæ¶è²»ãã CreateStandaloneTable ã¡ãœããã«çµ±åãããŠããŸããURI ãåãåã CreateStandaloneTable ã®äŸ¿å©ãªãªãŒããŒããŒãã¯ããŸã 3.x ã®ãŸãŸã§ãã
äŸã¯æ¬¡ã®ãšããã§ãã
//At 2.x
//use a local path uri
var table = StandaloneTableFactory.Instance.CreateStandaloneTable(
new Uri(@"C:\Temp\Data\SDK.gdb\EarthquakeDamage", UriKind.Absolute), map);
//GDB table
var table2 = StandaloneTableFactory.Instance.CreateStandaloneTable(gdb_table, map);
//Item
var item = ItemFactory.Instance.Create(@"C:\Temp\Data\SDK.gdb\ParcelOwners");
var table3 = StandaloneTableFactory.Instance.CreateStandaloneTable(item, map);
//StandaloneTableCreationParams, eg with Item
var tableParams = new StandaloneTableCreationParams(item);
var table4 = StandaloneTableFactory.Instance.CreateStandaloneTable(tableParams, map);
//At 3.x
//use a local path uri
var table = StandaloneTableFactory.Instance.CreateStandaloneTable(
new Uri(@"C:\Temp\Data\SDK.gdb\EarthquakeDamage", UriKind.Absolute), map);
//At 3.x
//Use StandaloneTableCreationParams - Uri, Item, Table, CIMDataConnection, CIMLayerDocument
var tableCreationParams = new StandaloneTableCreationParams(uri);
var tableCreationParams2 = new StandaloneTableCreationParams(gdb_table);
var tableCreationParams3 = new StandaloneTableCreationParams(dc);
var tableCreationParams4 = new StandaloneTableCreationParams(layerDoc);
var table = StandaloneTableFactory.Instance.CreateStandaloneTable(tableCreationParams, map);
3.x ã§ã¯ãBasicFeatureLayer ã®ã¯ãšãªå®çŸ©ãå€æŽãããŸããã2.x ãšåæ§ã«ãã¯ãšãªå®çŸ©ã®æ©èœã¯ ITableDefinitionQueries ã€ã³ã¿ãŒãã§ã€ã¹ãä»ããŠæäŸãããŸããã¯ãšãªå®çŸ©ã¯ãCIMDefinitionFilter
ã¯ã©ã¹, topic 21490 ã䜿çšããŠããã®ã€ã³ã¿ãŒãã§ã€ã¹ãä»ããŠç·šéããã³å®çŸ©ãããŸããããŸãã3.0 ã§ã¯ã2.5 ã§å»æ¢ããã public CIMDefinitionFilter[] BasicFeatureLayer.DefinitionFilterChoices
ããããã£ãåé€ãããŸããã
3.x ã§ã¯ããŸã CIMDefinitionFilter ã¯å ¬éãããŠããŸãããCIMDefinitionFilter ãšéåžžã«äŒŒãæ°ããã¢ãã« ã¯ã©ã¹DefinitionQueryãããã£ã«ã¿ãŒå®çŸ©ã«äœ¿çšããŸãã
//At 2.x, using CIMDefinitionFilter
var defFilter = new CIMDefinitionFilter() {
Name = "California",
DefinitionExpression = "STATE_NAME = 'California'"
};
//At 3.x, using DefinitionQuery
var defQuery = new DefinitionQuery() {
Name = "California",
WhereClause = "STATE_NAME = 'California'"
};
æ¯èŒã®ããã«ãITableDefinitionQueries
ã® 2x ãš 3.x ã®å®£èšã次ã«ç€ºããŸãã3.x ãã¬ãŒããŒãã2x ãã¬ãŒããŒã®ããã« CIMDefinitionFilter
ã§ã¯ãªããDefinitionQuery
ã«åºã¥ããŠããããšã«æ³šæããŠãã ãã:DefinitionQuery
//At 2.x ITableDefinitionQueries uses CIMDefinitionFilter
public class BasicFeatureLayer : Layer, ..., ITableDefinitionQueries {
//Deprecated at 2.5. Use GetDefinitionFilters()
public CIMDefinitionFilter[] DefinitionFilterChoices { get; }
}
//Defines required properties and methods for interacting with definition filters
public inteface ITableDefinitionQueries {
CIMDefinitionFilter DefinitionFilter { get; }
void SetDefinitionFilter(CIMDefinitionFilter activeFilter);
IReadOnlyList<CIMDefinitionFilter> GetDefinitionFilters();//replaced DefinitionFilterChoices
void SetDefinitionFilters(IEnumerable<CIMDefinitionFilter> filters, string activeFilterName = null);
void RemoveDefinitionFilter(string filterName);
void RemoveAllDefinitionFilters();
}
//At 3.x ITableDefinitionQueries uses DefinitionQuery
public class BasicFeatureLayer : Layer, ..., ITableDefinitionQueries {
//DefinitionFilterChoices, deprecated at 2.5, is removed...
}
//Defines required properties and methods for interacting with definition filters
public inteface ITableDefinitionQueries {
string DefinitionQuery { get; }
IReadOnlyList<DefinitionQuery> DefinitionQueries { get; }
DefinitionQuery SetDefinitionQuery(string whereClause);
DefinitionQuery ActiveDefinitionQuery { get; } //The def query currently active
void InsertDefinitionQuery(DefinitionQuery definitionQuery, bool makeActive = false);
void InsertDefinitionQueries(IEnumerable<DefinitionQuery> queries);
void RemoveActiveDefinitionQuery();
void RemoveDefinitionQuery(int index);
void RemoveDefinitionQueries(IEnumerable<string> queryNames);
void RemoveAllDefinitionQueries();
}
䜿çšäŸã¯æ¬¡ã®ãšããã§ãã
var us_states = MapView.Active.Map.GetLayersAsFlattenedList()
.OfType<FeatureLayer>().First(lyr => lyr.Name == "US States");
QueuedTask.Run(() => {
us_states.SetDefinitionQuery("STATE_NAME = 'Iowa'");
//equivalent to...
var def_query = new DefinitionQuery() {
Name = "A Name that is Unique",
WhereClause = "STATE_NAME = 'Iowa'"
};
us_states.InsertDefinitionQuery(def_query, true);
var active_def_query = us_states.ActiveDefinitionQuery;
string where_clause = us_states.DefinitionQuery;//just the where clause string
//remove the active query
us_states.RemoveActiveDefinitionQuery();
//remove using name
us_states.RemoveDefinitionQueries(new List<string> { def_query.Name });
//use LINQ to get just a specific query
var def_query = us_states.DefinitionQueries.FirstOrDefault(
dq => dq.Name == "Query def name");
...
ãªãã3.0 ã§ã¯ãã¬ã€ã€ãŒã®ãã£ã«ã¿ãŒå®çŸ©ã CIMDefinitionFilter
ãã DefinitionQuery
ã«å€æŽããããšã«äŒŽããFeatureLayerCreationParams DefinitionFilter ããããã£ã¯ DefinitionQuery ã«å€æŽãããŠããŸãã
//At 2.x, DefinitionFilter was used with FeatureLayerCreationParams to define
//a definition filter upfront
public class FeatureLayerCreationParams : LayerCreationParams {
...
public CIMDefinitionFilter DefinitionFilter { get; set; }
//At 3.x, use DefinitionQuery with FeatureLayerCreationParams instead
public class FeatureLayerCreationParams : LayerCreationParams {
...
public DefinitionQuery DefinitionQuery { get; set; }
//define a definition query on the feat layer params
var featlayerParams = new FeatureLayerCreationParams() {
DefinitionQuery = new DefinitionQuery("Name = 'Ponderosa Pine'", "My query1"),
...
3.x ã§ã¯ãVoxelLayer ãå€æŽãããŸããã3.x ã§ã¯ããã¯ã»ã« ã¬ã€ã€ãŒã® API ã¯ãVoxelLayer.GetVolumes ã¡ãœããããã³ voxelLayer.SelectedVariableProfile.Volume ããããã£ãä»ããŠãã¯ã»ã« ã¬ã€ã€ãŒã® multiple ããªã¥ãŒã ãšã®çžäºäœçšããµããŒãããŠããŸããã¹ã©ã€ã¹ãšã»ã¯ã·ã§ã³ã¯ã3.0 ã§é¢é£ä»ããããããªã¥ãŒã ã«ã¢ã¯ã»ã¹ã§ããããã«ãªããŸãã (2.x ã®å Žåã®ããã«ãã¯ã»ã« ã¬ã€ã€ãŒããã§ã¯ãããŸãã)ã次ã®äŸã¯ããã¯ã»ã« ã¬ã€ã€ãŒ API ã®å€æŽããŸãšãããã®ã§ãã
//At 2.x this was the common pattern - most everything off the layer
var voxelLayer = ...
var vol_size = voxelLayer.GetVolumeSize();
var section = voxelLayer.GetSections().First();
var slice = voxelLayer.GetSlices().First();
... etc...
//At 3.x, most everything is off the volume - so this is the most common pattern:
var voxelLayer = ...
var volume = voxelLayer.SelectedVariableProfile.Volume;
var vol_size = volume.GetVolumeSize();
var section = volume.GetSections().First();
var slice = volume.GetSlices().First();
... etc...
ãã®ä»ã®äŸ:
//At 2.x
var volume = voxelLayer.GetVolumeSize();
var x_max = volume.Item1;
var y_max = volume.Item2;
var z_max = volume.Item3;
//At 3.x, there can be more than one volume - use GetVolumes()
var x_max = voxelLayer.GetVolumes().Max(v => v.GetVolumeSize().X);
var y_max = voxelLayer.GetVolumes().Max(v => v.GetVolumeSize().Y);
var z_max = voxelLayer.GetVolumes().Max(v => v.GetVolumeSize().Z);
//At 2.x
//use voxelLayer to get slices, create slices
var slices = voxelLayer.GetSlices();
...
voxelLayer.UpdateSlice(slice);//Update slice via its layer
//Create a slice on the voxel layer
voxelLayer.CreateSlice(new SliceDefinition() {
Name = "Middle Slice",
VoxelPosition = new Coordinate3D(volume.Item1 / 2, volume.Item2 / 2, volume.Item3 / 2),
...
//Create a section on the voxel layer
voxelLayer.CreateSection(new SectionDefinition() {
Name = $"Diagonal {s + 1}",
VoxelPosition = new Coordinate3D(end_pt.X, end_pt.Y, volumeSize.Item3),
....
//Access sections from the voxel layer
foreach (var section in voxelLayer.GetSections()) {
//set each normal to 45.0 orientation and tilt
section.Normal = voxelLayer.GetNormal(45.0, 45.0);
//apply the change via the voxel layer
voxelLayer.UpdateSection(section);
//Get a list of sections from the voxel layer that are
//not currently visible
var sections = voxelLayer.GetSections().Where(s => !s.IsVisible);
//At 3.x,
//Use the SelectedVariableProfile to get the slices currently in the TOC
//via its associated volume
var volume = voxelLayer.SelectedVariableProfile.Volume;
var slices = volume.GetSlices();
...
volume.UpdateSlice(slice);//Update slice via its volume
//Create a slice on the voxel -volume-
var volume = voxelLayer.SelectedVariableProfile.Volume;
var vol_size = volume.GetVolumeSize();
volume.CreateSlice(new SliceDefinition() {
Name = "Middle Slice",
VoxelPosition = new Coordinate3D(vol_size.X / 2, vol_size.Y / 2, vol_size.Z/ 2),
...
//Create a section on the voxel -volume-
volume.CreateSection(new SectionDefinition() {
Name = $"Diagonal {s + 1}",
VoxelPosition = new Coordinate3D(end_pt.X, end_pt.Y, volumeSize.Z),
....
//Access sections from the voxel -volume-
foreach (var section in volume.GetSections()) {
//set each normal to 45.0 orientation and tilt
section.Normal = voxelLayer.GetNormal(45.0, 45.0);
//apply the change via the voxel layer
volume.UpdateSection(section);
//Get a list of sections from the voxel -volume- that are
//not currently visible
var sections = volume.GetSections().Where(s => !s.IsVisible);
3.x ã§ã¯ãvariable.GetVariableStatistics()
ã¡ãœãããåé€ãããŸããã代ããã« VoxelVariableProfile.Statistics ããããã£ã䜿çšããŠããã¯ã»ã«å€æ°ã®ãããã¡ã€ã«çµ±èšã«ã¢ã¯ã»ã¹ããŸãã
//At 2.x
var variable = voxel.SelectedVariableProfile;
var min = variable.GetVariableStatistics().MinimumValue;
var max = variable.GetVariableStatistics().MaximumValue;
//At 3.x
var variable = voxel.SelectedVariableProfile;
var min = variable.Statistics.MinimumValue;
var max = variable.Statistics.MaximumValue;
3.x ã§ã¯ãArcGIS.Desktop.Mapping.Events.MapMemberPropertiesChangedEvent
ãargs.EventHints ããããã£ããã³ã MapMemberEventHint.VoxelSelectedVariableProfileIndex
ã MapMemberEventHint.VoxelSelectedVariable
ã«å€æŽãããŸããã
//At 2.x
MapMemberPropertiesChangedEvent.Subscribe((args) => {
var voxel = args.MapMembers.OfType<VoxelLayer>().FirstOrDefault();
if (voxel == null)
return;
//Anything changed on a voxel layer?
if (args.EventHints.Any(hint => hint ==
MapMemberEventHint.VoxelSelectedVariableProfileIndex)) {
...
//At 3.x
MapMemberPropertiesChangedEvent.Subscribe((args) => {
var voxel = args.MapMembers.OfType<VoxelLayer>().FirstOrDefault();
if (voxel == null)
return;
//Anything changed on a voxel layer?
if (args.EventHints.Any(hint => hint ==
MapMemberEventHint.VoxelSelectedVariable)) {
...
3.x ã§ã¯ãElevationSurface
ãš ElevationSource
ãåé€ãããã·ãŒã³ãã CIMMapElevationSurface
ã€ã³ã¹ã¿ã³ã¹ãšããŠæšé«ãµãŒãã§ãŒã¹ãååŸããããšãã§ããªããªããŸããã3.x ã§ã¯ãæšé«ãµãŒãã§ã¹ãšãœãŒã¹ã¯ãããã ElevationSurfaceLayer ãš (ã©ã¹ã¿ãŒãTIN ãªã©ã®) æ±çšã¬ã€ã€ãŒã§è¡šçŸãããŸããElevationSurfaceLayer 㯠CompositeLayer ãã掟çãã1 ã€ä»¥äžã®åæšé«ãœãŒã¹ ã¬ã€ã€ãŒãå«ãããšãã§ããŸãã
3.x ã§ã¯ãMapElevationSurfaceDefinition
ã¯ã©ã¹ãåé€ãããŸããã[ElevationLayerCreationParams](https://pro. arcgis.com/en/pro-app/latest/sdk/api-reference/topic76633.html) ã¯ã©ã¹ã®ã€ã³ã¹ã¿ã³ã¹ã代ããã«äœ¿çšããŸãã
//At 2.x -
//If you used....
var cimSurfaces = map.GetElevationSurfaces() ; //IReadOnlyList<CIMMapElevationSurface>
var cimSurface = map.GetGroundElevationSurface() ; //CIMMapElevationSurface
map.SetElevationSurace(cimSurface);//or mapElevationSurfaceDefinition.ToCIM()
map.SetElevationSuraces(cimSurfacesList);
map.RemoveElevationSurface(cimSurface);
map.ClearElevationSurfaces();
//At 3.x use ElevationSurfaceLayer
var surfaceLayers = map.GetElevationSurfaceLayers();
var surfaceLayer = map.GetGroundElevationSurfaceLayer();
//At 3.x Create surfaces using LayerFactory and ElevationLayerCreationParams
//Surfaces will be created as ElevationMode.CustomSurface
LayerFactory.Instance.CreateLayer<ElevationSurfaceLayer>(
new ElevationLayerCreationParams(source_uri), scene);
//Or create a new scene from scratch with a ground elevation source
var scene = MapFactory.Instance.CreateScene(
"My scene", groundSourceUri, MapViewingMode.SceneGlobal);
//At 3.x, use map.RemoveLayer(s)(...) or ClearElevationSurfaceLayers
map.RemoveLayer(surfaceLayer);//Cannot remove ground
map.RemoveLayers(map.GetElevationSurfaceLayers()); //Ground will not be removed
map.ClearElevationSurfaceLayers();
3.0 ã§ã¯ãmap.GetZsFromSurfaceAsync ã®ãªãŒããŒããŒããå€æŽãããŸããã2.x ã§ã¯ãç¹å®ã®ãªãŒããŒããŒããæšé«ã¯ãšãªã«äœ¿çšããããµãŒãã§ã¹ (å°é¢ä»¥å€ã®å Žå) ã® surfaceName
ãæ¶è²»ããŠããŸããã3.0 ã§ã¯ãé¢é£ãããªãŒããŒããŒãã«å¯ŸããŠã代ããã«é¢é£ãããµãŒãã§ã¹ãèå¥ããç¹å®ã® elevationSurfaceLayer
ã€ã³ã¹ã¿ã³ã¹ã䜿çšããŸãã
//At 2.x - if using elevation surface -name-...
var surfaceZResult = await map.GetZsFromSurfaceAsync(
pt_location, "custom_elevation_surface");
//At 3.x - use elevation surface -layer-
var elevSurfaceLayer = map.GetElevationSurfaceLayers()
.First(sl => sl.Name == "custom_elevation_surface");
var surfaceZResult = await map.GetZsFromSurfaceAsync(pt_location, elevSurfaceLayer);
3.x ã§ã¯ãISceneLayerInfo
ã€ã³ã¿ãŒãã§ãŒã¹ãåé€ãããŸããããããŸã§ ISceneLayerInfo.SceneServiceLayerType
ããããã£ã䜿çšããŠããã¢ãã€ã³ã¯ãã¬ã€ã€ãŒã®ã¯ã©ã¹ ã¿ã€ã ããã³/ãŸã㯠(FeatureSceneLayer ã®å Žå FeatureSceneLayerType ã䜿çšããå¿
èŠããããŸã) ãŸãã3.x ã§ã¯ GetDataSourceType()
ãš GetDataConnection()
ã¯ã¬ã€ã€ãŒããçŽæ¥ã¢ã¯ã»ã¹ã§ããããã«ãªããŸããã
3.x ã§ã¯ãPointCloudSceneLayer QueryAvailableClassCodesAndLabels
, QueryAvailableClassFlagsAndLabels
, QueryAvailablePointCloudRendererFields
ã¡ãœããã¯ãããã GetAvailableClassCodesAndLabels
, GetAvailableClassFlagsAndLabels
, GetAvailablePointCloudRendererFields
ãžååãå€æŽã«ãªããŸããã
3.x ã§ã¯ãBuildingScenelayer QueryAvailableFieldsAndValues
㯠GetAvailableFieldsAndValues
ã«ååãå€æŽãããŸãããSetFilter
ã¡ãœãã㯠UpdateFilter
ã«ååãå€æŽãããŸããã
//At 2.x - using ISceneLayerInfo, eg on PointCloudSceneLayer
var slInfo = pointCloudLayer as ISceneLayerInfo;
if (slInfo.SceneServiceLayerType == SceneServiceLayerType.PointCloud) {
//TODO - access Point cloud scene layer...
var dataSourceType = slInfo.GetDataSourceType();
var dc = slInfo.GetDataConnection();
//At 2.x
var classCodesAndLabels = pcsl.QueryAvailableClassCodesAndLabels();
var classFlagsAndLabels = pcsl.QueryAvailableClassFlagsAndLabels();
var flds = pcsl.QueryAvailablePointCloudRendererFields(PointCloudRendererType.UniqueValueRenderer);
//At 2.x BuildingScenelayer
var classFieldsAndValues = bsl.QueryAvailableFieldsAndValues();
var filterBlock = new FilterBlockDefinition();
filterBlock.FilterBlockMode = Object3DRenderingMode.Wireframe;
var selValues = new Dictionary<string, List<string>>();
selValues ["Category"] = new List<string>() { ... };
filterBlock.SelectedValues = selValues;
...
var filter1 = bsl.GetFilter(filter_id);
filter1.Name = "Updated Filter";
filter1.FilterBlockDefinitions = new List<FilterBlockDefinition>() { filterBlock };
//At 2.x
bsl.SetFilter(filter1);
//At 3.x - ISceneLayerInfo is deleted. Use the layer class directly.
var slInfo = pointCloudLayer as ISceneLayerInfo;
if (sceneLayer is PointCloudSceneLayer pcsl) {
//TODO - access Point cloud scene layer...
var dataSourceType = pcsl.GetDataSourceType();//Off layer
var dc = pcsl.GetDataConnection();//Off layer
//At 3.x
var classCodesAndLabels = pcsl.GetAvailableClassCodesAndLabels();
var classFlagsAndLabels = pcsl.GetAvailableClassFlagsAndLabels();
var flds = pcsl.GetAvailablePointCloudRendererFields(PointCloudRendererType.UniqueValueRenderer);
//At 3.x BuildingScenelayer
var classFieldsAndValues = bsl.GetAvailableFieldsAndValues();
var filterBlock = new FilterBlockDefinition();
filterBlock.FilterBlockMode = Object3DRenderingMode.Wireframe;
var selValues = new Dictionary<string, List<string>>();
selValues ["Category"] = new List<string>() { ... };
filterBlock.SelectedValues = selValues;
...
var filter1 = bsl.GetFilter(filter_id);
filter1.Name = "Updated Filter";
filter1.FilterBlockDefinitions = new List<FilterBlockDefinition>() { filterBlock };
//At 3.x
bsl.UpdateFilter(filter1);
3.x ã§ã¯ãã«ã¹ã¿ã ã¢ã€ãã ã§äœ¿çšãã IMappableItem
ãš IMappableItemEx
ã€ã³ã¿ãŒãã§ãŒã¹ã¯ãåäžã® IMappableItem ã€ã³ã¿ãŒãã§ãŒã¹ã«çœ®ãæãããŸãããOnAddToMap ãªãŒããŒããŒãã®æ»ãå€ã®åã List<string>
ã«å€æŽãããããšã«æ³šæããŠãã ãããã«ã¹ã¿ã ã¢ã€ãã ã¯ã2.x ã® IMappableItem ãš IMappableItemEx ã®å®è£
ã 3.x ã® IMappableItem ã®å®çŸ©ã«å€æŽããå¿
èŠããããŸãã3.x ã§ã¯ãã¢ãã€ã³ã¯ OnAddToMap ãããOnAddToMap) 㧠(è¿œå ãããããã ã¡ã³ããŒã® URI ã®ãªã¹ããè¿ãå¿
èŠããããŸãã詳现ã«ã€ããŠã¯ ProConcepts, Custom-Items adding item content to the map ãåç
§ããŠãã ããã
//At 2.x
interface IMappableItem
public bool CanAddToMap(MapType? mapType)
public void OnAddToMap(Map map)
public void OnAddToMap(Map map, ILayerContainerEdit groupLayer, int index)
interface IMappableItemEx
public string[] OnAddToMapEx(Map map)
public string[] OnAddToMapEx(Map map, ILayerContainerEdit groupLayer, int index)
//At 3.x -single (consolidated) interface IMappableItem
interface IMappableItem
public bool CanAddToMap(MapType? mapType)//No change
public List<string> OnAddToMap(Map map)
public List<string> OnAddToMap(Map map, ILayerContainerEdit groupLayer, int index)
public bool CanAddToMap(MapType? mapType) {
... //No change
public List<string> OnAddToMap(Map map) {
return OnAddToMap(map, null, -1);
}
public List<string> OnAddToMap(Map map, ILayerContainerEdit groupLayer, int index) {
//Create map member content - eg layers
var layer = LayerFactory.Instance.CreateLayer(.....);
//return list of URIs of layers that were added (to the map or group layer)
return new List<string>() { layer.URI };
}
3.x ã§ã¯ãArray åã®ãã©ã¡ãŒã¿ãŒã䜿çšããããArray åãšããŠå®çŸ©ãããŠããããŸããŸãªã¯ã©ã¹ ã¡ãœãããšããããã£ããList ãŸã㯠IEnumerable ã䜿çšããããã«ãªããŸãããããã«ãArray åã returned ããç¹å®ã®ã¡ãœããã¯ãList åãŸã㯠IReadOnlyList åãè¿ãããã«ãªããŸããã圱é¿ãåããã³ãŒããå¿
èŠã«å¿ããŠå€æŽããŸããéåæã ã£ã (ã€ãŸããTask
ã®æ»ãå€ã®åãæã€) ç¹å®ã®ã¡ãœããã«ã¯ "Async" æ¥å°ŸèŸããããŸããã§ããããçŸåšã¯ "Async" æ¥å°ŸèŸãè¿œå ãããŠããŸã (äŸãã°ã以äžã® LineOfSight ã¯ã©ã¹ãåç
§ããŠãã ãã)ã
3.x ã§ã¯ãLineOfSight ã¯ã©ã¹ã®ãGetãã¡ãœããã«è¿œå ã®ãAsyncãæ¥å°ŸèŸãå«ãŸããããã«ãªããŸããããããã®ã¡ãœããã Task
ã®åãè¿ãããšãæ£ããåæ ããŠããŸããããã«ããSetãã¡ãœããã¯ã2.x ã§åãvoidããè¿ããŸãããçŸåšã3.x ã§ã¯ããããã¯ãã¹ãŠåŸ
æ©å¯èœã§ãTask
ã®åãè¿ãã"Async" æ¥å°ŸèŸãå«ãŸããŠããŸãã泚: GetObserver()
ãš SetObserver(camera)
ã¯å€æŽãããŠããŸããã
3.x ã§ã¯ãQueryDrawingOutline 㯠GetDrawingOutline ã«ãªããŸããã
//At 2.x, use array
var rendererDefn1 = new UniqueValueRendererDefinition(new string[] { "field1", "field2" });
//At 3.x, use list
var rendererDefn1 = new UniqueValueRendererDefinition(new List<string> { "field1", "field2" });
//At 2.x - various properties use Array
var colorizerDef = new ColormapColorizerDefinition() {
Colors = new List<CIMColor>() { ....... }.ToArray(),
...
//At 3.x - corresponding properties changed to use type List
var colorizerDef = new ColormapColorizerDefinition() {
Colors = new List<CIMColor>() { ....... },
...
//At 2.x, lineOfSight Get methods do not have 'Async' suffix
var color = await lineOfSight.GetVisibleColor();
var color2 = await lineOfSight.GetNotVisibleColor();
var color3 = await lineOfSight.GetOutOfRangeColor();
...
//At 3.x they do
var color = await lineOfSight.GetVisibleColorAsync();
var color2 = await lineOfSight.GetNotVisibleColorAsync();
var color3 = await lineOfSight.GetOutOfRangeColorAsync();
...
//At 2.x LineOfSight static "Set" methods are not awaitable
LineOfSight.SetVisibleColor(color);
LineOfSight.SetNotVisibleColor(color2);
LineOfSight.SetOutOfRangeColor(color3);
//At 3.x LineOfSight static "Set" methods are awaitable and have
//an Async suffix
await LineOfSight.SetVisibleColorAsync(color);//can await (optional)
await LineOfSight.SetNotVisibleColorAsync(color2);//can await (optional)
//not awaited...
LineOfSight.SetOutOfRangeColorAsync(color3);//can await (optional)
//At 2.x, use "Query...."
var mask_geom = featLayer.QueryDrawingOutline(oid, mv, DrawingOutlineType.Exact);
//At 2.x3.0, use "Get...."
var mask_geom = featLayer.GetDrawingOutline(oid, mv, DrawingOutlineType.Exact);
3.0 ã§ã¯ãfeatureLayer.SetDisplayCacheType(...)
ãåé€ãããŸããã ã¢ãã€ã³ã§ã¯ã代ããã«æ°ãã featureLayer.SetCacheOptions()
ã¡ãœãã ã䜿çšããå¿
èŠããããŸãã
// change the layer cache type to maximum age
QueuedTask.Run(() => {
//At 2.x
featureLayer.SetDisplayCacheType(ArcGIS.Core.CIM.DisplayCacheType.MaxAge);
featureLayer.SetDisplayCacheMaxAge(TimeSpan.FromMinutes(2));
//At 3.x
featureLayer.SetCacheOptions(LayerCacheType.MaxAge);
featureLayer.SetDisplayCacheMaxAge(TimeSpan.FromMinutes(2));
3.x ã§ã¯ãArcGIS.Desktop.Mapping.Snapping
ã¹ããã ã¢ãŒããå€æŽãããŸããã2.x ã® SetSnapModes(...) ã¯ã0 å以äžã® (ã«ã³ãåºåãã®) SnapMode ãã©ã¡ãŒã¿ã®å¯å€ã»ããã䜿çšããŠããŸããã3.x ã§ã¯ãSetSnapModes ã¯ã¹ããã ã¢ãŒãã® IEnumerable ãæ¶è²»ããŸãã
3.x ã§ã¯ãç¹å®ã® ArcGIS.Desktop.Mapping.SnappingOptions
ãããã㣠ãå€æŽãããŸãããããã¯äž»ã«ãäžè²«æ§ãåäžãããããã«ååãå€æŽããããã®ãã®ã§ãã泚: 2.x ã¹ããã ãªãã·ã§ã³ ããããã£ã® GeometrySnappingãSnapRequestTypeãVisualFeedbackColorãããã³ VisualSnapping ã¯åé€ããããµããŒããããªããªããŸããã ãŸãã3.x ã§ã¯ãSnapResult.OID
ã®ååã SnapResult.ObjectID
ã«å€æŽãããŸããã
以äžã«äŸã瀺ããŸãã
// set only Point and Edge snapping modes, clear everything else
//At 2.x
ArcGIS.Desktop.Mapping.Snapping.SetSnapModes(SnapMode.Point, SnapMode.Edge);
ArcGIS.Desktop.Mapping.Snapping.SetSnapModes(); //to clear all snap modes
//At 3.x
ArcGIS.Desktop.Mapping.Snapping.SetSnapModes(new List<SnapMode>(){ SnapMode.Point, SnapMode.Edge});
ArcGIS.Desktop.Mapping.Snapping.SetSnapModes(null); //to clear all snap modes
//Set snapping options via get/set options
var snapOptions = ArcGIS.Desktop.Mapping.Snapping.GetOptions(myMap);
//At 2.x
snapOptions.SnapToSketchEnabled = true;
snapOptions.ZToleranceEnabled = true;
snapOptions.GeometricFeedbackColor = ColorFactory.Instance.RedRGB;
//At 3.x
snapOptions.IsSnapToSketchEnabled = true;
snapOptions.IsZToleranceEnabled = true;
snapOptions.SnapTipColor = ColorFactory.Instance.RedRGB;
ArcGIS.Desktop.Mapping.Snapping.SetOptions(snapOptions);
//At 2.x -
//snapOptions.GeometricSnapping, snapOptions.SnapRequestType, snapOptions.VisualFeedbackColor,
//snapOptions.VisualSnapping are removed at 3.x
2.x ã§ã¯ãMapView ã® MapView.GetFeaturesãMapView.GetFeaturesExãMapView.SelectFeatures /latest/sdk/api-reference/topic11992.html)ãMapView.SelectFeaturesEx ã¡ãœããã¯ããããã Dictionary<BasicFeatureLayer, List<long>>
ããã³ Dictionary<Layer, List<long>>
åã®æ±çš LINQ ã³ã¬ã¯ã·ã§ã³ãšããŠè¿ãããŸããã2.x ã®ãããªã㯠API ã®ããŸããŸãªã¡ãœããããè¿ãããéžæã»ããã® Dictionary ãæ¶è²»ããŸããã- äŸãã° MapView.ZoomTo(IReadOnlyDictionary<BasicFeatureLayer,List<long>>,...)
ããå€ãã® EditOperation ã®ãã¯ããäŸãã° EditOperation.Move(IEnumerable<KeyValuePair<MapMember,List<long>>,...)
ãEditOperation.Reshape(IEnumerable<KeyValuePair<MapMember,List<long>>,...)
ãEditOperation.Rotate(IEnumerable<KeyValuePair<MapMember,List<long>>,...>)
ãªã©ããããŸãã(詳现㯠ArcGIS.Desktop.Editing.dll ã®å€æŽç¹ãåç
§ããŠãã ãã())ã
3.0 ã§ã¯ãè¿ããã LINQ ã³ã¬ã¯ã·ã§ã³ã SelectionSet ã¯ã©ã¹ ã«å€æŽãããŸããã2.x ã®éžæã»ããã Dictionary ãšããŠæ¶è²»ããŠãããããªã㯠API ã®å¯Ÿå¿ããã¡ãœããã¯ãçŸåšãæ°ãã SelectionSet ã¯ã©ã¹ãæ¶è²»ããŠããŸãã2.x 㧠LINQ ã䜿ã£ãŠè¿ãããéžæã»ãã Dictionary ããã£ã«ã¿ãªã³ã°ããŠããã¢ãã€ã³ã®ããã«ãSelectionSet
ã¯ã©ã¹ã¯ ToDictionary å€æã¡ãœãããæäŸããŸããToDictionary()
㯠SelectionSet ã LINQ Dictionary ã³ã¬ã¯ã·ã§ã³ã«å€æãã2.x ãšåãããã« LINQ ã§æäœã§ããããã«ããŸãã
//At 2.x -
QueuedTask.Run(()=> {
var sel_poly = .... ;//Polygon to use for selection
//zoom to the extent of the retrieved set of features
MapView.Active.ZoomTo(MapView.Active.GetFeatures(sel_poly));
//move the selected set of features
var editOp = new EditOperation() { ..... };
editOp.Move(MapView.Active.SelectFeatures(sel_poly), 500.0, 500.0);
editOp.Execute();
//rotate
var editOp = new EditOperation() { ..... };
editOp.Rotate(MapView.Active.SelectFeatures(sel_poly), origin, 35.0);
editOp.Execute();
//get the geometry of the first selected feature.
var dict_sel = MapView.Active.GetFeatures(sel_poly);
var insp = new Inspector();
insp.Load(dict_sel.Keys.First(), dict_sel.Values.First());
var selGeom = insp.Shape;
//Get the list of object ids from SelectFeaturesEx for a particular layer using LINQ
var sname = "Points of Interest";
var dict_sel = MapView.Active.SelectFeaturesEx(env);
var oids1 = dict_sel.Where(kvp => kvp.Key.Name == sname).First().Value;
//TODO - use the object ids
});
//At 3.x
QueuedTask.Run(() => {
var sel_poly = .... ;//Polygon to use for selection
//zoom to the extent of the retrieved set of features - No change
MapView.Active.ZoomTo(MapView.Active.GetFeatures(sel_poly));
//move the selected set of features - No change
var editOp = new EditOperation() { ..... };
editOp.Move(MapView.Active.SelectFeatures(sel_poly), 500.0, 500.0);
editOp.Execute();
//rotate - no change
var editOp = new EditOperation() { ..... };
editOp.Rotate(MapView.Active.SelectFeatures(sel_poly), origin, 35.0);
editOp.Execute();
//get the geometry of the first selected feature. Use ToDictionary()
//to apply LINQ
var selSet = MapView.Active.GetFeatures(sel_poly);
var insp = new Inspector();
insp.Load(selSet.ToDictionary().Keys.First(), selSet.ToDictionary().Values.First());
var selGeom = insp.Shape;
//Get the list of object ids from SelectFeaturesEx for a particular layer. Use ToDictionary()
//to apply LINQ
var sname = "Points of Interest";
var selSet = MapView.Active.SelectFeaturesEx(env);
var oids1 = selSet.ToDictionary().Where(kvp => kvp.Key.Name == sname).First().Value;
//TODO - use the object ids
//Create a selection set from a list of object ids
//using FromDictionary
var addToSelection = new Dictionary<MapMember, List<long>>();
addToSelection.Add(us_zips, new List<long> { 1506, 2696, 2246, 1647, 948 });
var sset = SelectionSet.FromDictionary(addToSelection);
//TODO - use sset
//etc
});
3.x ã§ã¯ãMapView ã® SelectElements ã¡ãœããããIElementContainer
ã® SelectElements å®çŸ©ã«äžèŽããããã«å€æŽãããŸããã ãã㯠2.x ã®ãã㪠IReadOnlyList<Element>
ã§ã¯ãªã void
ãè¿ããŸããmapView.SelectElements(...)
ãå®è¡ããŠéžæããèŠçŽ ãååŸããã«ã¯ã䜿çšããŠãã/䜿çšããŠãã SelectElements ã®ãªãŒããŒããŒãã«å¿ããŠãæå®ãããã°ã©ãã£ãã¯ã¹ ã¬ã€ã€ãŒãŸã㯠TOC å
ã®ãã¹ãŠã® GraphicsLayers ãã¯ãšãªããŸãã
//At 2.x
//Either - select from all graphics layers
var sel_elems = MapView.Active.SelectElements(
sel_geom, SelectionCombinationMethod.New, false);
// Or - select just from the specified graphics layer
var gl = mapView.Map.GetLayersAsFlattenedList().OfType<GraphicsLayer>().First();
var sel_elems = MapView.Active.SelectElements(
gl, sel_geom, SelectionCombinationMethod.New, false);
//At 3.x
MapView.Active.SelectElements(
sel_geom, SelectionCombinationMethod.New, false);//returns void
//or
var graphicsLayer = mapView.Map.GetLayersAsFlattenedList().OfType<GraphicsLayer>().First();
MapView.Active.SelectElements(
graphicsLayer, sel_geom, SelectionCombinationMethod.New, false);//returns void
//Get the selected elements
// - if a specific GraphicsLayer was specified then use it
var sel_elems = graphicsLayer.GetSelectedElements();
//No GraphicsLayer was specified, collect selection from all GraphicsLayers
var graphicsLayers = mapView.Map.GetLayersAsFlattenedList().OfType<GraphicsLayer>() ??
new List<GraphicsLayer>();
var sel_elems = new List<Element>();
foreach (var graphicsLayer in graphicsLayers) {
sel_elems.AddRange(graphicsLayer.GetSelectedElements());
}
//can also use map.TargetGraphicsLayer
var map = MapView.Active.Map;
var sel_elems = map.TargetGraphicsLayer.GetSelectedElements();
3.x ã§ã¯ãArcGIS.Desktop.Mapping.ExploratoryAnalysis
ãšå¯Ÿè©±ãã MapView ã¡ãœããã«ãAsyncã æ¥å°ŸèŸãä»ããŸãããmapView.RemoveExploratoryAnalysis()
ãš mapView.AddExploratoryAnalysis()
ã¯ããããã mapView.RemoveExploratoryAnalysisAsync()
ãš mapView.AddExploratoryAnalysisAsync()
ã«ãªããŸããã
3.x ã§ã¯ãCIMGenericView
ã§äœ¿çšããã XML æ°žç¶æ§ã¢ãã«ã«å€æŽããããTOCMapPaneProviderPane
ãã掟çããã«ã¹ã¿ã ããã ãã€ã³ ãã¥ãŒ ã¢ãã«ã䜿çšããããã ãã€ã³åœè£
ã®å®è£
ããããŸã, topic 16597ãã«ã¹ã¿ã ããã ãã€ã³ãšåœè£
ããã ãã€ã³ã¯ãtopic 1481 ã® CIMGenericView
ãšããŠæ°žç¶åãããŸãã.aprx ã«é¢é£ããå€æŽã«ã€ããŠã¯ããã®ããã¥ã¡ã³ãã® ã«ã¹ã¿ã CIMGenericView ãš ViewXML ã»ã¯ã·ã§ã³ãåç
§ããŠãã ããã
3.0 ã® API ã®å€æŽã®å®å šãªãªã¹ãã«ã€ããŠã¯ãAPI ãªãã¡ã¬ã³ã¹ã® What's New ãåç §ããŠãã ããã
3.x ã§ã¯ãTaskAssistantModule
㯠å
éš ã«ãªããŸããã2.x 㧠TaskAssistantModule ããã¢ã¯ã»ã¹ããŠããã¡ãœããã¯ã3.x ã§æ°ãã TaskAssistantFactory ã¯ã©ã¹ããã¢ã¯ã»ã¹ããå¿
èŠããããŸãã
äŸã¯æ¬¡ã®ãšããã§ãã
//At 2.x
//Access to tasks and task items via TaskAssistantModule
var taskItem = Project.Current.GetItems<TaskProjectItem>().FirstOrDefault();
//open a project task item
await TaskAssistantModule.OpenTaskItemAsync(taskItem.TaskItemGuid);
//Get task item information
string taskFile = @"c:\Tasks\Get Started.esriTasks";
var taskItemInfo = await TaskAssistantModule.GetTaskItemInfoAsync(taskFile);
// find the first task in the task item
var taskInfo = taskItemInfo.GetTasks().FirstOrDefault();
//open the task
await TaskAssistantModule.OpenTaskAsync(taskFile, taskInfo.Guid);
//export
await TaskAssistantModule.ExportTaskAsync(taskItem.TaskItemGuid, @"c:\temp");//also ImportTaskAsync
...
//Close it and remove from project
TaskAssistantModule.CloseTaskAsync(taskItem.TaskItemGuid);
//At 3.x
//use TaskAssistantFactory
var taskItem = Project.Current.GetItems<TaskProjectItem>().FirstOrDefault();
//open a project task item
await TaskAssistantFactory.Instance.OpenTaskItemAsync(taskItem.TaskItemGuid);
//Get task item information
string taskFile = @"c:\Tasks\Get Started.esriTasks";
var taskItemInfo = await TaskAssistantFactory.Instance.GetTaskItemInfoAsync(taskFile);
// find the first task in the task item
var taskInfo = taskItemInfo.GetTasks().FirstOrDefault();
//open the task - notice -OpenTaskFileAsync-
await TaskAssistantFactory.Instance.OpenTaskFileAsync(taskFile, taskInfo.Guid);
//export - ExportTaskItemAsync
await TaskAssistantFactory.Instance.ExportTaskItemAsync(taskItem.TaskItemGuid, @"c:\temp");
//also ImportTaskFileAsync ...
...
//Close it and remove from project - notice -CloseTaskItemAsync
TaskAssistantFactory.Instance.CloseTaskItemAsync(taskItem.TaskItemGuid);
3.0 ã® API ã®å€æŽã®å®å šãªãªã¹ãã«ã€ããŠã¯ãAPI ãªãã¡ã¬ã³ã¹ã® What's New ãåç §ããŠãã ããã
3.0 ã® API ã®å€æŽã®å®å šãªãªã¹ãã«ã€ããŠã¯ãAPI ãªãã¡ã¬ã³ã¹ã® What's New ãåç §ããŠãã ããã
3.x ã§ã¯ãCIM ãªããžã§ã¯ãã® xml ã·ãªã¢ã©ã€ãº ã¡ãœãã㯠åé€ãããŸãããcimObject.ToXml()
ãš CIMObject.FromXml()
ã¡ãœããã®ãã¢ãä»ã㊠XML ã·ãªã¢ã©ã€ãŒãŒã·ã§ã³ãšãã·ãªã¢ã©ã€ãŒãŒã·ã§ã³ã䜿çšãã 2.x ã®ã¢ãã€ã³ã¯ã3.x 㧠JSON ã䜿çšããããã«åãæ¿ããå¿
èŠããããŸããCIM æ°žç¶æ§ã¢ãã«ã® json ãžã®åãæ¿ãã«ãããããã³ã³ãã¯ããªã·ãªã¢ã«å圢åŒãæäŸãããPro ã® .aprx ã®ãµã€ãºãçž®å°ãããã·ãªã¢ã©ã€ãº/ãã·ãªã¢ã©ã€ãºã®ããã©ãŒãã³ã¹ã«é¢ããŠã¯ xml ãããé«éã«ãªããŸãã
3.x 㧠CIM ãªããžã§ã¯ããæ°žç¶å (ãŸãã¯ã·ãªã¢ã©ã€ãº) ããã«ã¯ãéçºè
ã¯é¢é£ãã掟ç CIM ã¯ã©ã¹ã«ã€ããŠãªãŒããŒã©ã€ãããã cimObject.ToJson()
ã€ã³ã¹ã¿ã³ã¹ã®ã¡ãœãã topic 24486 ã䜿çšããå¿
èŠããããŸããCIM json ããã·ãªã¢ã©ã€ãºããã«ã¯ãã¢ãã€ã³ã¯éç㪠CIMObject.FromJson(json_string)
掟çã¯ã©ã¹ã®ã¡ãœãã topic 74865(é¢é£ãã CIM ã¯ã©ã¹ã§) ã䜿çšããå¿
èŠããããŸãã
以äžã¯ãjson ã䜿çšãã 3.x ã§ã® CIM æ°žç¶æ§ã®äŸã§ãã
//assume we have a feature layer ....
var map = MapView.Active.Map;
var fl = map.GetLayersAsFlattenedList().OfType<FeatureLayer>().First();
QueuedTask.Run(() => {
//get a cim definition to be serialized - eg the renderer definition
var simple_renderer = fl.GetRenderer() as CIMSimpleRenderer;
//To persist serialized state at 3.x, use json
var renderer_json = original_object.ToJson();//No ToXml() at 3.x
//deserialize json to get back to original object
var simple_renderer2 = CIMSimpleRenderer.FromJson(renderer_json);//No FromXml() at 3.x
//Apply to the layer
fl.SetRenderer(original_object2);
...
3.x ã§ã® xml ãšã®éã® Geometry ã€ã³ã¹ã¿ã³ã¹ã®ã·ãªã¢ã©ã€ãŒãŒã·ã§ã³ã¯åŒãç¶ããµããŒããããŠããŸãã
ãã¡ã€ã«ãã«ã¹ã¿ã ããŒã¿ããŒã¹ããŸãã¯ä»ã®ã¹ãã¬ãŒãžã«ä¿åãããã2.x ã§ã·ãªã¢ã©ã€ãºãããæ°žç¶å xml ã® CIM æååã䜿çšããã¢ãã€ã³ã¯ãtopic 75062 ã® ArcGIS.Core.CIM.XmlUtils.UpgradeAndDeserializeCIMObject(xml)
ã¡ãœããã䜿çšããŠãæ°žç¶åããã 2.x ã® CIM ãªããžã§ã¯ãã 3.x æºæ ã®ãªããžã§ã¯ãã«äžæ¹çã«è»¢æããããšãæšå¥šãããŠããŸããUpgradeAndDeserializeCIMObject
ã¯ãå¿
èŠãª xml ããã®ãã·ãªã¢ã©ã€ãŒãŒã·ã§ã³ãšãå¿
èŠãªã¢ããã°ã¬ãŒãå€æã®äž¡æ¹ãè¡ããCIM ãªããžã§ã¯ããé©å㪠3.x ããŒãžã§ã³ã«ã¢ããã°ã¬ãŒãããŸãã
泚: åŸæ¹äºææ§ã¯ãããŸãããã€ãŸãã3.0 ã® CIM ãªããžã§ã¯ãã«å€æããã 2.x ã® CIM xml ã¯ãå ã® 2.x 圢åŒã«ããã¯ããŒãã§ããŸããããã·ãªã¢ã©ã€ãŒãŒã·ã§ã³ãš 3.0 ãžã®ã¢ããã°ã¬ãŒãã¯äžæ¹åã§ãã
次ã®äŸã¯ãUpgradeAndDeserializeCIMObject
ã䜿çšã㊠2.x ã® CIM xml ããã·ãªã¢ã©ã€ãºããã³ã¢ããã°ã¬ãŒãããæ¹æ³ã瀺ããŠããŸãã
using ArcGIS.Core.CIM;
...
//assume we have a feature layer ....
var map = MapView.Active.Map;
var fl = map.GetLayersAsFlattenedList().OfType<FeatureLayer>().First();
QueuedTask.Run(() => {
//2.x CIM xml retrieved from a file, proprietary database, etc.
var simple_renderer_xml = ... ;
//use XmlUtils.UpgradeAndDeserializeCIMObject(xml) to hydrate the CIM object
//at 3.x from 2.x xml - it will do a one-way conversion and upgrade to a 3.x CIMObject
//No CIMObject.FromXml() at 3.x
var simple_renderer = (CIMSimpleRenderer)XmlUtils.UpgradeAndDeserializeCIMObject(simple_renderer_xml);
//Apply to the layer
fl.SetRenderer(simple_renderer);
//TODO - change renderer properties, etc.
...
//persist renderer in json to save back in proprietary database, file on disk, etc.
var renderer_json = fl.GetRenderer().ToJson();
//From this point on, addin uses json for CIM persistence workflows
3.x ã§ã¯ãview.ViewXML
æååããããã£ã¯åé€ãããŸããã2.x ã§ã¯ãã¢ãã€ã³ã¯ã«ã¹ã¿ã ãã¥ãŒã®ç¶æ
ã view.ViewXML
ãããã㣠(ããã³ view.ViewProperties
ãã£ã¯ã·ã§ããª) ã«ä¿åããããšãã§ããŸãããã«ã¹ã¿ã ãã¥ãŒã¯ã3.x ã§ã«ã¹ã¿ã ã³ã³ãã³ããä¿æããããã«ãCIMGenericView ã® view.ViewProperties
dictionary ã䜿çšããããã«å€æŽããå¿
èŠããããŸããViewProperties ãã£ã¯ã·ã§ããªã«æžã蟌ãŸããã«ã¹ã¿ã ã³ã³ãã³ãã¯ããããžã§ã¯ããä¿åããããã³ã«ãaprxã«æ°žç¶åãããŸããæ°žç¶åã¯ããã¥ãŒã®ã¢ãã« (ãã¹ãŠã®ã«ã¹ã¿ã ãã¥ãŒ ã¢ãã«ã¯ ArcGIS.Desktop.Core.ViewStatePane
ããŒã¹ ã¯ã©ã¹ãã掟çããŸã) ã®ãªãŒããŒã©ã€ãããã public override CIMView ViewState
ããããã£, topic 9234 ãžã®ã³ãŒã«ããã¯ãéããŠå®è£
ãããŸãã泚æ: ããã©ã«ãã§ã¯ãview.ViewProperties
㯠null ã§ãã䜿çšããåã«ãå¿
èŠã«å¿ããŠã€ã³ã¹ã¿ã³ã¹åããŠãã ããã
äŸã¯æ¬¡ã®ãšããã§ãã
ã«ã¹ã¿ã ãã¥ãŒã§ããã¹ãŠã® view.ViewXML
ã CIMGenericView view.ViewProperties[...]
(é©åãªããŒã䜿çš) ã«å€æŽããŸãã
//At 2.x
view.ViewXML = new XDocument(new XElement("Root",
new XElement("custom", "custom value"))).ToString(
SaveOptions.DisableFormatting);
//At 3.x
//Use CIMGenericView ViewProperties Dictionary
if (view.ViewProperties == null)
view.ViewProperties = new Dictionary<string, object>();
view.ViewProperties["My_Custom_Content"] = "Custom content -xml or otherwise";
ãã®äŸã§ã¯ãã«ã¹ã¿ã ãã¥ãŒã¯ (å
éšã®) éç㪠"factory" Create ã¡ãœãã㧠view.ViewXML
ã䜿çšããŠããŸããããçŸåšã¯ view.ViewProperties
ãã£ã¯ã·ã§ããªã«çœ®ãæããããŠããŸãã
internal class CustomPaneViewModel : ViewStatePane, IContentsProvider, IContentsControl {
private const string _viewPaneID = "....";
...
public CustomPaneViewModel(CIMView view) : base(view) {
...
/// <summary>
/// Create a new instance of the pane.
/// </summary>
internal static CustomPaneViewModel Create() {
var view = new CIMGenericView();
view.ViewType = _viewPaneID;
//At 2.x
// view.ViewXML =
// "<Root><LastChanged>" + DateTime.Now.ToString("HH:mm:ss tt") + "</LastChanged></Root>";
//At 3.x, Use ViewProperties
view.ViewProperties = new Dictionary<string, object>();
view.ViewProperties["LastChanged"] = DateTime.Now.ToString("HH:mm:ss tt");
return FrameworkApplication.Panes.Create(
_viewPaneID, new object[] { view }) as CustomPaneViewModel;
}
...
/// <summary>
/// Button implementation to create a new instance of the pane and activate it.
/// </summary>
internal class CustomPane_OpenButton : Button {
protected override void OnClick() {
CustomPaneViewModel.Create();
}
}
ãã®äŸã§ã¯ãã«ã¹ã¿ã ãã¥ãŒã¯ ViewState ããããã£ã®ã³ãŒã«ãã㯠(ãããžã§ã¯ãã®ä¿åæã«ã¢ã¯ã»ã¹) 㧠ViewProperties ã䜿çšããããã«åãæ¿ããããŠããŸããview.ViewProperties
ã«æžã蟌ãŸããã³ã³ãã³ã㯠aprx ã«ä¿åãããŸã:
internal class AcmeCustomMapPaneViewModel : TOCMapPaneProviderPane {
private const string _viewPaneID = "....";
private string _customValue = "....";
...
/// <summary>
/// Must be overridden in child classes used to persist the state of the view to the CIM.
/// </summary>
public override CIMView ViewState {
get {
//If we are here, the project is being saved
_cimView.InstanceID = (int)InstanceID;
//At 2.x
// _cimView.ViewXML =
// "<Root><LastChanged>" + DateTime.Now.ToString("HH:mm:ss tt") + "</LastChanged></Root>";
//At 3.x, Use ViewProperties
if (((CIMGenericView)_cimView).ViewProperties == null)
((CIMGenericView)_cimView).ViewProperties = new Dictionary<string, object>();
((CIMGenericView)_cimView).ViewProperties["LastChanged"] = DateTime.Now.ToString("HH:mm:ss tt");
//Store anything else that the custom view requires
//Note: this code works at 2.x as well
((CIMGenericView)_cimView).ViewProperties["foo"] = "bar";
((CIMGenericView)_cimView).ViewProperties["custom"] = _customValue;
//can also include serialized content
((CIMGenericView)_cimView).ViewProperties["self"] = _cimView.ToJson();
//etc
return _cimView;
}
2.x ãããžã§ã¯ãã view.ViewXML
ã§ã«ã¹ã¿ã ãã¥ãŒ ã¹ããŒã 以åã«æ°žç¶åããã ã§éãããŠããå ŽåãäºçŽæžã¿ã®ããŒãViewXMLãã䜿çšã㊠view.ViewProperties
ãã£ã¯ã·ã§ããªããååŸã§ããŸã (ã«ã¹ã¿ã ãã¥ãŒ ã¢ãã€ã³ã¯ 3.x ã«ç§»è¡ãããŸãã)ã泚: 3.x ã«ç§»è¡ããã 2.x ã®ã«ã¹ã¿ã ãã¥ãŒã¯ãæ¢ã« (view.ViewXML ã§ã¯ãªã) view.ViewProperties ãã£ã¯ã·ã§ããªã䜿çšããŠããŸããããå€æŽãè¡ãå¿
èŠã¯ãããŸãã (移è¡ã«å¿
èŠãªãã®ä»ã®å€æŽä»¥å€)ã
ãã®äŸã¯ã2.x 㧠view.ViewXML
ã䜿çšãã3.x 㧠view.ViewProperties["ViewXML"]
ã®äœ¿çšã«åãæ¿ããã«ã¹ã¿ã ãã¥ãŒã®ãååŸãã®å®è£
ã瀺ããŠããŸããã«ã¹ã¿ã ãã¥ãŒã® 3.x ããŒãžã§ã³ããview.ViewProperties["ViewXML"]
ã®ååšããã§ãã¯ããæ¹æ³ã«æ³šç®ããŠãã ããã
2.x ã® aprx ã 3.x ã§éãããšãã«ã以åã« view.ViewXML
ããããã£ã§ä¿æãã (ããªãã®ãã¥ãŒã®) ã«ã¹ã¿ã ãã¥ãŒ ã³ã³ãã³ããå«ãŸããŠãããšãview.ViewProperties["ViewXML"]
å€ããã¥ãŒ ããããã£ã®ãã£ã¯ã·ã§ããªã«è¿œå ãããããšãèŠããŠããŠãã ããã
//At 3.x. view.ViewXML has been removed. Use view.ViewProperties for persistence
internal class AcmeCustomMapPaneViewModel : TOCMapPaneProviderPane {
private const string _viewPaneID = "....";
private string _lastChangeToProperties = "";
private string _customContent = "";
private string _bar = "";
/// <summary>
/// Must be overridden in child classes used to persist the state of the view to the CIM.
/// </summary>
public override CIMView ViewState {
get {
//If we are here, the project is being saved
_cimView.InstanceID = (int)InstanceID;
//At 3.x - use view.ViewProperties. There is no ViewXML
_lastChangeToProperties = DateTime.Now.ToString("HH:mm:ss tt");
if (((CIMGenericView)_cimView).ViewProperties == null)
((CIMGenericView)_cimView).ViewProperties = new Dictionary<string, object>();
((CIMGenericView)_cimView).ViewProperties["LastChanged"] =
_lastChangeToProperties ;
((CIMGenericView)_cimView).ViewProperties["foo"] = _bar;
((CIMGenericView)_cimView).ViewProperties["custom"] = _customValue;
//can also include serialized content
((CIMGenericView)_cimView).ViewProperties["self"] = _cimView.ToJson();
//etc
return _cimView;
}
}
//read in any of our previously persisted state/content
protected async override Task InitializeAsync() {
if (((CIMGenericView)_cimView).ViewProperties == null)
return;
var uri = ((CIMGenericView)_cimView).ViewProperties["MAPURI"] as string;
//use ViewProperties same as in 2.x
if (((CIMGenericView)_cimView).ViewProperties.ContainsKey("LastChanged"))
_lastSave = ((CIMGenericView)_cimView).ViewProperties["LastChanged"] as string;
if (((CIMGenericView)_cimView).ViewProperties.ContainsKey("foo"))
_bar = ((CIMGenericView)_cimView).ViewProperties["foo"] as string;
if (((CIMGenericView)_cimView).ViewProperties.ContainsKey("custom"))
... etc, etc,...
//Now check if this a 2.x project being opened in 3.0 that had previously used view.ViewXML....
//If so, at 3.x, it will have a "special" "ViewXML" key that will have been added to the
//ViewProperties containing the legacy content...
//...
if (((CIMGenericView)_cimView).ViewProperties.ContainsKey("ViewXML")) { //Legacy content
var previous_custom_content = ((CIMGenericView)_cimView).ViewProperties["ViewXML"] as string;
//TODO Process the custom content that was persisted at 2.x
string customContentFromViewXML = .... ;
//Ok to delete "ViewXML" once its been read (but not required)
((CIMGenericView)_cimView).ViewProperties.Remove("ViewXML");
}
ViewProperties["ViewXML"]
ãã 2.x ã³ã³ãã³ããèªã¿åããããšãå¿
èŠã«å¿ããŠããŒãå®å
šã«åé€ã§ããŸãã
2.x ã§äœæãããããããã¬ã€ã¢ãŠããã¬ã€ã€ãŒ (.mapxã.pagxã.lyrx) ããã³ããã±ãŒãž (.mpkxã.lpkx) ã¯ã3.0 ã®ãããªã㯠API 㧠å€æŽãªã ã§äœ¿çšã§ããŸããAPI ã«ãã£ãŠæ¶è²»ããããšãèªåçã« 3.0 圢åŒã«å€æãããŸãã
äŸãã°ïŒ
//At 3.x, consume 2.x files and packages in the public API
QueuedTask.Run(()=> {
//Create a map using a 2.x map file or package
var mapx_path = @"E:\Data\SDK\Migration\Crimes_Map_29.mapx";//or package
MapFactory.Instance.CreateMap(new Uri(mapx_path));
//Create a layout using a 2.x layout file
var lytx_path = @"E:\Data\SDK\Migration\Crimes_Layout_29.pagx";
var lytx_item = ItemFactory.Instance.Create(lytx_path) as IProjectMultiItem;
Project.Current.ImportItem(lytx_item, false, true);
});
ãã®äŸã§ã¯ãã¢ãã€ã³ã¯ 2.x ã®ã¬ã€ã€ãŒ ãã¡ã€ã«ããŸãã¯ã¬ã€ã€ãŒ ããã±ãŒãžãèªã¿èŸŒã¿ãFeatureLayerCreationParams
ã¯ã©ã¹ãéããŠæ°ããã¬ã€ã€ãŒãäœæããããã«äœ¿çšãããŠããŸãtopic 26495:
var map = MapView.Active.Map;
QueuedTask.Run(() => {
//Use 2.x Layer files (.lyrx) or packages (.lpkx) at 3.x
var layer_file_29 = @"E:\Data\SDK\Migration\Crimes_29.lyrx";//or .lpkx
var fl_params = new FeatureLayerCreationParams(new Uri(layer_file_29)) {
IsVisible = true,
Name = "From_Layer_File",
MapMemberPosition = MapMemberPosition.AddToTop
};
//Create the new layer.
//2.x file/package is automatically converted to 3.x
LayerFactory.Instance.CreateLayer<FeatureLayer>(fl_params, map);
...
æåŸã®äŸã§ã¯ãã¢ãã€ã³ã 2.x ã®ã¬ã€ã€ãŒ ãã¡ã€ã«ã䜿ã£ãŠ LayerDocument
, topic 26521 ãäœæããŠããŸããLayerDocument
ã¯ãçµæãšããŠåŸãããã¬ã€ã€ãŒã®ã·ã³ãã«ãã«ã¹ã¿ãã€ãºããããã«äœ¿çšãããŠããŸãã
var map = MapView.Active.Map;
QueuedTask.Run(() => {
//Use 2.x Layer files (.lyrx) with LayerDocument class at 3.x
//Note: LayerDocument class does not support use with .lpkx files
var layer_file_29 = @"E:\Data\SDK\Migration\Crimes_29.lyrx";
//Create the 3.x layer document with the 2.x layer file
//The 2.x layer file is automatically converted
var layerDoc = new LayerDocument(layer_file_29);
//Get the CIMLayerDocument from the layer document and
//customize the layer doc properties - eg visibility and renderer
var cimLayerDoc = layerDoc.GetCIMLayerDocument();
var layerDefinitions = cimLayerDoc.LayerDefinitions;
var layerDef = layerDefinitions[0] as CIMFeatureLayer;
layerDef.Visibility = false;
layerDef.Renderer = new CIMSimpleRenderer() {
Symbol = SymbolFactory.Instance.ConstructPointSymbol(
CIMColor.CreateRGBColor(200, 0, 200)).MakeSymbolReference()
};
//Use the modified CIM layerdoc to create a layer and add it to the map
var fl_params = new FeatureLayerCreationParams(cimLayerDoc);
LayerFactory.Instance.CreateLayer<FeatureLayer>(fl_params2, map);
...
3.x ã§ã®ããããã¬ã€ã¢ãŠããããã³ã¬ã€ã€ãŒ ã¢ãã«ã® URI 圢åŒã¯ããããããã³ã¬ã€ã€ãŒã®äžè¬çãªåœ¢åŒã§ãã CIMPATH=map/<ãªããžã§ã¯ãèå¥åãŸãã¯åå>.xml
ããã³ CIMPATH=layout/<ãªããžã§ã¯ãèå¥åãŸãã¯åå>.xml
ããããããã CIMPATH=map/<ãªããžã§ã¯ãèå¥åãŸãã¯åå>.json
ããã³ CIMPATH=layout/<ãªããžã§ã¯ãèå¥åãŸãã¯åå>.json
ã«å€æŽãããŸãããæ¥å°ŸèŸã 2.x ã® ".xml" ãã 3.x ã® ".json" ã«å€æŽãããŠããããšã«æ³šæããŠãã ãããäœããã®çç±ã§ã.xmlãã® URI æååã®æ¥å°ŸèŸã«çŽæ¥äŸåããŠããªãéããURI ã䜿çšãŸãã¯åç
§ããã¢ãã€ã³ ã³ãŒããå€æŽããå¿
èŠã¯ãããŸããã
2.x ã¢ãã€ã³å ã§å®è£ ãŸãã¯äœ¿çšã§ããããŸããŸãªå®è£ ãã¿ãŒã³ãšã³ã³ãã³ã ã¿ã€ããå€æ°ãããŸãããããã®ãã¿ãŒã³ã®ç§»è¡ã«é¢ããèæ ®äºé ã«ã€ããŠã¯ããã®ã»ã¯ã·ã§ã³ã§è©³ãã説æããŸãã
ã¢ãã€ã³ã¯ãArcGIS Pro ã® .aprx ãããžã§ã¯ã ãã¡ã€ã«å ã«ã«ã¹ã¿ã ããããã£ãæ ŒçŽã§ããŸããã«ã¹ã¿ã ããããã£ã¯ãã«ã¹ã¿ã ããããã£ãå«ãç¹å®ã®ãããžã§ã¯ããéãããã«ã¹ã¿ã ãããžã§ã¯ã ããããã£ãæ°žç¶åããã¢ãã€ã³ãèªã¿èŸŒãŸãããšãã«ã¢ã¯ã»ã¹ãããŸããã«ã¹ã¿ã ãããžã§ã¯ã ããããã£ã«ã¢ã¯ã»ã¹ããã«ã¯ãã¢ãã€ã³ã 3.x ã«ç§»è¡ ãããŠããéãããã以äžã®æäœã¯å¿ èŠãããŸããã2.x ãããžã§ã¯ã ãã¡ã€ã«ã 3.x ã§éããšãã«ã¹ã¿ã ã¢ãã€ã³ ããããã£ãå«ãŸããŸãããããžã§ã¯ã ãã¡ã€ã«ã (3.x ã«) ä¿åãããšãã«ã¹ã¿ã ãããžã§ã¯ã ããããã£ã (aprx ã®) 3.x ããŒãžã§ã³ã«ä¿æãããŸãã
ã«ã¹ã¿ã ãããžã§ã¯ã ããããã£ã®è©³çŽ°ã«ã€ããŠã¯ãProGuide, Custom Settings ãåç §ããŠãã ããã
ã¢ãã€ã³ã¯ãã¢ããªã±ãŒã·ã§ã³ã® user.config ãã¡ã€ã«å
ã«ã«ã¹ã¿ã ããããã£ãæ ŒçŽã§ããŸãããããã¯ãMicrosoft ã®èªåçæãããèšå®ã¯ã©ã¹ (System.Configuration.ApplicationSettingsBase
ãã掟ç) ãä»ããŠã¢ã¯ã»ã¹ãããŸããã«ã¹ã¿ã ã¢ããªã±ãŒã·ã§ã³ ããããã£ã ArcGIS Pro 3.x user.config ã«ç§»è¡ããã«ã¯ãã¢ãã€ã³éçºè
ã¯æ¬¡ã®ããšãè¡ãå¿
èŠããããŸãã
- ã¢ãã€ã³ã 3.x 㫠移è¡ããã
- ã¢ãã€ã³ã®ã«ã¹ã¿ã èšå®ã§ UpgradeNeeded ãšããããŒã«å€ã®ããããã£ãå®çŸ©ããæ¢å®å€ã true ã«èšå®ããŸãã
ããŒã«åããããã£ã®ååã¯ä»»æã§ãããé垞㯠UpgradeNeeded ãšåŒã³ãŸãã掟çã®èšå®ã¯ã©ã¹ ã³ã³ã¹ãã©ã¯ã¿ãŒã§ãUpgradeNeeded ããããã£ã®å€ã確èªããŸããtrue ã®å Žåã¯ãåºæ¬ã¯ã©ã¹ã® Upgrade ã¡ãœããããåŒã³åºããŠãã«ã¹ã¿ã èšå®ã Pro 3.x user.config ã«ç§»è¡ããŸããèšå®ãã¡ã€ã« ã³ã³ã¹ãã©ã¯ã¿ãŒã®ã³ãŒãã¯æ¬¡ã®ããã«ãªããŸãã
public Settings() {
if (UpgradeRequired) {
UpgradeRequired = false;//store a value of false in the user.config
Save();//save the settings
Upgrade();//base class Upgrade - this does the migration
}
}
æé ã«ã€ããŠã¯ãProGuide Custom Settings ã§è©³ãã説æããŠããŸããæé ã¯ããã® stack overflow ã®æçš¿ ã§ã詳ãã説æãããŠããŸãã
ã¢ãã€ã³ç§»è¡ããŒã« ã¯ãã¢ãã€ã³ãšã«ã¹ã¿ã ããŒã«ããã¯ã¹ã®ã³ã³ãã³ãã 3.x ã«ç§»è¡ããŸãããã以äžã®ã¢ã¯ã·ã§ã³ã¯å¿ èŠãããŸããããã ãããã®ããã¥ã¡ã³ã㧠åã« è¿°ã¹ãããã«ãç¹å¥ãªã³ã³ãã³ã ã¿ã° "AddinContent" 㯠3.x ã§ãµããŒããããªããªããŸããã移è¡ããŒã«ã¯ã以åã« 2.x 㧠AddinContent ãšããŠããŒã¯ãããŠãããã¹ãŠã®ããŒã«ããã¯ã¹ ã³ã³ãã³ããçµã¿èŸŒã¿ã¿ã€ãã®ãContentãã«å€æããŸã (以äžãåç §)ã çµã¿èŸŒã¿ã®ã³ã³ãã³ã ã¿ã€ãã¯ãAddinContent ãšãŸã£ããåãããã«åäœããŸãã
ããŒã«ããã¯ã¹ ã¢ãã€ã³ãå®è¡ããŸãã
å€æããã .csproj ãŸã㯠.vbproj ãéããããŒã«ããã¯ã¹ã®ã³ã³ãã³ã ã¿ã€ããå€æŽãããŠããããšã確èªããŸãã
<!-- Before migration-->
<ItemGroup>
<AddInContent Include="Toolboxes\arcpy\DeepThought.py" />
<AddInContent Include="Toolboxes\toolboxes\answer.py" />
<AddInContent Include="Toolboxes\toolboxes\sixbynine.py" />
<AddInContent Include="Toolboxes\help\gp\Answer_deepthought.xml" />
<AddInContent Include="Toolboxes\help\gp\deepthought_toolbox.xml" />
<AddInContent Include="Toolboxes\help\gp\messages\messages.xml" />
<AddInContent Include="Toolboxes\help\gp\toolboxes\DeepThought.xml" />
<AddInContent Include="Toolboxes\toolboxes\DeepThought.tbx" />
</ItemGroup>
<!-- After migration-->
<ItemGroup>
<Content Include="Toolboxes\arcpy\DeepThought.py" />
<Content Include="Toolboxes\toolboxes\answer.py" />
<Content Include="Toolboxes\toolboxes\sixbynine.py" />
<Content Include="Toolboxes\help\gp\Answer_deepthought.xml" />
<Content Include="Toolboxes\help\gp\deepthought_toolbox.xml" />
<Content Include="Toolboxes\help\gp\messages\messages.xml" />
<Content Include="Toolboxes\help\gp\toolboxes\DeepThought.xml" />
<Content Include="Toolboxes\toolboxes\DeepThought.tbx" />
</ItemGroup>
ã«ã¹ã¿ã ã³ã³ãã³ããPython ããŒã«ããã¯ã¹ã®åã蟌ã¿ã«ã€ããŠã¯ãProGuide Content and Image Resources, Python Toolboxes ãåç §ããŠãã ããã