diff --git a/Plugin/ProDataReader/Config.daml b/Plugin/ProDataReader/Config.daml deleted file mode 100644 index 343c61b4..00000000 --- a/Plugin/ProDataReader/Config.daml +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - ProDataReader - ProDataReader description - Images\AddinDesktop32.png - ArcGIS Pro SDK Team, arcgisprosdk@esri.com - esri, http://www.esri.com - 5/9/2019 5:35:42 AM, 2019 - Framework - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Plugin/ProDataReader/DarkImages/AddInDesktop16.png b/Plugin/ProDataReader/DarkImages/AddInDesktop16.png deleted file mode 100644 index 0118942a..00000000 Binary files a/Plugin/ProDataReader/DarkImages/AddInDesktop16.png and /dev/null differ diff --git a/Plugin/ProDataReader/DarkImages/AddInDesktop32.png b/Plugin/ProDataReader/DarkImages/AddInDesktop32.png deleted file mode 100644 index 9713e3b1..00000000 Binary files a/Plugin/ProDataReader/DarkImages/AddInDesktop32.png and /dev/null differ diff --git a/Plugin/ProDataReader/DarkImages/BexDog16.png b/Plugin/ProDataReader/DarkImages/BexDog16.png deleted file mode 100644 index aabfd1d6..00000000 Binary files a/Plugin/ProDataReader/DarkImages/BexDog16.png and /dev/null differ diff --git a/Plugin/ProDataReader/DarkImages/BexDog32.png b/Plugin/ProDataReader/DarkImages/BexDog32.png deleted file mode 100644 index 67e82694..00000000 Binary files a/Plugin/ProDataReader/DarkImages/BexDog32.png and /dev/null differ diff --git a/Plugin/ProDataReader/DarkImages/Folder16.png b/Plugin/ProDataReader/DarkImages/Folder16.png deleted file mode 100644 index 049a3120..00000000 Binary files a/Plugin/ProDataReader/DarkImages/Folder16.png and /dev/null differ diff --git a/Plugin/ProDataReader/DarkImages/Folder32.png b/Plugin/ProDataReader/DarkImages/Folder32.png deleted file mode 100644 index ce4303be..00000000 Binary files a/Plugin/ProDataReader/DarkImages/Folder32.png and /dev/null differ diff --git a/Plugin/ProDataReader/DarkImages/FolderWithGISData16.png b/Plugin/ProDataReader/DarkImages/FolderWithGISData16.png deleted file mode 100644 index ae56a1aa..00000000 Binary files a/Plugin/ProDataReader/DarkImages/FolderWithGISData16.png and /dev/null differ diff --git a/Plugin/ProDataReader/DarkImages/FolderWithGISData32.png b/Plugin/ProDataReader/DarkImages/FolderWithGISData32.png deleted file mode 100644 index 4de95027..00000000 Binary files a/Plugin/ProDataReader/DarkImages/FolderWithGISData32.png and /dev/null differ diff --git a/Plugin/ProDataReader/DarkImages/GenericButtonBlue16.png b/Plugin/ProDataReader/DarkImages/GenericButtonBlue16.png deleted file mode 100644 index 20b11875..00000000 Binary files a/Plugin/ProDataReader/DarkImages/GenericButtonBlue16.png and /dev/null differ diff --git a/Plugin/ProDataReader/DarkImages/GenericButtonBlue32.png b/Plugin/ProDataReader/DarkImages/GenericButtonBlue32.png deleted file mode 100644 index e3b26ab9..00000000 Binary files a/Plugin/ProDataReader/DarkImages/GenericButtonBlue32.png and /dev/null differ diff --git a/Plugin/ProDataReader/DarkImages/Mdb16.png b/Plugin/ProDataReader/DarkImages/Mdb16.png deleted file mode 100644 index 62208547..00000000 Binary files a/Plugin/ProDataReader/DarkImages/Mdb16.png and /dev/null differ diff --git a/Plugin/ProDataReader/DarkImages/Mdb32.png b/Plugin/ProDataReader/DarkImages/Mdb32.png deleted file mode 100644 index 14995a23..00000000 Binary files a/Plugin/ProDataReader/DarkImages/Mdb32.png and /dev/null differ diff --git a/Plugin/ProDataReader/DarkImages/ZipDetail16.png b/Plugin/ProDataReader/DarkImages/ZipDetail16.png deleted file mode 100644 index 06d94d38..00000000 Binary files a/Plugin/ProDataReader/DarkImages/ZipDetail16.png and /dev/null differ diff --git a/Plugin/ProDataReader/DarkImages/ZipDetail32.png b/Plugin/ProDataReader/DarkImages/ZipDetail32.png deleted file mode 100644 index 7ac04a74..00000000 Binary files a/Plugin/ProDataReader/DarkImages/ZipDetail32.png and /dev/null differ diff --git a/Plugin/ProDataReader/ImageMetadata/ImageMetadata.csproj b/Plugin/ProDataReader/ImageMetadata/ImageMetadata.csproj deleted file mode 100644 index 695d58e3..00000000 --- a/Plugin/ProDataReader/ImageMetadata/ImageMetadata.csproj +++ /dev/null @@ -1,53 +0,0 @@ - - - - - Debug - AnyCPU - {270B962C-93E5-473F-B502-D05D639CC51D} - Library - Properties - ImageMetadata - ImageMetadata - v4.7.2 - 512 - true - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - 1591 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Plugin/ProDataReader/ImageMetadata/Properties/AssemblyInfo.cs b/Plugin/ProDataReader/ImageMetadata/Properties/AssemblyInfo.cs deleted file mode 100644 index 7a9c3127..00000000 --- a/Plugin/ProDataReader/ImageMetadata/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,54 +0,0 @@ -/* - - Copyright 2017 Esri - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - - See the License for the specific language governing permissions and - limitations under the License. - -*/ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("ImageMetadata")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("ImageMetadata")] -[assembly: AssemblyCopyright("Copyright © 2019")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("270b962c-93e5-473f-b502-d05d639cc51d")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Plugin/ProDataReader/ImageMetadata/XimgDataTypes.cs b/Plugin/ProDataReader/ImageMetadata/XimgDataTypes.cs deleted file mode 100644 index ff1c0622..00000000 --- a/Plugin/ProDataReader/ImageMetadata/XimgDataTypes.cs +++ /dev/null @@ -1,126 +0,0 @@ -/* - - Copyright 2017 Esri - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - - See the License for the specific language governing permissions and - limitations under the License. - -*/ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ImageMetadata -{ - - public class XimgRational - { - private Int32 _num; - private Int32 _denom; - - public XimgRational(byte[] bytes) - { - byte[] n = new byte[4]; - byte[] d = new byte[4]; - Array.Copy(bytes, 0, n, 0, 4); - Array.Copy(bytes, 4, d, 0, 4); - _num = BitConverter.ToInt32(n, 0); - _denom = BitConverter.ToInt32(d, 0); - } - - public double ToDouble() - { - return Convert.ToDouble(_num) / Convert.ToDouble(_denom); - } - - public string ToString(string separator = "/") - { - return _num.ToString() + separator + _denom.ToString(); - } - } - - public class XimgURational - { - private UInt32 _num; - private UInt32 _denom; - - public XimgURational(byte[] bytes) - { - byte[] n = new byte[4]; - byte[] d = new byte[4]; - Array.Copy(bytes, 0, n, 0, 4); - Array.Copy(bytes, 4, d, 0, 4); - _num = BitConverter.ToUInt32(n, 0); - _denom = BitConverter.ToUInt32(d, 0); - } - - public double ToDouble() - { - return Math.Round(Convert.ToDouble(_num) / Convert.ToDouble(_denom), 2); - } - - public override string ToString() - { - return this.ToString("/"); - } - - public string ToString(string separator) - { - return _num.ToString() + separator + _denom.ToString(); - } - } - - public class XimgGPSRational - { - private XimgRational _hours; - private XimgRational _minutes; - private XimgRational _seconds; - private double _degrees; - - public XimgRational Hours => _hours; - - public XimgRational Minutes => _minutes; - - public XimgRational Seconds => _seconds; - - public double Degrees => _degrees; - - public XimgGPSRational(byte[] bytes) - { - byte[] h = new byte[8]; byte[] m = new byte[8]; byte[] s = new byte[8]; - - Array.Copy(bytes, 0, h, 0, 8); Array.Copy(bytes, 8, m, 0, 8); Array.Copy(bytes, 16, s, 0, 8); - - _hours = new XimgRational(h); - _minutes = new XimgRational(m); - _seconds = new XimgRational(s); - _degrees = _hours.ToDouble() + (_minutes.ToDouble() / 60) + (_seconds.ToDouble() / 3600); - } - - public override string ToString() - { - return _hours.ToDouble() + "° " - + _minutes.ToDouble() + "\' " - + _seconds.ToDouble() + "\""; - } - - public string ToString(string separator) - { - return _hours.ToDouble() + separator - + _minutes.ToDouble() + separator + - _seconds.ToDouble(); - } - } -} diff --git a/Plugin/ProDataReader/ImageMetadata/XimgInfo.cs b/Plugin/ProDataReader/ImageMetadata/XimgInfo.cs deleted file mode 100644 index 3ba166e7..00000000 --- a/Plugin/ProDataReader/ImageMetadata/XimgInfo.cs +++ /dev/null @@ -1,110 +0,0 @@ -/* - - Copyright 2017 Esri - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - - See the License for the specific language governing permissions and - limitations under the License. - -*/ -using System; -using System.Collections.Generic; -using System.Drawing; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ImageMetadata -{ - public class XimgInfo - { - private XimgParse _ximgParse = null; - //private Image _image = null; - - /// - /// Used to parse the metadata from an image stream - /// see: https://www.exiv2.org/tags.html - /// - /// the path to an image - public XimgInfo(string fileName) - { - try - { - Path = fileName; - var image = System.Drawing.Image.FromFile(fileName); - _ximgParse = new XimgParse(image); - IsImage = true; - } - catch (Exception ex) - { - IsImage = false; - Error = ex.ToString(); - } - } - - public string Path { get; set; } - - public string Name - { - get - { - return !String.IsNullOrEmpty(Path) ? System.IO.Path.GetFileName(Path) : "n/a"; - } - } - - public bool IsFolder - { - get - { - return Directory.Exists(Path); - } - } - - public bool IsImage { get; set; } - - public bool IsGpsEnabled { - get { - var sLat = Latitude.ToString("0.000"); - var sLng = Longitude.ToString("0.000"); - return !(double.IsNaN(Latitude) || double.IsNaN(Longitude)) - && !(sLat.Equals ("0.000") || sLng.Equals ("0.000")); - } - } - - /// - /// Always returns 1 = point geometry - /// - public int GeometryType => 1; - - //public byte[] Image - //{ - // get - // { - // byte[] imgData = System.IO.File.ReadAllBytes(Path); - // return imgData; - // } - //} - - public string Error { get; set; } - - public double Longitude => _ximgParse.Longitude; - - public double Latitude => _ximgParse.Latitude; - - public double Altitude => _ximgParse.Altitude; - - public double ImageBearing => _ximgParse.ImageBearing; - - public DateTime DateTimeOriginal => _ximgParse.DateTimeOriginal; - } -} diff --git a/Plugin/ProDataReader/ImageMetadata/XimgParse.cs b/Plugin/ProDataReader/ImageMetadata/XimgParse.cs deleted file mode 100644 index 1a2f59c9..00000000 --- a/Plugin/ProDataReader/ImageMetadata/XimgParse.cs +++ /dev/null @@ -1,793 +0,0 @@ -/* - - Copyright 2017 Esri - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - - See the License for the specific language governing permissions and - limitations under the License. - -*/ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ImageMetadata -{ - public class XimgParse - { - private Dictionary _parseTags; - - public XimgParse(System.Drawing.Image image) - { - Encoding ascii = Encoding.ASCII; - _parseTags = new Dictionary(); - foreach (System.Drawing.Imaging.PropertyItem pitem in image.PropertyItems) - { - if (!ParseTags.ContainsKey(pitem.Id)) continue; - XimgTag xTag = ParseTags[pitem.Id].Clone(); - string strValue = ""; - object value = null; - switch (pitem.Type) - { - case 0x1: - { - #region BYTE (8-bit unsigned int) - value = pitem.Value[0]; - if (pitem.Value.Length == 4) - strValue = "Version " + pitem.Value[0].ToString() + "." + pitem.Value[1].ToString(); - else if (pitem.Id == 0x5 && pitem.Value[0] == 0) - strValue = "Sea level"; - else - strValue = pitem.Value[0].ToString(); - #endregion - } - break; - case 0x2: - { - #region ASCII (8 bit ASCII code) - - strValue = ascii.GetString(pitem.Value).Trim('\0'); - value = strValue; - if (pitem.Id == 0x1 || pitem.Id == 0x13) - if (strValue == "N") strValue = "North latitude"; - else if (strValue == "S") strValue = "South latitude"; - else strValue = "n/a"; - - if (pitem.Id == 0x3 || pitem.Id == 0x15) - if (strValue == "E") strValue = "East longitude"; - else if (strValue == "W") strValue = "West longitude"; - else strValue = "n/a"; - - if (pitem.Id == 0x9) - if (strValue == "A") strValue = "Measurement in progress"; - else if (strValue == "V") strValue = "Measurement Interoperability"; - else strValue = "n/a"; - - if (pitem.Id == 0xA) - if (strValue == "2") strValue = "2-dimensional measurement"; - else if (strValue == "3") strValue = "3-dimensional measurement"; - else strValue = "n/a"; - - if (pitem.Id == 0xC || pitem.Id == 0x19) - if (strValue == "K") strValue = "Kilometers per hour"; - else if (strValue == "M") strValue = "Miles per hour"; - else if (strValue == "N") strValue = "Knots"; - else strValue = "n/a"; - - if (pitem.Id == 0xE || pitem.Id == 0x10 || pitem.Id == 0x17) - if (strValue == "T") strValue = "True direction"; - else if (strValue == "M") strValue = "Magnetic direction"; - else strValue = "n/a"; - #endregion - } - break; - case 0x3: - { - #region 3 = SHORT (16-bit unsigned int) - UInt16 uintval = BitConverter.ToUInt16(pitem.Value, 0); - value = uintval; - - // orientation // lookup table - switch (pitem.Id) - { - case 0x8827: // ISO speed rating - strValue = "ISO-" + uintval.ToString(); - break; - case 0xA217: // sensing method - { - switch (uintval) - { - case 1: strValue = "Not defined"; break; - case 2: strValue = "One-chip color area sensor"; break; - case 3: strValue = "Two-chip color area sensor"; break; - case 4: strValue = "Three-chip color area sensor"; break; - case 5: strValue = "Color sequential area sensor"; break; - case 7: strValue = "Trilinear sensor"; break; - case 8: strValue = "Color sequential linear sensor"; break; - default: strValue = " reserved"; break; - } - } - break; - case 0x8822: // Exposure program - switch (uintval) - { - case 0: strValue = "Not defined"; break; - case 1: strValue = "Manual"; break; - case 2: strValue = "Normal program"; break; - case 3: strValue = "Aperture priority"; break; - case 4: strValue = "Shutter priority"; break; - case 5: strValue = "Creative program (biased toward depth of field)"; break; - case 6: strValue = "Action program (biased toward fast shutter speed)"; break; - case 7: strValue = "Portrait mode (for closeup photos with the background out of focus)"; break; - case 8: strValue = "Landscape mode (for landscape photos with the background in focus)"; break; - default: strValue = "n/a"; break; - } - break; - case 0x9207: // metering mode - switch (uintval) - { - case 0: strValue = "unknown"; break; - case 1: strValue = "Average"; break; - case 2: strValue = "Center Weighted Average"; break; - case 3: strValue = "Spot"; break; - case 4: strValue = "MultiSpot"; break; - case 5: strValue = "Pattern"; break; - case 6: strValue = "Partial"; break; - case 255: strValue = "Other"; break; - default: strValue = "n/a"; break; - } - break; - case 0x9208: // Light source - { - switch (uintval) - { - case 0: strValue = "unknown"; break; - case 1: strValue = "Daylight"; break; - case 2: strValue = "Fluorescent"; break; - case 3: strValue = "Tungsten (incandescent light)"; break; - case 4: strValue = "Flash"; break; - case 9: strValue = "Fine weather"; break; - case 10: strValue = "Cloudy weather"; break; - case 11: strValue = "Shade"; break; - case 12: strValue = "Daylight fluorescent (D 5700 – 7100K)"; break; - case 13: strValue = "Day white fluorescent (N 4600 – 5400K)"; break; - case 14: strValue = "Cool white fluorescent (W 3900 – 4500K)"; break; - case 15: strValue = "White fluorescent (WW 3200 – 3700K)"; break; - case 17: strValue = "Standard light A"; break; - case 18: strValue = "Standard light B"; break; - case 19: strValue = "Standard light C"; break; - case 20: strValue = "D55"; break; - case 21: strValue = "D65"; break; - case 22: strValue = "D75"; break; - case 23: strValue = "D50"; break; - case 24: strValue = "ISO studio tungsten"; break; - case 255: strValue = "ISO studio tungsten"; break; - default: strValue = "other light source"; break; - } - } - break; - case 0x9209: // Flash - { - switch (uintval) - { - case 0x0: strValue = "Flash did not fire"; break; - case 0x1: strValue = "Flash fired"; break; - case 0x5: strValue = "Strobe return light not detected"; break; - case 0x7: strValue = "Strobe return light detected"; break; - case 0x9: strValue = "Flash fired, compulsory flash mode"; break; - case 0xD: strValue = "Flash fired, compulsory flash mode, return light not detected"; break; - case 0xF: strValue = "Flash fired, compulsory flash mode, return light detected"; break; - case 0x10: strValue = "Flash did not fire, compulsory flash mode"; break; - case 0x18: strValue = "Flash did not fire, auto mode"; break; - case 0x19: strValue = "Flash fired, auto mode"; break; - case 0x1D: strValue = "Flash fired, auto mode, return light not detected"; break; - case 0x1F: strValue = "Flash fired, auto mode, return light detected"; break; - case 0x20: strValue = "No flash function"; break; - case 0x41: strValue = "Flash fired, red-eye reduction mode"; break; - case 0x45: strValue = "Flash fired, red-eye reduction mode, return light not detected"; break; - case 0x47: strValue = "Flash fired, red-eye reduction mode, return light detected"; break; - case 0x49: strValue = "Flash fired, compulsory flash mode, red-eye reduction mode"; break; - case 0x4D: strValue = "Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected"; break; - case 0x4F: strValue = "Flash fired, compulsory flash mode, red-eye reduction mode, return light detected"; break; - case 0x59: strValue = "Flash fired, auto mode, red-eye reduction mode"; break; - case 0x5D: strValue = "Flash fired, auto mode, return light not detected, red-eye reduction mode"; break; - case 0x5F: strValue = "Flash fired, auto mode, return light detected, red-eye reduction mode"; break; - default: strValue = "n/a"; break; - } - } - break; - case 0x0128: //ResolutionUnit - { - switch (uintval) - { - case 2: strValue = "Inch"; break; - case 3: strValue = "Centimeter"; break; - default: strValue = "No Unit"; break; - } - } - break; - case 0xA409: // Saturation - { - switch (uintval) - { - case 0: strValue = "Normal"; break; - case 1: strValue = "Low saturation"; break; - case 2: strValue = "High saturation"; break; - default: strValue = "n/a"; break; - } - } - break; - - case 0xA40A: // Sharpness - { - switch (uintval) - { - case 0: strValue = "Normal"; break; - case 1: strValue = "Soft"; break; - case 2: strValue = "Hard"; break; - default: strValue = "n/a"; break; - } - } - break; - case 0xA408: // Contrast - { - switch (uintval) - { - case 0: strValue = "Normal"; break; - case 1: strValue = "Soft"; break; - case 2: strValue = "Hard"; break; - default: strValue = "n/a"; break; - } - } - break; - case 0x103: // Compression - { - switch (uintval) - { - case 1: strValue = "Uncompressed"; break; - case 6: strValue = "JPEG compression (thumbnails only)"; break; - default: strValue = "n/a"; break; - } - } - break; - case 0x106: // PhotometricInterpretation - { - switch (uintval) - { - case 2: strValue = "RGB"; break; - case 6: strValue = "YCbCr"; break; - default: strValue = "n/a"; break; - } - } - break; - case 0x112: // Orientation - { - switch (uintval) - { - case 1: strValue = "The 0th row is at the visual top of the image, and the 0th column is the visual left-hand side."; break; - case 2: strValue = "The 0th row is at the visual top of the image, and the 0th column is the visual right-hand side."; break; - case 3: strValue = "The 0th row is at the visual bottom of the image, and the 0th column is the visual right-hand side."; break; - case 4: strValue = "The 0th row is at the visual bottom of the image, and the 0th column is the visual left-hand side."; break; - case 5: strValue = "The 0th row is the visual left-hand side of the image, and the 0th column is the visual top."; break; - case 6: strValue = "The 0th row is the visual right-hand side of the image, and the 0th column is the visual top."; break; - case 7: strValue = "The 0th row is the visual right-hand side of the image, and the 0th column is the visual bottom."; break; - case 8: strValue = "The 0th row is the visual left-hand side of the image, and the 0th column is the visual bottom."; break; - default: strValue = "n/a"; break; - } - } - break; - case 0x213: // YCbCrPositioning - { - switch (uintval) - { - case 1: strValue = "centered"; break; - case 6: strValue = "co-sited"; break; - default: strValue = "n/a"; break; - } - } - break; - case 0xA001: // ColorSpace - { - switch (uintval) - { - case 1: strValue = "sRGB"; break; - case 0xFFFF: strValue = "Uncalibrated"; break; - default: strValue = "n/a"; break; - } - } - break; - case 0xA401: // CustomRendered - { - switch (uintval) - { - case 0: strValue = "Normal process"; break; - case 1: strValue = "Custom process"; break; - default: strValue = "n/a"; break; - } - } - break; - case 0xA402: // ExposureMode - { - switch (uintval) - { - case 0: strValue = "Auto exposure"; break; - case 1: strValue = "Manual exposure"; break; - case 2: strValue = "Auto bracket"; break; - default: strValue = "n/a"; break; - } - } - break; - case 0xA403: // WhiteBalance - { - switch (uintval) - { - case 0: strValue = "Auto white balance"; break; - case 1: strValue = "Manual white balance"; break; - default: strValue = "n/a"; break; - } - } - break; - case 0xA406: // SceneCaptureType - { - switch (uintval) - { - case 0: strValue = "Standard"; break; - case 1: strValue = "Landscape"; break; - case 2: strValue = "Portrait"; break; - case 3: strValue = "Night scene"; break; - default: strValue = "n/a"; break; - } - } - break; - - case 0xA40C: // SubjectDistanceRange - { - switch (uintval) - { - case 0: strValue = "unknown"; break; - case 1: strValue = "Macro"; break; - case 2: strValue = "Close view"; break; - case 3: strValue = "Distant view"; break; - default: strValue = "n/a"; break; - } - } - break; - case 0x1E: // GPSDifferential - { - switch (uintval) - { - case 0: strValue = "Measurement without differential correction"; break; - case 1: strValue = "Differential correction applied"; break; - default: strValue = "n/a"; break; - } - } - break; - case 0xA405: // FocalLengthIn35mmFilm - strValue = uintval.ToString() + " mm"; - break; - default:// - strValue = uintval.ToString(); - break; - } - #endregion - } - break; - case 0x4: - { - #region 4 = LONG (32-bit unsigned int) - value = BitConverter.ToUInt32(pitem.Value, 0); - strValue = value.ToString(); - #endregion - } - break; - case 0x5: - { - #region 5 = RATIONAL (Two LONGs, unsigned) - - XimgURational rat = new XimgURational(pitem.Value); - value = rat; - switch (pitem.Id) - { - case 0x9202: // ApertureValue - strValue = "F/" + Math.Round(Math.Pow(Math.Sqrt(2), rat.ToDouble()), 2).ToString(); - break; - case 0x9205: // MaxApertureValue - strValue = "F/" + Math.Round(Math.Pow(Math.Sqrt(2), rat.ToDouble()), 2).ToString(); - break; - case 0x920A: // FocalLength - strValue = rat.ToDouble().ToString() + " mm"; - break; - case 0x829D: // F-number - strValue = "F/" + rat.ToDouble().ToString(); - break; - case 0x11A: // Xresolution - strValue = rat.ToDouble().ToString(); - break; - case 0x11B: // Yresolution - strValue = rat.ToDouble().ToString(); - break; - case 0x829A: // ExposureTime - strValue = rat.ToString() + " sec"; - break; - case 0x2: // GPSLatitude - value = new XimgGPSRational(pitem.Value); - strValue = value.ToString(); - break; - case 0x4: // GPSLongitude - value = new XimgGPSRational(pitem.Value); - strValue = value.ToString(); - break; - case 0x6: // GPSAltitude - strValue = rat.ToDouble() + " meters"; - break; - case 0xA404: // Digital Zoom Ratio - strValue = rat.ToDouble().ToString(); - if (strValue == "0") strValue = "none"; - break; - case 0xB: // GPSDOP - strValue = rat.ToDouble().ToString(); - break; - case 0xD: // GPSSpeed - strValue = rat.ToDouble().ToString(); - break; - case 0xF: // GPSTrack - strValue = rat.ToDouble().ToString(); - break; - case 0x11: // GPSImgDir - strValue = rat.ToDouble().ToString(); - break; - case 0x14: // GPSDestLatitude - value = new XimgGPSRational(pitem.Value); - strValue = value.ToString(); - break; - case 0x16: // GPSDestLongitude - value = new XimgGPSRational(pitem.Value); - strValue = value.ToString(); - break; - case 0x18: // GPSDestBearing - strValue = rat.ToDouble().ToString(); - break; - case 0x1A: // GPSDestDistance - strValue = rat.ToDouble().ToString(); - break; - case 0x7: // GPSTimeStamp - value = new XimgGPSRational(pitem.Value); - strValue = (value as XimgGPSRational).ToString(":"); - break; - - default: - strValue = rat.ToString(); - break; - } - - #endregion - } - break; - case 0x7: - { - #region UNDEFINED (8-bit) - value = pitem.Value[0]; - switch (pitem.Id) - { - case 0xA300: //FileSource - { - if (pitem.Value[0] == 3) - strValue = "DSC"; - else - strValue = "n/a"; - break; - } - case 0xA301: //SceneType - if (pitem.Value[0] == 1) - strValue = "A directly photographed image"; - else - strValue = "n/a"; - break; - case 0x9000:// Exif Version - strValue = ascii.GetString(pitem.Value).Trim('\0'); - break; - case 0xA000: // Flashpix Version - strValue = ascii.GetString(pitem.Value).Trim('\0'); - if (strValue == "0100") - strValue = "Flashpix Format Version 1.0"; - else strValue = "n/a"; - break; - case 0x9101: //ComponentsConfiguration - strValue = GetComponentsConfig(pitem.Value); - break; - case 0x927C: //MakerNote - strValue = ascii.GetString(pitem.Value).Trim('\0'); - break; - case 0x9286: //UserComment - strValue = ascii.GetString(pitem.Value).Trim('\0'); - break; - case 0x1B: //GPS Processing Method - strValue = ascii.GetString(pitem.Value).Trim('\0'); - break; - case 0x1C: //GPS Area Info - strValue = ascii.GetString(pitem.Value).Trim('\0'); - break; - default: - strValue = "-"; - break; - } - #endregion - } - break; - case 0x9: - { - #region 9 = SLONG (32-bit int) - value = BitConverter.ToInt32(pitem.Value, 0); - strValue = value.ToString(); - #endregion - } - break; - case 0xA: - { - #region 10 = SRATIONAL (Two SLONGs, signed) - - XimgRational rat = new XimgRational(pitem.Value); - value = rat; - switch (pitem.Id) - { - case 0x9201: // ShutterSpeedValue - strValue = "1/" + Math.Round(Math.Pow(2, rat.ToDouble()), 2).ToString(); - break; - case 0x9203: // BrightnessValue - strValue = Math.Round(rat.ToDouble(), 4).ToString(); - break; - case 0x9204: // ExposureBiasValue - strValue = Math.Round(rat.ToDouble(), 2).ToString() + " eV"; - break; - default: - strValue = rat.ToString(); - break; - } - #endregion - } - break; - } - xTag.Value = value; - xTag.StrValue = strValue; - xTag.ItemType = pitem.Type; - _parseTags.Add(xTag.Id, xTag); - } - } - - /// - /// get data from 0x4, "GPSLongitude" and 0x3, "GPSLongitudeRef", "East or West Longitude" - /// - public double Longitude - { - get - { - if (_parseTags.ContainsKey(0x3) && _parseTags.ContainsKey(0x4)) - { - var value = (_parseTags[0x4].Value as XimgGPSRational).Degrees; - if (_parseTags[0x3].StrValue.ToLower().StartsWith ("w")) - { - value = -value; - } - return value; - } - return double.NaN; - } - } - - /// - /// get value from 0x2, "GPSLatitude" and 0x1, "GPSLatitudeRef", "North or South Latitude") - /// - public double Latitude - { - get - { - if (_parseTags.ContainsKey(0x1) && _parseTags.ContainsKey(0x2)) - { - var value = (_parseTags[0x2].Value as XimgGPSRational).Degrees; - if (_parseTags[0x1].StrValue.ToLower().StartsWith("s")) - { - value = -value; - } - return value; - } - return double.NaN; - } - } - - /// - /// get value from 0x6, "GPSAltitude" - /// - public double Altitude - { - get - { - if (_parseTags.ContainsKey(0x6)) - { - return (_parseTags[0x6].Value as XimgURational).ToDouble(); - } - return double.NaN; - } - } - - /// - /// get value from 0x11, "GPSImgDirection", "Direction of image" - /// - public double ImageBearing - { - get - { - if (_parseTags.ContainsKey(0x11)) - { - return (_parseTags[0x11].Value as XimgURational).ToDouble(); - } - return double.NaN; - } - } - - /// - /// get value from 0x9003, "DateTimeOriginal" - /// - public DateTime DateTimeOriginal - { - get - { - var dateStr = string.Empty; - DateTime dateValue = DateTime.Now; - try - { - if (_parseTags.ContainsKey(0x132)) - { - dateStr = _parseTags[0x132].Value.ToString(); - } - dateValue = DateTime.Parse(dateStr); - Console.WriteLine("'{0}' converted to {1}.", dateStr, dateValue); - } - catch (FormatException) - { - Console.WriteLine("Unable to convert '{0}'.", dateStr); - } - return dateValue; - } - } - - private static Dictionary ParseTags - { - get - { - var parseTags = new Dictionary - { - { 0x100, new XimgTag(0x100, "ImageWidth", "Image width") }, - { 0x101, new XimgTag(0x101, "ImageHeight", "Image height") }, - { 0x0, new XimgTag(0x0, "GPSVersionID", "GPS tag version") }, - { 0x5, new XimgTag(0x5, "GPSAltitudeRef", "Altitude reference") }, - { 0x111, new XimgTag(0x111, "StripOffsets", "Image data location") }, - { 0x116, new XimgTag(0x116, "RowsPerStrip", "Number of rows per strip") }, - { 0x117, new XimgTag(0x117, "StripByteCounts", "Bytes per compressed strip") }, - { 0xA002, new XimgTag(0xA002, "PixelXDimension", "Valid image width") }, - { 0xA003, new XimgTag(0xA003, "PixelYDimension", "Valid image height") }, - { 0x102, new XimgTag(0x102, "BitsPerSample", "Number of bits per component") }, - { 0x103, new XimgTag(0x103, "Compression", "Compression scheme") }, - { 0x106, new XimgTag(0x106, "PhotometricInterpretation", "Pixel composition") }, - { 0x112, new XimgTag(0x112, "Orientation", "Orientation of image") }, - { 0x115, new XimgTag(0x115, "SamplesPerPixel", "Number of components") }, - { 0x11C, new XimgTag(0x11C, "PlanarConfiguration", "Image data arrangement") }, - { 0x212, new XimgTag(0x212, "YCbCrSubSampling", "Subsampling ratio of Y to C") }, - { 0x213, new XimgTag(0x213, "YCbCrPositioning", "Y and C positioning") }, - { 0x128, new XimgTag(0x128, "ResolutionUnit", "Unit of X and Y resolution") }, - { 0x12D, new XimgTag(0x12D, "TransferFunction", "Transfer function") }, - { 0xA001, new XimgTag(0xA001, "ColorSpace", "Color space information") }, - { 0x8822, new XimgTag(0x8822, "ExposureProgram", "Exposure program") }, - { 0x8827, new XimgTag(0x8827, "ISOSpeedRatings", "ISO speed rating") }, - { 0x9207, new XimgTag(0x9207, "MeteringMode", "Metering mode") }, - { 0x9208, new XimgTag(0x9208, "LightSource", "Light source") }, - { 0x9209, new XimgTag(0x9209, "Flash", "Flash") }, - { 0x9214, new XimgTag(0x9214, "SubjectArea", "Subject area") }, - { 0xA210, new XimgTag(0xA210, "FocalPlaneResolutionUnit", "Focal plane resolution unit") }, - { 0xA214, new XimgTag(0xA214, "SubjectLocation", "Subject location") }, - { 0xA217, new XimgTag(0xA217, "SensingMethod", "Sensing method") }, - { 0xA401, new XimgTag(0xA401, "CustomRendered", "Custom image processing") }, - { 0xA402, new XimgTag(0xA402, "ExposureMode", "Exposure mode") }, - { 0xA403, new XimgTag(0xA403, "WhiteBalance", "White balance") }, - { 0xA405, new XimgTag(0xA405, "FocalLengthIn35mmFilm", "Focal length in 35 mm film") }, - { 0xA406, new XimgTag(0xA406, "SceneCaptureType", "Scene capture type") }, - { 0xA408, new XimgTag(0xA408, "Contrast", "Contrast") }, - { 0xA409, new XimgTag(0xA409, "Saturation", "Saturation") }, - { 0xA40A, new XimgTag(0xA40A, "Sharpness", "Sharpness") }, - { 0xA40C, new XimgTag(0xA40C, "SubjectDistanceRange", "Subject distance range") }, - { 0x1E, new XimgTag(0x1E, "GPSDifferential", "GPS differential correction") }, - { 0x9201, new XimgTag(0x9201, "ShutterSpeedValue", "Shutter speed") }, - { 0x9203, new XimgTag(0x9203, "BrightnessValue", "Brightness") }, - { 0x9204, new XimgTag(0x9204, "ExposureBiasValue", "Exposure bias") }, - { 0x201, new XimgTag(0x201, "JPEGInterchangeFormat", "Offset to JPEG SOI") }, - { 0x202, new XimgTag(0x202, "JPEGInterchangeFormatLength", "Bytes of JPEG data") }, - { 0x11A, new XimgTag(0x11A, "XResolution", "Image resolution in width direction") }, - { 0x11B, new XimgTag(0x11B, "YResolution", "Image resolution in height direction") }, - { 0x13E, new XimgTag(0x13E, "WhitePoint", "White point chromaticity") }, - { 0x13F, new XimgTag(0x13F, "PrimaryChromaticities", "Chromaticities of primaries") }, - { 0x211, new XimgTag(0x211, "YCbCrCoefficients", "Color space transformation matrix coefficients") }, - { 0x214, new XimgTag(0x214, "ReferenceBlackWhite", "Pair of black and white reference values") }, - { 0x9102, new XimgTag(0x9102, "CompressedBitsPerPixel", "Image compression mode") }, - { 0x829A, new XimgTag(0x829A, "ExposureTime", "Exposure time") }, - { 0x829D, new XimgTag(0x829D, "FNumber", "F number") }, - { 0x9202, new XimgTag(0x9202, "ApertureValue", "Aperture") }, - { 0x9205, new XimgTag(0x9205, "MaxApertureValue", "Maximum lens aperture") }, - { 0x9206, new XimgTag(0x9206, "SubjectDistance", "Subject distance") }, - { 0x920A, new XimgTag(0x920A, "FocalLength", "Lens focal length") }, - { 0xA404, new XimgTag(0xA404, "DigitalZoomRatio", "Digital zoom ratio") }, - { 0x2, new XimgTag(0x2, "GPSLatitude", "Latitude") }, - { 0x4, new XimgTag(0x4, "GPSLongitude", "Longitude") }, - { 0x6, new XimgTag(0x6, "GPSAltitude", "Altitude") }, - { 0x7, new XimgTag(0x7, "GPSTimeStamp", "GPS time (atomic clock)") }, - { 0xB, new XimgTag(0xB, "GPSDOP", "Measurement precision") }, - { 0xD, new XimgTag(0xD, "GPSSpeed", "Speed of GPS receiver") }, - { 0xF, new XimgTag(0xF, "GPSTrack", "Direction of movement") }, - { 0x11, new XimgTag(0x11, "GPSImgDirection", "Direction of image") }, - { 0x14, new XimgTag(0x14, "GPSDestLatitude", "Latitude of destination") }, - { 0x16, new XimgTag(0x16, "GPSDestLongitude", "Longitude of destination") }, - { 0x18, new XimgTag(0x18, "GPSDestBearing", "Bearing of destination") }, - { 0x1A, new XimgTag(0x1A, "GPSDestDistance", "Distance to destination") }, - { 0x132, new XimgTag(0x132, "DateTime", "File change date and time") }, - { 0x10E, new XimgTag(0x10E, "ImageDescription", "Image title") }, - { 0x10F, new XimgTag(0x10F, "Make", "Image input equipment manufacturer") }, - { 0x110, new XimgTag(0x110, "Model", "Image input equipment model") }, - { 0x131, new XimgTag(0x131, "Software", "Software used") }, - { 0x13B, new XimgTag(0x13B, "Artist", "Person who created the image") }, - { 0x8298, new XimgTag(0x8298, "Copyright", "Copyright holder") }, - { 0xA004, new XimgTag(0xA004, "RelatedSoundFile", "Related audio file") }, - { 0x9003, new XimgTag(0x9003, "DateTimeOriginal", "Date and time of original data generation") }, - { 0x9004, new XimgTag(0x9004, "DateTimeDigitized", "Date and time of digital data generation") }, - { 0x9290, new XimgTag(0x9290, "SubSecTime", "DateTime subseconds") }, - { 0x9291, new XimgTag(0x9291, "SubSecTimeOriginal", "DateTimeOriginal subseconds") }, - { 0x9292, new XimgTag(0x9292, "SubSecTimeDigitized", "DateTimeDigitized subseconds") }, - { 0xA420, new XimgTag(0xA420, "ImageUniqueID", "Unique image ID") }, - { 0x8824, new XimgTag(0x8824, "SpectralSensitivity", "Spectral sensitivity") }, - { 0x1, new XimgTag(0x1, "GPSLatitudeRef", "North or South Latitude") }, - { 0x3, new XimgTag(0x3, "GPSLongitudeRef", "East or West Longitude") }, - { 0x8, new XimgTag(0x8, "GPSSatellites", "GPS satellites used for measurement") }, - { 0x9, new XimgTag(0x9, "GPSStatus", "GPS receiver status") }, - { 0xA, new XimgTag(0xA, "GPSMeasureMode", "GPS measurement mode") }, - { 0xC, new XimgTag(0xC, "GPSSpeedRef", "Speed unit") }, - { 0xE, new XimgTag(0xE, "GPSTrackRef", "Reference for direction of movement") }, - { 0x10, new XimgTag(0x10, "GPSImgDirectionRef", "Reference for direction of image") }, - { 0x12, new XimgTag(0x12, "GPSMapDatum", "Geodetic survey data used") }, - { 0x13, new XimgTag(0x13, "GPSDestLatitudeRef", "Reference for latitude of destination") }, - { 0x15, new XimgTag(0x15, "GPSDestLongitudeRef", "Reference for longitude of destination") }, - { 0x17, new XimgTag(0x17, "GPSDestBearingRef", "Reference for bearing of destination") }, - { 0x19, new XimgTag(0x19, "GPSDestDistanceRef", "Reference for distance to destination") }, - { 0x1D, new XimgTag(0x1D, "GPSDateStamp", "GPS date") }, - { 0xA40B, new XimgTag(0xA40B, "DeviceSettingDescription", "Device settings description") }, - { 0x9000, new XimgTag(0x9000, "ExifVersion", "Exif version") }, - { 0x9286, new XimgTag(0x9286, "UserComment", "User comments") }, - { 0x1B, new XimgTag(0x1B, "GPSProcessingMethod", "Name of GPS processing method") }, - { 0x1C, new XimgTag(0x1C, "GPSAreaInformation", "Name of GPS area") } - }; - return parseTags; - } - } - - #region Private members - private static string GetComponentsConfig(byte[] bytes) - { - string s = ""; - string[] vals = new string[] { "", "Y", "Cb", "Cr", "R", "G", "B" }; - - foreach (byte b in bytes) - s += vals[b]; - - return s; - } - - #endregion - } -} diff --git a/Plugin/ProDataReader/ImageMetadata/XimgTag.cs b/Plugin/ProDataReader/ImageMetadata/XimgTag.cs deleted file mode 100644 index 458c7e12..00000000 --- a/Plugin/ProDataReader/ImageMetadata/XimgTag.cs +++ /dev/null @@ -1,49 +0,0 @@ -/* - - Copyright 2017 Esri - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - - See the License for the specific language governing permissions and - limitations under the License. - -*/ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ImageMetadata -{ - public class XimgTag - { - public XimgTag(int id, string fieldName, string description) - { - Id = id; - Description = description; - FieldName = fieldName; - } - public int Id { get; set; } - public string Description { get; set; } - public string FieldName { get; set; } - public object Value { get; set; } - public string StrValue { get; set; } - public int ItemType { get; set; } - - public override string ToString() - { - return $@"{Description} ({FieldName}) = {StrValue}"; - } - - public XimgTag Clone() => new XimgTag (Id, Description, FieldName); - } -} diff --git a/Plugin/ProDataReader/Images/AddInDesktop16.png b/Plugin/ProDataReader/Images/AddInDesktop16.png deleted file mode 100644 index 5910bbf3..00000000 Binary files a/Plugin/ProDataReader/Images/AddInDesktop16.png and /dev/null differ diff --git a/Plugin/ProDataReader/Images/AddInDesktop32.png b/Plugin/ProDataReader/Images/AddInDesktop32.png deleted file mode 100644 index 1d19084a..00000000 Binary files a/Plugin/ProDataReader/Images/AddInDesktop32.png and /dev/null differ diff --git a/Plugin/ProDataReader/Images/BexDog16.png b/Plugin/ProDataReader/Images/BexDog16.png deleted file mode 100644 index 64f05ef4..00000000 Binary files a/Plugin/ProDataReader/Images/BexDog16.png and /dev/null differ diff --git a/Plugin/ProDataReader/Images/BexDog32.png b/Plugin/ProDataReader/Images/BexDog32.png deleted file mode 100644 index 461fe914..00000000 Binary files a/Plugin/ProDataReader/Images/BexDog32.png and /dev/null differ diff --git a/Plugin/ProDataReader/Images/Folder16.png b/Plugin/ProDataReader/Images/Folder16.png deleted file mode 100644 index 049a3120..00000000 Binary files a/Plugin/ProDataReader/Images/Folder16.png and /dev/null differ diff --git a/Plugin/ProDataReader/Images/Folder32.png b/Plugin/ProDataReader/Images/Folder32.png deleted file mode 100644 index ce4303be..00000000 Binary files a/Plugin/ProDataReader/Images/Folder32.png and /dev/null differ diff --git a/Plugin/ProDataReader/Images/FolderWithGISData16.png b/Plugin/ProDataReader/Images/FolderWithGISData16.png deleted file mode 100644 index ae56a1aa..00000000 Binary files a/Plugin/ProDataReader/Images/FolderWithGISData16.png and /dev/null differ diff --git a/Plugin/ProDataReader/Images/FolderWithGISData32.png b/Plugin/ProDataReader/Images/FolderWithGISData32.png deleted file mode 100644 index 4de95027..00000000 Binary files a/Plugin/ProDataReader/Images/FolderWithGISData32.png and /dev/null differ diff --git a/Plugin/ProDataReader/Images/GenericButtonBlue16.png b/Plugin/ProDataReader/Images/GenericButtonBlue16.png deleted file mode 100644 index ab6cad35..00000000 Binary files a/Plugin/ProDataReader/Images/GenericButtonBlue16.png and /dev/null differ diff --git a/Plugin/ProDataReader/Images/GenericButtonBlue32.png b/Plugin/ProDataReader/Images/GenericButtonBlue32.png deleted file mode 100644 index 4a573fd6..00000000 Binary files a/Plugin/ProDataReader/Images/GenericButtonBlue32.png and /dev/null differ diff --git a/Plugin/ProDataReader/Images/Mdb16.png b/Plugin/ProDataReader/Images/Mdb16.png deleted file mode 100644 index 62208547..00000000 Binary files a/Plugin/ProDataReader/Images/Mdb16.png and /dev/null differ diff --git a/Plugin/ProDataReader/Images/Mdb32.png b/Plugin/ProDataReader/Images/Mdb32.png deleted file mode 100644 index 14995a23..00000000 Binary files a/Plugin/ProDataReader/Images/Mdb32.png and /dev/null differ diff --git a/Plugin/ProDataReader/Images/ZipDetail16.png b/Plugin/ProDataReader/Images/ZipDetail16.png deleted file mode 100644 index 06d94d38..00000000 Binary files a/Plugin/ProDataReader/Images/ZipDetail16.png and /dev/null differ diff --git a/Plugin/ProDataReader/Images/ZipDetail32.png b/Plugin/ProDataReader/Images/ZipDetail32.png deleted file mode 100644 index 7ac04a74..00000000 Binary files a/Plugin/ProDataReader/Images/ZipDetail32.png and /dev/null differ diff --git a/Plugin/ProDataReader/Module1.cs b/Plugin/ProDataReader/Module1.cs deleted file mode 100644 index f35dff88..00000000 --- a/Plugin/ProDataReader/Module1.cs +++ /dev/null @@ -1,97 +0,0 @@ -/* - - Copyright 2017 Esri - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - - See the License for the specific language governing permissions and - limitations under the License. - -*/ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Windows.Input; -using System.Threading.Tasks; -using ArcGIS.Core.CIM; -using ArcGIS.Core.Data; -using ArcGIS.Core.Geometry; -using ArcGIS.Desktop.Catalog; -using ArcGIS.Desktop.Core; -using ArcGIS.Desktop.Editing; -using ArcGIS.Desktop.Extensions; -using ArcGIS.Desktop.Framework; -using ArcGIS.Desktop.Framework.Contracts; -using ArcGIS.Desktop.Framework.Dialogs; -using ArcGIS.Desktop.Framework.Threading.Tasks; -using ArcGIS.Desktop.Mapping; - -namespace ProDataReader -{ - /// - /// ProDataReader implements a three plugin datasources to read the following: - /// - Classic ArcGIS Personal Geodatabase: A personal geodatabase is a Microsoft Access database that can store, query, and manage both spatial and nonspatial data. ProMdbPluginDatasource implements read-only access to personal geodatabase feature class data. - /// - Jpg photos with GPS metadata: smart phone and digital cameras have the option to capture GPS information when a photo is taken. ProJpgPluginDatasource allows to access these GPS enable photos as a read-only feature class. - /// - Gpx data: GPX (the GPS eXchange Format) is a data format for exchanging GPS data between programs and implemented by many GPS tracking devices. ProGpxPluginDatasource allows to access Gpx files as a read-only feature class. - /// - /// - /// 1. Download the Community Sample data (see under the 'Resources' section for downloading sample data) - /// 1. Make sure that the Sample data is unzipped in c:\data - /// 1. The data used in this sample is located in this folder 'C:\Data\TestPersonalGdb' - /// 1. Also in order to access Microsoft Access database files you need to download a 64 bit driver which can be downloaded from Microsoft here: https://www.microsoft.com/en-us/download/details.aspx?id=13255 - /// 1. In Visual Studio click the Build menu. Then select Build Solution. - /// 1. Click Start button to open ArcGIS Pro. - /// 1. In ArcGIS Pro create a new Map using the Empty Map Template. - /// 1. Open the Catalog Dockpane and add new Folder Connection to connect this folder 'C:\Data\TestPersonalGdb' - /// ![UI](Screenshots/Screen1.png) - /// 1. On the Catalog Dockpane open the TestPersonalGdg folder to explore the ProMdb Project Item which allows you to 'drill-down' to the feature class content of ArcGIS personal geodatabases. - /// 1. Open the TestPersonalGdg folder to find the TestPGdb.arcgismdb personal geodatabase. The Personal Geodatabase file extension is usually .mdb, however, ArcGIS Pro doesn't allow project custom items with that extension, hence the renaming of the file extension to ArcGISMdb. - /// ![UI](Screenshots/Screen2.png) - /// 1. In the source code look at the ProMdbProjectItem class, which is used to implement the TestPGdb.arcgismdb node. - /// ![UI](Screenshots/Screen3.png) - /// 1. Under the TestPGdb.arcgismdb node you can see all point/line/polygon feature classes of the personal geodatabase. In source code, the ProMdbTable class is used to prepresent each table. - /// 1. Right clicking on the TestPGdb.arcgismdb node allows to add TestPGdb.arcgismdb as a Project Item. In the source code this is done in AddToProject button class. - /// 1. Right clicking on any of the feature classes allows the feature class to be added to the current map. In the source code this is done in the AddToCurrentMap button class. - /// 1. After you add a ProMdbTable item to the current map, the ProMdbPluginDatasource plug-in is used to convert the MS access table content into a feature class that can be added to a map and displayed as an attribute table. - /// ![UI](Screenshots/Screen5.png) - /// - internal class Module1 : Module - { - private static Module1 _this = null; - - /// - /// Retrieve the singleton instance to this module here - /// - public static Module1 Current - { - get - { - return _this ?? (_this = (Module1)FrameworkApplication.FindModule("ProDataReader_Module")); - } - } - - #region Overrides - /// - /// Called by Framework when ArcGIS Pro is closing - /// - /// False to prevent Pro from closing, otherwise True - protected override bool CanUnload() - { - //TODO - add your business logic - //return false to ~cancel~ Application close - return true; - } - - #endregion Overrides - - } -} diff --git a/Plugin/ProDataReader/ProDataProjectItem.cs b/Plugin/ProDataReader/ProDataProjectItem.cs deleted file mode 100644 index d5f3cc83..00000000 --- a/Plugin/ProDataReader/ProDataProjectItem.cs +++ /dev/null @@ -1,433 +0,0 @@ -/* - - Copyright 2017 Esri - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - - See the License for the specific language governing permissions and - limitations under the License. - -*/ -using System; -using System.Collections.Generic; -using System.IO.Compression; -using System.Linq; -using System.Text; -using System.Drawing.Imaging; -using System.Threading.Tasks; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using ArcGIS.Desktop.Core; -using ArcGIS.Desktop.Editing; -using ESRI.ArcGIS.ItemIndex; -using MetadataExtractor.Formats.Exif; -using MetadataExtractor.Formats.Iptc; -using MetadataExtractor.Formats.Jpeg; -using MetadataExtractor; -using ImageMetadata; -using ProMdbAccessDb; -using System.Runtime.InteropServices; - -namespace ProDataReader -{ - - internal class ProDataProjectItem : CustomProjectItemBase - { - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - [DllImport("kernel32.dll")] - - internal static extern uint GetCurrentThreadId(); - - internal static List FileExtensions = new List { ".mdb", ".gpx", ".jpg" }; - - List _proMdbAccessDbs = new List(); - - protected ProDataProjectItem() : base() - { - } - - protected ProDataProjectItem(ItemInfoValue iiv) : base(FlipBrowseDialogOnly(iiv)) - { - - } - - private static ItemInfoValue FlipBrowseDialogOnly(ItemInfoValue iiv) - { - iiv.browseDialogOnly = "FALSE"; - return iiv; - } - - //TODO: Overload for use in your container create item - public ProDataProjectItem(string name, string catalogPath, string typeID, string containerTypeID) : - base(name, catalogPath, typeID, containerTypeID) - { - - } - - public ProDataProjectItem Clone() => new ProDataProjectItem(this.Name, this.Path, this.TypeID, this.ContainerType); - - /// - /// Dtor - /// - ~ProDataProjectItem() - { - foreach (var db in _proMdbAccessDbs) - { - db.Close(); - } - } - - public override ImageSource LargeImage - { - get - { - var largeImg = new BitmapImage(new Uri(@"pack://application:,,,/ProDataReader;component/Images/ZipDetail32.png")) as ImageSource; - return largeImg; - } - } - - public override Task SmallImage - { - get - { - var smallImage = new BitmapImage(new Uri(@"pack://application:,,,/ProDataReader;component/Images/ZipDetail16.png")) as ImageSource; - if (smallImage == null) throw new ArgumentException("SmallImage for CustomProjectItem doesn't exist"); - return Task.FromResult(smallImage as ImageSource); - } - } - public override ProjectItemInfo OnGetInfo() - { - var projectItemInfo = new ProjectItemInfo - { - Name = this.Name, - Path = this.Path, - Type = ProDataProjectItemContainer.ContainerName - }; - - return projectItemInfo; - } - - public override bool IsContainer => true; - - - - //TODO: Fetch is required if IsContainer = true - public override void Fetch() - { - // Retrieve your child items - // child items must also derive from CustomItemBase - // the CustomDataLink file contains lineitems with link to other folder where our customdata - // is stored - var alreadyProcessedPath = new List(); - var children = new List(); - var dataFolders = System.IO.File.ReadAllLines(this.Path); - for (var idx = 0; idx < dataFolders.Length; idx++) - { - dataFolders[idx] = dataFolders[idx].TrimEnd(new char [] { '\\', '/' }); - } - foreach (var ext in FileExtensions) - { - foreach (var dataFolder in dataFolders) - { - if (string.IsNullOrEmpty(dataFolder)) continue; - var files = System.IO.Directory.GetFiles(dataFolder, $@"*{ext}", System.IO.SearchOption.AllDirectories); - foreach (var fullName in files) - { - var fileName = System.IO.Path.GetFileNameWithoutExtension(fullName); - var fileExt = System.IO.Path.GetExtension(fullName).ToLower(); - switch (fileExt) - { - case ".gpx": - { - var uniquePath = fullName; - var child = new ProDataSubItem(fileName, uniquePath, this.TypeID, - null, ProDataSubItem.EnumSubItemType.GpxType); - children.Add(GetParentFolder(dataFolder, child)); - } - break; - case ".mdb": - { - ProMdbAccessDb.ProMdbAccessDb accessDb = null; - var dbChildren = new List(); - try - { - var fileMdbPath = $@"{fullName}"; - accessDb = new ProMdbAccessDb.ProMdbAccessDb(fileMdbPath); - _proMdbAccessDbs.Add(accessDb); - // child items must also derive from CustomItemBase - var lstTbl = accessDb.GetSpatialTables(); - foreach (var tblName in lstTbl.Keys) - { - // the path has to be 'unique' for each entry otherwise the UI - // will not treat the enumeration as a real enumeration - var uniqueDbPath = System.IO.Path.Combine(fileMdbPath, tblName); - var dbChild = new ProDataSubItem(tblName, uniqueDbPath, this.TypeID, - lstTbl[tblName], ProDataSubItem.EnumSubItemType.MdbType); - dbChildren.Add(dbChild); - } - } - catch (Exception ex) - { - accessDb = null; - throw new Exception($@"Check this download: https://www.microsoft.com/en-us/download/details.aspx?id=13255 Error: {ex.Message}"); - } - if (dbChildren.Count() == 0) break; - var uniquePath = fullName; - var child = new ProDataSubItem(fileName, uniquePath, this.TypeID, - null, ProDataSubItem.EnumSubItemType.MdbType, dbChildren); - children.Add(GetParentFolder(dataFolder, child)); - } - break; - case ".jpg": - { - var ximgInfo = new XimgInfo(fullName); - System.Diagnostics.Debug.WriteLine($@"Image {ximgInfo.IsImage}"); - if (!ximgInfo.IsImage || !ximgInfo.IsGpsEnabled) continue; - - //// Get the PropertyItems property from image. - // the path has to be 'unique' for each entry otherwise the UI - // will not treat the enumeration as a real enumeration - // However in this case we only have one single item - - var parentFolder = System.IO.Path.GetDirectoryName(fullName); - if (dataFolder.Equals(parentFolder)) - { - System.Diagnostics.Debug.WriteLine($@"Lat: {ximgInfo.Latitude} Lon: {ximgInfo.Longitude} Alt: {ximgInfo.Altitude}"); - var uniquePath = fullName; - var child = new ProDataSubItem(fileName, uniquePath, this.TypeID, null, ProDataSubItem.EnumSubItemType.ImgType); - children.Add(GetParentFolder(dataFolder, child)); - } - else - { - // directory full of photos - if (alreadyProcessedPath.Contains(parentFolder)) - { - // already processed this parent folder - - } - else - { - alreadyProcessedPath.Add(parentFolder); - var jpgChildren = new List(); - var jpgFiles = System.IO.Directory.GetFiles(parentFolder, $@"*{ext}", System.IO.SearchOption.TopDirectoryOnly); - foreach (var jpgFullName in jpgFiles) - { - var xInfo = new XimgInfo(jpgFullName); - System.Diagnostics.Debug.WriteLine($@"Image {xInfo.IsImage}"); - if (!xInfo.IsImage || !xInfo.IsGpsEnabled) continue; - jpgChildren.Add(new ProDataSubItem(jpgFullName, jpgFullName, this.TypeID, null, ProDataSubItem.EnumSubItemType.ImgType)); - } - var uniquePath = System.IO.Path.Combine (parentFolder, $@"{System.IO.Path.GetFileName(parentFolder)} Jpgs"); - var name = System.IO.Path.GetFileName(uniquePath); - var rootNode = new ProDataSubItem(name, uniquePath, this.TypeID, null, ProDataSubItem.EnumSubItemType.ImgDirType, jpgChildren); - children.Add(GetParentFolder(dataFolder, rootNode)); - } - } - //var img = System.Drawing.Image.FromStream (fs); - //var propItems = img.PropertyItems; - //foreach (var propItem in propItems) - //{ - // System.Diagnostics.Debug.WriteLine($@"iD: 0x{propItem.Id.ToString("x")}"); - //} - //// see: https://www.exiv2.org/tags.html - //System.Diagnostics.Debug.WriteLine($@"Image Aspect = {img.Width} x {img.Height}"); - //System.Diagnostics.Debug.WriteLine($@"Make = {ReadImageProperty(img, 0x110)}"); - //System.Diagnostics.Debug.WriteLine($@"Date = {ReadImageProperty(img, 0x0132)}"); - - //var gps = ImageMetadataReader.ReadMetadata(fs).OfType().FirstOrDefault(); - //var location = gps.GetGeoLocation(); - //System.Diagnostics.Debug.WriteLine($@"Location: {location.Longitude} {location.Latitude}"); - } - break; - } - } - } - } - this.AddRangeToChildren(children); - } - - /// - /// subItem has a path that needs to be parsed (from the back) in order to build the - /// directory tree. Only the top node of the directory tree (at topNodeName) will be - /// returned and then added to the root. - /// - /// top directory where all data is located - /// Item to be inserted at the end of the branch - /// top node that needs to be added to the root 'data folder' - private ProDataSubItem GetParentFolder(string topNodeName, ProDataSubItem subItem) - { - var parts = topNodeName.Split(new char [] { '/','\\'}); - var rootPartsCnt = parts.Length; - parts = subItem.Path.Split(new char[] { '/', '\\' }); - var topNode = subItem; - for (int idx = parts.Length - 2; idx >= rootPartsCnt; idx--) - { - var completeFolderPath = string.Empty; - for (int iidx = 0; iidx <= idx; iidx++) - { - if (iidx > 0) completeFolderPath += @"\"; - completeFolderPath += parts[iidx]; - } - var uniquePath = System.IO.Path.Combine(Path, completeFolderPath); - topNode = new ProDataSubItem(parts[idx], uniquePath, this.TypeID, - null, ProDataSubItem.EnumSubItemType.DirType, new List { topNode }); - } - return topNode; - } - - private static readonly ASCIIEncoding ASCIIencoding = new ASCIIEncoding(); - - private static string ReadImageProperty(System.Drawing.Image image, int ID) - { - try - { - var pi = image.GetPropertyItem(ID); - if (pi.Type == 2) //ASCII - { - return ASCIIencoding.GetString(pi.Value, 0, pi.Len - 1); - } - if (pi.Type == 5) //rational - { - byte[] bb = pi.Value; - uint uNominator = BitConverter.ToUInt32(bb, 0); - uint uDenominator = BitConverter.ToUInt32(bb, 4); - if (uDenominator == 1) return uNominator.ToString(); - return uNominator.ToString() + "/" + uDenominator.ToString(); - } - } - catch - { - } - return "Not Found"; - } - } - - - internal class ProDataSubItem : CustomItemBase - { - public enum EnumSubItemType - { - DirType = 0, - GpxType = 1, - ImgType = 2, - MdbType = 3, - GpxDirType = 4, - ImgDirType = 5 - } - - public ProDataSubItem(string name, string catalogPath, - string typeID, object specialization, - EnumSubItemType zipSubItemType, - List children = null) : - base(System.IO.Path.GetFileNameWithoutExtension(name), catalogPath, typeID, DateTime.Now.ToString()) - { - ComboPath = name; - SubItemType = zipSubItemType; - this.DisplayType = "Misc GIS Feature Class"; - this.ContextMenuID = "ProDataSubItem_ContextMenu"; - if (children != null) - { - this.AddRangeToChildren(children); - } - Specialization = specialization; - } - - public override bool IsContainer => GetChildren().Count() > 0; - - public string ComboPath { get; set; } - - public object Specialization { get; set; } - - public EnumSubItemType SubItemType { get; set; } - - public override ImageSource LargeImage - { - get - { - var imgSrc = GetIconImage(false); - return imgSrc; - } - } - - public override Task SmallImage - { - get - { - var imgSrc = GetIconImage(true); - return Task.FromResult(imgSrc); - } - } - - private ImageSource GetIconImage(bool bSmall) - { - var size = bSmall ? "16" : "32"; - var imgSrc = System.Windows.Application.Current.Resources[$@"T-Rex{size}"] as ImageSource; - switch (SubItemType) - { - case EnumSubItemType.DirType: - imgSrc = System.Windows.Application.Current.Resources[$@"Folder{size}"] as ImageSource; - break; - case EnumSubItemType.GpxType: - imgSrc = System.Windows.Application.Current.Resources[$@"GeodatabaseFeatureClassLine{size}"] as ImageSource; - break; - case EnumSubItemType.GpxDirType: - break; - case EnumSubItemType.ImgType: - imgSrc = System.Windows.Application.Current.Resources[$@"Image{size}"] as ImageSource; - break; - case EnumSubItemType.ImgDirType: - { - imgSrc = System.Windows.Application.Current.Resources[$@"GeodatabaseMosaicDataset{size}"] as ImageSource; - var fcType = 0; - var proGpxInfo = Specialization as XimgInfo; - if (proGpxInfo != null) fcType = proGpxInfo.GeometryType; - switch (fcType) - { - case 1: - imgSrc = System.Windows.Application.Current.Resources[$@"GeodatabaseFeatureClassPoint{size}"] as ImageSource; - break; - } - } - break; - case EnumSubItemType.MdbType: - { - var fcType = 0; - var proMdbTableInfo = Specialization as ProMdbTableInfo; - if (proMdbTableInfo != null) fcType = proMdbTableInfo.GeometryType; - switch (fcType) - { - case 1: - imgSrc = System.Windows.Application.Current.Resources[$@"GeodatabaseFeatureClassPoint{size}"] as ImageSource; - break; - case 2: - imgSrc = System.Windows.Application.Current.Resources[$@"GeodatabaseFeatureClassMultipoint{size}"] as ImageSource; - break; - case 3: - imgSrc = System.Windows.Application.Current.Resources[$@"GeodatabaseFeatureClassLine{size}"] as ImageSource; - break; - case 4: - imgSrc = System.Windows.Application.Current.Resources[$@"GeodatabaseFeatureClassPolygon{size}"] as ImageSource; - break; - default: - imgSrc = new BitmapImage(new Uri($@"pack://application:,,,/ProDataReader;component/Images/Mdb{size}.png")); - break; - } - } - break; - default: - imgSrc = System.Windows.Application.Current.Resources[$@"T-Rex{size}"] as ImageSource; - break; - } - if (imgSrc == null) throw new ArgumentException($@"Unable to find small image for ProMdbTable"); - return imgSrc; - } - } -} diff --git a/Plugin/ProDataReader/ProDataProjectItemContainer.cs b/Plugin/ProDataReader/ProDataProjectItemContainer.cs deleted file mode 100644 index 671785f5..00000000 --- a/Plugin/ProDataReader/ProDataProjectItemContainer.cs +++ /dev/null @@ -1,81 +0,0 @@ -/* - - Copyright 2017 Esri - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - - See the License for the specific language governing permissions and - limitations under the License. - -*/ -using ArcGIS.Desktop.Core; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Media; -using System.Windows.Media.Imaging; - -namespace ProDataReader -{ - internal class ProDataProjectItemContainer : CustomProjectItemContainer - { - //This should be an arbitrary unique string. It must match your - /// Create item is called whenever a custom item, registered with the container, - /// is browsed or fetched (eg the user is navigating through different folders viewing - /// content in the catalog pane). - /// - /// - /// - /// - /// - /// A custom item created from the input parameters - public override Item CreateItem(string name, string path, string containerType, string data) - { - var item = ItemFactory.Instance.Create(path); - if (item is ProDataProjectItemContainer) - { - this.Add(item as ProDataProjectItem); - } - return item; - } - - public override ImageSource LargeImage - { - get - { - var largeImg = new BitmapImage(new Uri(@"pack://application:,,,/ProDataReader;component/Images/FolderWithGISData32.png")); - return largeImg; - } - } - - public override Task SmallImage - { - get - { - var smallImage = new BitmapImage(new Uri(@"pack://application:,,,/ProDataReader;component/Images/FolderWithGISData16.png")); - if (smallImage == null) throw new ArgumentException("SmallImage for CustomProjectContainer doesn't exist"); - return Task.FromResult(smallImage as ImageSource); - } - } - - } -} diff --git a/Plugin/ProDataReader/ProDataReader (C#).md b/Plugin/ProDataReader/ProDataReader (C#).md deleted file mode 100644 index 2e328ed5..00000000 --- a/Plugin/ProDataReader/ProDataReader (C#).md +++ /dev/null @@ -1,71 +0,0 @@ -## ProDataReader - - -ProDataReader implements a three plugin datasources to read the following: -- Classic ArcGIS Personal Geodatabase: A personal geodatabase is a Microsoft Access database that can store, query, and manage both spatial and nonspatial data. ProMdbPluginDatasource implements read-only access to personal geodatabase feature class data. -- Jpg photos with GPS metadata: smart phone and digital cameras have the option to capture GPS information when a photo is taken. ProJpgPluginDatasource allows to access these GPS enable photos as a read-only feature class. -- Gpx data: GPX (the GPS eXchange Format) is a data format for exchanging GPS data between programs and implemented by many GPS tracking devices. ProGpxPluginDatasource allows to access Gpx files as a read-only feature class. - - - -View it live - - -``` -Language: C# -Subject: Framework -Contributor: ArcGIS Pro SDK Team -Organization: Esri, http://www.esri.com -Date: 6/27/2019 -ArcGIS Pro: 2.4 -Visual Studio: 2019 -.NET Target Framework: 4.7.2 -``` - -## Resources - -* [API Reference online](https://pro.arcgis.com/en/pro-app/sdk/api-reference) -* ArcGIS Pro SDK for .NET (pro.arcgis.com) -* [arcgis-pro-sdk-community-samples](https://github.com/Esri/arcgis-pro-sdk-community-samples) -* [ArcGIS Pro DAML ID Reference](https://github.com/Esri/arcgis-pro-sdk/wiki/ArcGIS-Pro-DAML-ID-Reference) -* [FAQ](https://github.com/Esri/arcgis-pro-sdk/wiki/FAQ) -* [ArcGIS Pro SDK icons](https://github.com/Esri/arcgis-pro-sdk/releases/tag/2.4.0.19948) - -![ArcGIS Pro SDK for .NET Icons](https://Esri.github.io/arcgis-pro-sdk/images/Home/Image-of-icons.png "ArcGIS Pro SDK Icons") - -### Samples Data - -* Sample data for ArcGIS Pro SDK Community Samples can be downloaded from the [repo releases](https://github.com/Esri/arcgis-pro-sdk-community-samples/releases) page. - -## How to use the sample - -1. Download the Community Sample data (see under the 'Resources' section for downloading sample data) -1. Make sure that the Sample data is unzipped in c:\data -1. The data used in this sample is located in this folder 'C:\Data\TestPersonalGdb' -1. Also in order to access Microsoft Access database files you need to download a 64 bit driver which can be downloaded from Microsoft here: https://www.microsoft.com/en-us/download/details.aspx?id=13255 -1. In Visual Studio click the Build menu. Then select Build Solution. -1. Click Start button to open ArcGIS Pro. -1. In ArcGIS Pro create a new Map using the Empty Map Template. -1. Open the Catalog Dockpane and add new Folder Connection to connect this folder 'C:\Data\TestPersonalGdb' -![UI](Screenshots/Screen1.png) - -1. On the Catalog Dockpane open the TestPersonalGdg folder to explore the ProMdb Project Item which allows you to 'drill-down' to the feature class content of ArcGIS personal geodatabases. -1. Open the TestPersonalGdg folder to find the TestPGdb.arcgismdb personal geodatabase. The Personal Geodatabase file extension is usually .mdb, however, ArcGIS Pro doesn't allow project custom items with that extension, hence the renaming of the file extension to ArcGISMdb. -![UI](Screenshots/Screen2.png) - -1. In the source code look at the ProMdbProjectItem class, which is used to implement the TestPGdb.arcgismdb node. -![UI](Screenshots/Screen3.png) - -1. Under the TestPGdb.arcgismdb node you can see all point/line/polygon feature classes of the personal geodatabase. In source code, the ProMdbTable class is used to prepresent each table. -1. Right clicking on the TestPGdb.arcgismdb node allows to add TestPGdb.arcgismdb as a Project Item. In the source code this is done in AddToProject button class. -1. Right clicking on any of the feature classes allows the feature class to be added to the current map. In the source code this is done in the AddToCurrentMap button class. -1. After you add a ProMdbTable item to the current map, the ProMdbPluginDatasource plug-in is used to convert the MS access table content into a feature class that can be added to a map and displayed as an attribute table. -![UI](Screenshots/Screen5.png) - - - - - -      ArcGIS Pro SDK for Microsoft .NET Framework -             -[Home](https://github.com/Esri/arcgis-pro-sdk/wiki) | API Reference | [Requirements](https://github.com/Esri/arcgis-pro-sdk/wiki#requirements) | [Download](https://github.com/Esri/arcgis-pro-sdk/wiki#installing-arcgis-pro-sdk-for-net) | Samples diff --git a/Plugin/ProDataReader/ProDataReader.csproj b/Plugin/ProDataReader/ProDataReader.csproj deleted file mode 100644 index ec626853..00000000 --- a/Plugin/ProDataReader/ProDataReader.csproj +++ /dev/null @@ -1,245 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {E74A0802-C331-4183-806D-0757122D8733} - Library - Properties - ProDataReader - ProDataReader - v4.7.2 - 512 - {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - Program - C:\Program Files\ArcGIS\Pro\bin\ArcGISPro.exe - AnyCPU - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - Program - C:\Program Files\ArcGIS\Pro\bin\ArcGISPro.exe - AnyCPU - - - $([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\ESRI\ArcGISPro', 'InstallDir', null, RegistryView.Registry64)) - $(registry:HKEY_CURRENT_USER\SOFTWARE\ESRI\ArcGISPro@InstallDir) - - - - - - - - - - - - - - - - - C:\Program Files\ArcGIS\Pro\bin\ArcGIS.Desktop.Framework.dll - False - - - C:\Program Files\ArcGIS\Pro\bin\ArcGIS.Core.dll - False - - - C:\Program Files\ArcGIS\Pro\bin\Extensions\Core\ArcGIS.Desktop.Core.dll - False - - - C:\Program Files\ArcGIS\Pro\bin\Extensions\Mapping\ArcGIS.Desktop.Mapping.dll - False - - - C:\Program Files\ArcGIS\Pro\bin\Extensions\Catalog\ArcGIS.Desktop.Catalog.dll - False - - - C:\Program Files\ArcGIS\Pro\bin\Extensions\Editing\ArcGIS.Desktop.Editing.dll - False - - - C:\Program Files\ArcGIS\Pro\bin\Extensions\DesktopExtensions\ArcGIS.Desktop.Extensions.dll - False - - - C:\Program Files\ArcGIS\Pro\bin\Extensions\GeoProcessing\ArcGIS.Desktop.GeoProcessing.dll - False - - - C:\Program Files\ArcGIS\Pro\bin\Extensions\Layout\ArcGIS.Desktop.Layouts.dll - False - - - C:\Program Files\ArcGIS\Pro\bin\ArcGIS.Desktop.Shared.Wpf.dll - False - - - C:\Program Files\ArcGIS\Pro\bin\ArcGIS.Desktop.Ribbon.Wpf.dll - False - - - C:\Program Files\ArcGIS\Pro\bin\ArcGIS.Desktop.DataGrid.Contrib.Wpf.dll - False - - - C:\Program Files\ArcGIS\Pro\bin\ArcGIS.Desktop.Resources.dll - False - - - C:\Program Files\ArcGIS\Pro\bin\ArcGIS.Desktop.Resources.dll - False - - - C:\Program Files\ArcGIS\Pro\bin\ESRI.ArcGIS.ItemIndex.dll - False - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {270b962c-93e5-473f-b502-d05d639cc51d} - ImageMetadata - - - {00b0aac0-bf42-44d6-8638-15b563782ce2} - MdbAccessDb - - - - - - - - - - - - - 2.1.0 - - - - - - - - - - - - BuildDefault - bin\Debug\ProDataReader.xml - 1591 - - - BuildDefault - - - - - - - - - \ No newline at end of file diff --git a/Plugin/ProDataReader/ProDataReader.sln b/Plugin/ProDataReader/ProDataReader.sln deleted file mode 100644 index 782b6f0e..00000000 --- a/Plugin/ProDataReader/ProDataReader.sln +++ /dev/null @@ -1,60 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.28803.352 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProDataReader", "ProDataReader.csproj", "{E74A0802-C331-4183-806D-0757122D8733}" - ProjectSection(ProjectDependencies) = postProject - {3DE57E08-5EF4-47E7-9C11-569061FDA3D5} = {3DE57E08-5EF4-47E7-9C11-569061FDA3D5} - {6E6E1223-1FCC-45AF-AB6F-AA65299EC84B} = {6E6E1223-1FCC-45AF-AB6F-AA65299EC84B} - {98666CC8-996F-49CF-81F4-03EFB4C941FC} = {98666CC8-996F-49CF-81F4-03EFB4C941FC} - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProGpxPluginDatasource", "ProGfxPluginDatasource\ProGpxPluginDatasource.csproj", "{98666CC8-996F-49CF-81F4-03EFB4C941FC}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImageMetadata", "ImageMetadata\ImageMetadata.csproj", "{270B962C-93E5-473F-B502-D05D639CC51D}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProJpgPluginDatasource", "ProJpgPluginDatasource\ProJpgPluginDatasource.csproj", "{3DE57E08-5EF4-47E7-9C11-569061FDA3D5}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MdbAccessDb", "ProMdbAccessDb\MdbAccessDb.csproj", "{00B0AAC0-BF42-44D6-8638-15B563782CE2}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProMdbPluginDatasource", "ProMdbPluginDatasource\ProMdbPluginDatasource.csproj", "{6E6E1223-1FCC-45AF-AB6F-AA65299EC84B}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {E74A0802-C331-4183-806D-0757122D8733}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E74A0802-C331-4183-806D-0757122D8733}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E74A0802-C331-4183-806D-0757122D8733}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E74A0802-C331-4183-806D-0757122D8733}.Release|Any CPU.Build.0 = Release|Any CPU - {98666CC8-996F-49CF-81F4-03EFB4C941FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {98666CC8-996F-49CF-81F4-03EFB4C941FC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {98666CC8-996F-49CF-81F4-03EFB4C941FC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {98666CC8-996F-49CF-81F4-03EFB4C941FC}.Release|Any CPU.Build.0 = Release|Any CPU - {270B962C-93E5-473F-B502-D05D639CC51D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {270B962C-93E5-473F-B502-D05D639CC51D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {270B962C-93E5-473F-B502-D05D639CC51D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {270B962C-93E5-473F-B502-D05D639CC51D}.Release|Any CPU.Build.0 = Release|Any CPU - {3DE57E08-5EF4-47E7-9C11-569061FDA3D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3DE57E08-5EF4-47E7-9C11-569061FDA3D5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3DE57E08-5EF4-47E7-9C11-569061FDA3D5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3DE57E08-5EF4-47E7-9C11-569061FDA3D5}.Release|Any CPU.Build.0 = Release|Any CPU - {00B0AAC0-BF42-44D6-8638-15B563782CE2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {00B0AAC0-BF42-44D6-8638-15B563782CE2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {00B0AAC0-BF42-44D6-8638-15B563782CE2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {00B0AAC0-BF42-44D6-8638-15B563782CE2}.Release|Any CPU.Build.0 = Release|Any CPU - {6E6E1223-1FCC-45AF-AB6F-AA65299EC84B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6E6E1223-1FCC-45AF-AB6F-AA65299EC84B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6E6E1223-1FCC-45AF-AB6F-AA65299EC84B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6E6E1223-1FCC-45AF-AB6F-AA65299EC84B}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {C63C718E-DC20-4B01-8177-F5DF27BC01BB} - EndGlobalSection -EndGlobal diff --git a/Plugin/ProDataReader/ProGfxPluginDatasource/Config.xml b/Plugin/ProDataReader/ProGfxPluginDatasource/Config.xml deleted file mode 100644 index 5a91dcc9..00000000 --- a/Plugin/ProDataReader/ProGfxPluginDatasource/Config.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - ProGpxPluginDatasource - {98666cc8-996f-49cf-81f4-03efb4c941fc} - ProGpxPluginDatasource description - 1.0 - ArcGIS Pro SDK Team, arcgisprosdk@esri.com - esri, http://www.esri.com - 5/9/2019 5:44:44 AM, 2019 - - - - - - - - - - - - \ No newline at end of file diff --git a/Plugin/ProDataReader/ProGfxPluginDatasource/ProGpxPluginCursorTemplate.cs b/Plugin/ProDataReader/ProGfxPluginDatasource/ProGpxPluginCursorTemplate.cs deleted file mode 100644 index 11b6b0d7..00000000 --- a/Plugin/ProDataReader/ProGfxPluginDatasource/ProGpxPluginCursorTemplate.cs +++ /dev/null @@ -1,74 +0,0 @@ -/* - - Copyright 2017 Esri - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - - See the License for the specific language governing permissions and - limitations under the License. - -*/ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using ArcGIS.Core.Data; -using ArcGIS.Core.Data.PluginDatastore; -using ArcGIS.Core.Geometry; - -namespace ProGpxPluginDatasource -{ - public class ProGpxPluginCursorTemplate : PluginCursorTemplate - { - private Queue _oids; - private IEnumerable _columns; - private SpatialReference _srout; - private IPluginRowProvider _provider; - private int CurrentId { get; set; } - private static readonly object _lock = new object(); - - internal ProGpxPluginCursorTemplate(IPluginRowProvider provider, IEnumerable oids, - IEnumerable columns, SpatialReference srout) - { - _provider = provider; - _oids = new Queue(oids); - _columns = columns; - _srout = srout; - CurrentId = -1; - } - public override PluginRow GetCurrentRow() - { - int id = -1; - //The lock shouldn't be necessary if your cursor is a per thread instance - //(like the sample is) - lock (_lock) - { - id = CurrentId; - } - return _provider.FindRow(id, _columns, _srout); - } - - public override bool MoveNext() - { - if (_oids.Count == 0) - return false; - - //The lock shouldn't be necessary if your cursor is a per thread instance - //(like the sample is) - lock (_lock) - { - CurrentId = _oids.Dequeue(); - } - return true; - } - } -} diff --git a/Plugin/ProDataReader/ProGfxPluginDatasource/ProGpxPluginDatasource.csproj b/Plugin/ProDataReader/ProGfxPluginDatasource/ProGpxPluginDatasource.csproj deleted file mode 100644 index 4476c0a3..00000000 --- a/Plugin/ProDataReader/ProGfxPluginDatasource/ProGpxPluginDatasource.csproj +++ /dev/null @@ -1,101 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {98666CC8-996F-49CF-81F4-03EFB4C941FC} - Library - Properties - ProGpxPluginDatasource - ProGpxPluginDatasource - v4.7.2 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - Program - C:\Program Files\ArcGIS\Pro\bin\ArcGISPro.exe - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - Program - C:\Program Files\ArcGIS\Pro\bin\ArcGISPro.exe - - - $([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\ESRI\ArcGISPro', 'InstallDir', null, RegistryView.Registry64)) - $(registry:HKEY_CURRENT_USER\SOFTWARE\ESRI\ArcGISPro@InstallDir) - - - - - - - - - - - C:\Program Files\ArcGIS\Pro\bin\ArcGIS.Core.dll - False - - - C:\Program Files\ArcGIS\Pro\bin\ArcGIS.CoreHost.dll - False - - - - - - - - - - - - - - - - - - - BuildDefault - 1591 - - - BuildDefault - - - Plugin - - - - - - \ No newline at end of file diff --git a/Plugin/ProDataReader/ProGfxPluginDatasource/ProGpxPluginDatasourceTemplate.cs b/Plugin/ProDataReader/ProGfxPluginDatasource/ProGpxPluginDatasourceTemplate.cs deleted file mode 100644 index 9b3321ac..00000000 --- a/Plugin/ProDataReader/ProGfxPluginDatasource/ProGpxPluginDatasourceTemplate.cs +++ /dev/null @@ -1,95 +0,0 @@ -/* - - Copyright 2017 Esri - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - - See the License for the specific language governing permissions and - limitations under the License. - -*/ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.InteropServices; -using System.Text; -using System.Threading.Tasks; -using ArcGIS.Core.Data; -using ArcGIS.Core.Data.PluginDatastore; -using ArcGIS.Core.Geometry; - -namespace ProGpxPluginDatasource -{ - public class ProGpxPluginDatasourceTemplate : PluginDatasourceTemplate - { - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - [DllImport("kernel32.dll")] - - internal static extern uint GetCurrentThreadId(); - - private string _filePath = ""; - private uint _threadId; - - private Dictionary _tables; - - public override void Open(Uri connectionPath) - { - //TODO Initialize your plugin instance. Individual instances - //of your plugin may be initialized on different threads - if (!System.IO.File.Exists(connectionPath.LocalPath)) - { - throw new System.IO.FileNotFoundException(connectionPath.LocalPath); - } - //initialize - //Strictly speaking, tracking your thread id is only necessary if - //your implementation uses internals that have thread affinity. - _threadId = GetCurrentThreadId(); - _tables = new Dictionary(); - _filePath = connectionPath.LocalPath; - } - - public override void Close() - { - if (_tables == null) return; - //Dispose of any cached table instances here - foreach (var table in _tables.Values) - { - ((ProGpxPluginTableTemplate)table).Dispose(); - } - _tables.Clear(); - } - - public override PluginTableTemplate OpenTable(string tableName) - { - if (!this.GetTableNames().Contains(tableName)) - throw new GeodatabaseTableException($"The table {tableName} was not found"); - return _tables[tableName]; - } - - public override IReadOnlyList GetTableNames() - { - if (_tables.Count > 0) return _tables.Keys.ToList(); - var tableName = System.IO.Path.GetFileNameWithoutExtension(_filePath); - if (System.IO.File.Exists(_filePath)) - { - // there is only one 'table' which is the one gpx file - _tables.Add(tableName, new ProGpxPluginTableTemplate(_filePath)); - } - return _tables.Keys.ToList(); - } - - public override bool IsQueryLanguageSupported() - { - //default is false - return true; - } - } -} diff --git a/Plugin/ProDataReader/ProGfxPluginDatasource/ProGpxPluginTableTemplate.cs b/Plugin/ProDataReader/ProGfxPluginDatasource/ProGpxPluginTableTemplate.cs deleted file mode 100644 index 868a4660..00000000 --- a/Plugin/ProDataReader/ProGfxPluginDatasource/ProGpxPluginTableTemplate.cs +++ /dev/null @@ -1,457 +0,0 @@ -/* - - Copyright 2017 Esri - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - - See the License for the specific language governing permissions and - limitations under the License. - -*/ -using System; -using System.Collections.Generic; -using System.Data; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Xml; -using ArcGIS.Core.Data; -using ArcGIS.Core.Data.PluginDatastore; -using ArcGIS.Core.Geometry; - -namespace ProGpxPluginDatasource -{ - /// - /// (Custom) interface the sample uses to extract row information from the - /// plugin table - /// - internal interface IPluginRowProvider - { - PluginRow FindRow(int oid, IEnumerable columnFilter, SpatialReference sr); - } - - - public class ProGpxPluginTableTemplate : PluginTableTemplate, IDisposable, IPluginRowProvider - { - private readonly DataTable _dataTable = new DataTable(); - private readonly string _gpxFilePath; - private readonly SpatialReference _spatialReference; - private readonly string _tableName; - private Envelope _gisExtent; - - private const string GeometryFieldName = "Shape"; - private const string ObjectIdFieldName = "ObjectId"; - private const string LongFieldName = "Longitude"; - private const string LatFieldName = "Latitude"; - private const string AltFieldName = "Altitude"; - private const string NameFieldName = "Name"; - private const string CreatorFieldName = "Creator"; - private const string CreatorVersionFieldName = "CreatorVersion"; - private const string TypeFieldName = "ActivityType"; - private const string DateTimeFieldName = "ActivityDate"; - - private List _pluginFields = null; - - /// - /// Ctor using path that points to the gdf file - /// - /// path to gdx file - public ProGpxPluginTableTemplate(string gpxFilePath) - { - this._gpxFilePath = gpxFilePath; - this._tableName = System.IO.Path.GetFileNameWithoutExtension (gpxFilePath); - this._spatialReference = SpatialReferences.WGS84; - CreateTable(this._tableName, this._gpxFilePath); - } - - public override IReadOnlyList GetFields() - { - if (_pluginFields == null) - { - _pluginFields = new List(); - foreach (var col in _dataTable.Columns.Cast()) - { - // TODO: process all field types here ... this list is not complete - var fieldType = FieldType.String; - System.Diagnostics.Debug.WriteLine($@"{col.ColumnName} {col.DataType}"); - if (col.ColumnName == ObjectIdFieldName || - col.ColumnName == GeometryFieldName) - { - fieldType = col.ColumnName == GeometryFieldName ? FieldType.Geometry : FieldType.OID; - } - else - { - switch (col.DataType.Name) - { - case nameof(DateTime): - fieldType = FieldType.Date; - break; - case nameof(Double): - fieldType = FieldType.Double; - break; - case nameof(Int16): - fieldType = FieldType.Integer; - break; - case nameof(Int32): - fieldType = FieldType.Integer; - break; - case nameof(Guid): - fieldType = FieldType.GUID; - break; - case nameof(String): - fieldType = FieldType.String; - break; - case nameof(Single): - fieldType = FieldType.Single; - break; - default: - System.Diagnostics.Debug.WriteLine($@"Unsupported datatype: {col.DataType.Name} not mapped"); - break; - } - } - _pluginFields.Add(new PluginField() - { - Name = col.ColumnName, - AliasName = col.ColumnName, - FieldType = fieldType - }); - } - } - return _pluginFields; - } - - public override string GetName() - { - return _tableName; - } - - public override PluginCursorTemplate Search(QueryFilter queryFilter) => - this.SearchInternal(queryFilter); - - public override PluginCursorTemplate Search(SpatialQueryFilter spatialQueryFilter) => - this.SearchInternal(spatialQueryFilter); - - public override GeometryType GetShapeType() - { - return GeometryType.Polyline; - } - - /// - /// Get the extent for the dataset (if it has one) - /// - /// Ideally, your plugin table should return an extent even if it is - /// empty - /// - public override Envelope GetExtent() { return _gisExtent; } - - #region Internal Functions - - private void CreateTable(string tableName, string filePath) - { - _dataTable.TableName = tableName; - var oidCol = new DataColumn(ObjectIdFieldName, typeof(Int32)) - { - AutoIncrement = true, - AutoIncrementSeed = 1 - }; - _dataTable.Columns.Add(oidCol); - _dataTable.PrimaryKey = new DataColumn[] { oidCol }; - _dataTable.Columns.Add(new DataColumn(GeometryFieldName, typeof(ArcGIS.Core.Geometry.Geometry))); - _dataTable.Columns.Add(new DataColumn(LongFieldName, typeof(Double))); - _dataTable.Columns.Add(new DataColumn(LatFieldName, typeof(Double))); - _dataTable.Columns.Add(new DataColumn(AltFieldName, typeof(Double))); - _dataTable.Columns.Add(new DataColumn(TypeFieldName, typeof(string))); - _dataTable.Columns.Add(new DataColumn(DateTimeFieldName, typeof(DateTime))); - _dataTable.Columns.Add(new DataColumn(NameFieldName, typeof(string))); - _dataTable.Columns.Add(new DataColumn(CreatorFieldName, typeof(string))); - _dataTable.Columns.Add(new DataColumn(CreatorVersionFieldName, typeof(string))); - - XmlDocument xmlDoc = new XmlDocument(); - xmlDoc.Load(filePath); - string xmlns = xmlDoc.DocumentElement.NamespaceURI; - XmlNamespaceManager nmsp = new XmlNamespaceManager(xmlDoc.NameTable); - nmsp.AddNamespace("x", xmlns); - DateTime dateValue = DateTime.Now; - XmlNodeList nodeList = xmlDoc.DocumentElement.SelectNodes(@"//x:gpx/x:metadata/x:time", nmsp); - if (nodeList.Count > 0) - { - var dateStr = nodeList[0].InnerText; - try - { - dateValue = DateTime.Parse(dateStr); - Console.WriteLine("'{0}' converted to {1}.", dateStr, dateValue); - } - catch (FormatException) - { - Console.WriteLine("Unable to convert '{0}'.", dateStr); - } - } - var creator = string.Empty; - var creatorVersion = string.Empty; - nodeList = xmlDoc.DocumentElement.SelectNodes(@"//x:gpx", nmsp); - if (nodeList.Count > 0) - { - var node = nodeList[0]; - foreach (XmlAttribute attr in node.Attributes) - { - switch (attr.Name) { - case "creator": - creator = attr.Value; - break; - case "version": - creatorVersion = attr.Value; - break; - } - - } - } - var activityName = string.Empty; - var activityType = string.Empty; - nodeList = xmlDoc.DocumentElement.SelectNodes("/x:gpx/x:trk/x:name", nmsp); - if (nodeList.Count > 0) activityName = nodeList[0].InnerText; - nodeList = xmlDoc.DocumentElement.SelectNodes("/x:gpx/x:trk/x:type", nmsp); - if (nodeList.Count > 0) activityType = nodeList[0].InnerText; - - var newRow = _dataTable.NewRow(); - newRow[ObjectIdFieldName] = 1; - // let's make a 3d line shape - List lst3DCoords = new List(); - double lng = 0.0, lat = 0.0, ele = 0.0; - nodeList = xmlDoc.DocumentElement.SelectNodes("/x:gpx/x:trk/x:trkseg/x:trkpt", nmsp); - foreach (XmlNode node in nodeList) - { - lng = double.Parse(node.Attributes["lon"].Value); - lat = double.Parse(node.Attributes["lat"].Value); - foreach (XmlNode childNode in node.ChildNodes) - { - if (childNode.Name.Equals("ele")) - { - ele = double.Parse(childNode.InnerText); - } - } - lst3DCoords.Add(new Coordinate3D(lng, lat, ele)); - } - var pl = PolylineBuilder.CreatePolyline(lst3DCoords, _spatialReference); - newRow[GeometryFieldName] = pl; - newRow[LongFieldName] = lng; - newRow[LatFieldName] = lat; - newRow[AltFieldName] = ele; - newRow[DateTimeFieldName] = dateValue; - newRow[TypeFieldName] = activityType; - newRow[NameFieldName] = activityName; - newRow[CreatorFieldName] = creator; - newRow[CreatorVersionFieldName] = creatorVersion; - _dataTable.Rows.Add(newRow); - _gisExtent = _gisExtent == null - ? pl.Extent : _gisExtent.Union(pl.Extent); - } - - private PluginCursorTemplate SearchInternal(QueryFilter qf) - { - var oids = this.ExecuteQuery(qf); - var columns = this.GetQuerySubFields(qf); - - return new ProGpxPluginCursorTemplate(this, - oids, - columns, - qf.OutputSpatialReference); - } - - /// - /// Implement querying with a query filter - /// - /// - /// - private List ExecuteQuery(QueryFilter qf) - { - List result = new List(); - SpatialQueryFilter sqf = null; - if (qf is SpatialQueryFilter) - { - sqf = qf as SpatialQueryFilter; - } - var whereClause = string.Empty; - if (!string.IsNullOrEmpty(qf.WhereClause)) - { - whereClause = qf.WhereClause; - } - else - { - if (qf.ObjectIDs.Count() > 0) - { - whereClause = $@"{ObjectIdFieldName} in ({string.Join(",", qf.ObjectIDs)})"; - } - } - var subFields = string.IsNullOrEmpty(qf.SubFields) ? "*" : qf.SubFields; - var selectRows = _dataTable.Select(whereClause, qf.PostfixClause); - int recCount = selectRows.Length; - if (sqf == null) - { - result = _dataTable.AsEnumerable().Select(row => (int)row[ObjectIdFieldName]).ToList(); - } - else - { - result = _dataTable.AsEnumerable().Where(Row => CheckSpatialQuery(sqf, Row[GeometryFieldName] as Geometry)).Select(row => (int)row[ObjectIdFieldName]).ToList(); - } - return result; - } - - private bool CheckSpatialQuery(SpatialQueryFilter sqf, Geometry geom) - { - if (geom == null) - { - return false; - } - return HasRelationship(GeometryEngine.Instance, - sqf.FilterGeometry, geom, sqf.SpatialRelationship); - } - - internal static bool HasRelationship(IGeometryEngine engine, - Geometry geom1, - Geometry geom2, - SpatialRelationship relationship) - { - switch (relationship) - { - case SpatialRelationship.Intersects: - return engine.Intersects(geom1, geom2); - case SpatialRelationship.IndexIntersects: - return engine.Intersects(geom1, geom2); - case SpatialRelationship.EnvelopeIntersects: - return engine.Intersects(geom1.Extent, geom2.Extent); - case SpatialRelationship.Contains: - return engine.Contains(geom1, geom2); - case SpatialRelationship.Crosses: - return engine.Crosses(geom1, geom2); - case SpatialRelationship.Overlaps: - return engine.Overlaps(geom1, geom2); - case SpatialRelationship.Touches: - return engine.Touches(geom1, geom2); - case SpatialRelationship.Within: - return engine.Within(geom1, geom2); - } - return false;//unknown relationship - } - - private List GetQuerySubFields(QueryFilter qf) - { - //Honor Subfields in Query Filter - string columns = qf.SubFields ?? "*"; - List subFields; - if (columns == "*") - { - subFields = this.GetFields().Select(col => col.Name.ToUpper()).ToList(); - } - else - { - var names = columns.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); - subFields = names.Select(n => n.ToUpper()).ToList(); - } - - return subFields; - } - - #endregion Internal Functions - - #region IPluginRowProvider - - /// - /// Find a given row (using Object ID) and retrieve attributes using columnFilter and output spatial reference - /// - /// Search for this record using this Object ID - /// List of Column Names to be returned - /// project spatial data using this output spatial reference - /// PlugInRow - public PluginRow FindRow(int oid, IEnumerable columnFilter, SpatialReference srout) - { - Geometry shape = null; - List values = new List(); - var row = _dataTable.Rows.Find(oid); - //The order of the columns in the returned rows ~must~ match - //GetFields. If a column is filtered out, an empty placeholder must - //still be provided even though the actual value is skipped - var columnNames = this.GetFields().Select(col => col.Name.ToUpper()).ToList(); - foreach (var colName in columnNames) - { - if (columnFilter.Contains(colName)) - { - //special handling for shape - if (colName == GeometryFieldName) - { - shape = row[GeometryFieldName] as Geometry; - if (srout != null) - { - if (!srout.Equals(_spatialReference)) - shape = GeometryEngine.Instance.Project(shape, srout); - } - values.Add(shape); - } - else - { - values.Add(row[colName]); - } - } - else - { - values.Add(System.DBNull.Value);//place holder - } - } - return new PluginRow() { Values = values }; - } - - #endregion IPluginRowProvider - - #region IDisposable Support - - private bool disposedValue = false; // To detect redundant calls - - /// - /// Clean up resources - /// - /// - protected virtual void Dispose(bool disposing) - { - if (!disposedValue) - { - if (_dataTable == null) - return; - - if (disposing) - { - _dataTable?.Clear(); - _gisExtent = null; - } - disposedValue = true; - } - } - - // TODO: override a finalizer only if Dispose(bool disposing) above has code to free unmanaged resources. - // ~ProPluginTableTemplate() - // { - // // Do not change this code. Put cleanup code in Dispose(bool disposing) above. - // Dispose(false); - // } - - /// - /// This code added to correctly implement the disposable pattern. - /// - public void Dispose() - { - // Do not change this code. Put cleanup code in Dispose(bool disposing) above. - Dispose(true); - // TODO: uncomment the following line if the finalizer is overridden above. - // GC.SuppressFinalize(this); - } - - #endregion - - } -} diff --git a/Plugin/ProDataReader/ProGfxPluginDatasource/Properties/AssemblyInfo.cs b/Plugin/ProDataReader/ProGfxPluginDatasource/Properties/AssemblyInfo.cs deleted file mode 100644 index 14d6042f..00000000 --- a/Plugin/ProDataReader/ProGfxPluginDatasource/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,54 +0,0 @@ -/* - - Copyright 2017 Esri - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - - See the License for the specific language governing permissions and - limitations under the License. - -*/ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("ProGpxPluginDatasource")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Acme")] -[assembly: AssemblyProduct("ProGpxPluginDatasource")] -[assembly: AssemblyCopyright("Copyright © Acme 2019")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("98666cc8-996f-49cf-81f4-03efb4c941fc")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Plugin/ProDataReader/ProJpgPluginDatasource/Config.xml b/Plugin/ProDataReader/ProJpgPluginDatasource/Config.xml deleted file mode 100644 index c531eb6a..00000000 --- a/Plugin/ProDataReader/ProJpgPluginDatasource/Config.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - ProJpgPluginDatasource - {3de57e08-5ef4-47e7-9c11-569061fda3d5} - ProJpg Plugin Datasource - 1.0 - ArcGIS Pro SDK Team, arcgisprosdk@esri.com - esri, http://www.esri.com - 5/9/2019 5:49:16 AM, 2019 - - - - - - - - - - - - \ No newline at end of file diff --git a/Plugin/ProDataReader/ProJpgPluginDatasource/ProJpgPluginCursorTemplate.cs b/Plugin/ProDataReader/ProJpgPluginDatasource/ProJpgPluginCursorTemplate.cs deleted file mode 100644 index 1df02cfe..00000000 --- a/Plugin/ProDataReader/ProJpgPluginDatasource/ProJpgPluginCursorTemplate.cs +++ /dev/null @@ -1,74 +0,0 @@ -/* - - Copyright 2017 Esri - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - - See the License for the specific language governing permissions and - limitations under the License. - -*/ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using ArcGIS.Core.Data; -using ArcGIS.Core.Data.PluginDatastore; -using ArcGIS.Core.Geometry; - -namespace ProJpgPluginDatasource -{ - public class ProJpgPluginCursorTemplate : PluginCursorTemplate - { - private Queue _oids; - private IEnumerable _columns; - private SpatialReference _srout; - private IPluginRowProvider _provider; - private int CurrentId { get; set; } - private static readonly object _lock = new object(); - - internal ProJpgPluginCursorTemplate(IPluginRowProvider provider, IEnumerable oids, - IEnumerable columns, SpatialReference srout) - { - _provider = provider; - _oids = new Queue(oids); - _columns = columns; - _srout = srout; - CurrentId = -1; - } - public override PluginRow GetCurrentRow() - { - int id = -1; - //The lock shouldn't be necessary if your cursor is a per thread instance - //(like the sample is) - lock (_lock) - { - id = CurrentId; - } - return _provider.FindRow(id, _columns, _srout); - } - - public override bool MoveNext() - { - if (_oids.Count == 0) - return false; - - //The lock shouldn't be necessary if your cursor is a per thread instance - //(like the sample is) - lock (_lock) - { - CurrentId = _oids.Dequeue(); - } - return true; - } - } -} diff --git a/Plugin/ProDataReader/ProJpgPluginDatasource/ProJpgPluginDatasource.csproj b/Plugin/ProDataReader/ProJpgPluginDatasource/ProJpgPluginDatasource.csproj deleted file mode 100644 index 2fbae0f1..00000000 --- a/Plugin/ProDataReader/ProJpgPluginDatasource/ProJpgPluginDatasource.csproj +++ /dev/null @@ -1,108 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {3DE57E08-5EF4-47E7-9C11-569061FDA3D5} - Library - Properties - ProJpgPluginDatasource - ProJpgPluginDatasource - v4.7.2 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - Program - C:\Program Files\ArcGIS\Pro\bin\ArcGISPro.exe - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - Program - C:\Program Files\ArcGIS\Pro\bin\ArcGISPro.exe - - - $([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\ESRI\ArcGISPro', 'InstallDir', null, RegistryView.Registry64)) - $(registry:HKEY_CURRENT_USER\SOFTWARE\ESRI\ArcGISPro@InstallDir) - - - - - - - - - - - - C:\Program Files\ArcGIS\Pro\bin\ArcGIS.Core.dll - False - - - C:\Program Files\ArcGIS\Pro\bin\ArcGIS.CoreHost.dll - False - - - - - - - - - - - - - - - - - - {270b962c-93e5-473f-b502-d05d639cc51d} - ImageMetadata - - - - - - BuildDefault - 1591 - - - BuildDefault - - - Plugin - - - - - - \ No newline at end of file diff --git a/Plugin/ProDataReader/ProJpgPluginDatasource/ProJpgPluginDatasourceTemplate.cs b/Plugin/ProDataReader/ProJpgPluginDatasource/ProJpgPluginDatasourceTemplate.cs deleted file mode 100644 index 159a0281..00000000 --- a/Plugin/ProDataReader/ProJpgPluginDatasource/ProJpgPluginDatasourceTemplate.cs +++ /dev/null @@ -1,116 +0,0 @@ -/* - - Copyright 2017 Esri - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - - See the License for the specific language governing permissions and - limitations under the License. - -*/ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.InteropServices; -using System.Text; -using System.Threading.Tasks; -using ArcGIS.Core.Data; -using ArcGIS.Core.Data.PluginDatastore; -using ArcGIS.Core.Geometry; -using ImageMetadata; - -namespace ProJpgPluginDatasource -{ - public class ProJpgPluginDatasourceTemplate : PluginDatasourceTemplate - { - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - [DllImport("kernel32.dll")] - - internal static extern uint GetCurrentThreadId(); - - private string _filePath = ""; - private uint _threadId; - - private Dictionary _tables; - - public override void Open(Uri connectionPath) - { - //TODO Initialize your plugin instance. Individual instances - //of your plugin may be initialized on different threads - if (!(System.IO.File.Exists(connectionPath.LocalPath) - || System.IO.Directory.Exists(connectionPath.LocalPath))) - { - throw new System.IO.DirectoryNotFoundException(connectionPath.LocalPath); - } - //initialize - //Strictly speaking, tracking your thread id is only necessary if - //your implementation uses internals that have thread affinity. - _threadId = GetCurrentThreadId(); - _tables = new Dictionary(); - _filePath = connectionPath.LocalPath; - } - - public override void Close() - { - if (_tables == null) return; - //Dispose of any cached table instances here - foreach (var table in _tables.Values) - { - ((ProJpgPluginTableTemplate)table).Dispose(); - } - _tables.Clear(); - } - - /// - /// Implements the opening of a table using a given path. - /// - /// table name or path is the file path to the jpg - /// Table template that matches the table name (cached) - public override PluginTableTemplate OpenTable(string tableName) - { - if (!this.GetTableNames().Contains(tableName)) - throw new GeodatabaseTableException($"The table {tableName} was not found"); - return _tables[tableName]; - } - - public override IReadOnlyList GetTableNames() - { - if (_tables.Count > 0) return _tables.Keys.ToList(); - if (System.IO.Directory.Exists(_filePath)) - { - var jpgFiles = System.IO.Directory.GetFiles(_filePath, $@"*.jpg", System.IO.SearchOption.TopDirectoryOnly); - List ximgInfos = new List(); - foreach (var jpgFullName in jpgFiles) - { - var xInfo = new XimgInfo(jpgFullName); - System.Diagnostics.Debug.WriteLine($@"Image {xInfo.IsImage}"); - if (!xInfo.IsImage || !xInfo.IsGpsEnabled) continue; - ximgInfos.Add(new XimgInfo(jpgFullName)); - } - var tableName = System.IO.Path.GetFileName (_filePath); - _tables.Add(tableName, new ProJpgPluginTableTemplate(ximgInfos, tableName)); - } - else - { - // there is only one 'table' which is the image - var tableName = System.IO.Path.GetFileNameWithoutExtension(_filePath); - var lst = new List { new XimgInfo(_filePath) }; - _tables.Add (tableName, new ProJpgPluginTableTemplate(lst, tableName)); - } - return _tables.Keys.ToList(); - } - - public override bool IsQueryLanguageSupported() - { - return true; - } - } -} diff --git a/Plugin/ProDataReader/ProJpgPluginDatasource/ProJpgPluginTableTemplate.cs b/Plugin/ProDataReader/ProJpgPluginDatasource/ProJpgPluginTableTemplate.cs deleted file mode 100644 index 055efbef..00000000 --- a/Plugin/ProDataReader/ProJpgPluginDatasource/ProJpgPluginTableTemplate.cs +++ /dev/null @@ -1,429 +0,0 @@ -/* - - Copyright 2017 Esri - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - - See the License for the specific language governing permissions and - limitations under the License. - -*/ -using System; -using System.Collections.Generic; -using System.Data; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using ArcGIS.Core.Data; -using ArcGIS.Core.Data.PluginDatastore; -using ArcGIS.Core.Geometry; -using ImageMetadata; - -namespace ProJpgPluginDatasource -{ - /// - /// (Custom) interface the sample uses to extract row information from the - /// plugin table - /// - internal interface IPluginRowProvider - { - PluginRow FindRow(int oid, IEnumerable columnFilter, SpatialReference sr); - } - - public class ProJpgPluginTableTemplate : PluginTableTemplate, IDisposable, IPluginRowProvider - { - private readonly DataTable _dataTable = new DataTable(); - private readonly List _ximgInfos; - private readonly string _tableName; - private readonly SpatialReference _spatialReference; - private Envelope _gisExtent; - private List _pluginFields = null; - - private const string GeometryFieldName = "Shape"; - private const string ObjectIdFieldName = "ObjectId"; - private const string LongFieldName = "Longitude"; - private const string LatFieldName = "Latitude"; - private const string AltFieldName = "Altitude"; - private const string DateTimeFieldName = "TakenOn"; - private const string DirectionFieldName = "Direction"; - //private const string ImageFieldName = "Photo"; - private const string PathFieldName = "Path"; - private const string ContentTypeFieldName = "CONTENT_TYPE"; - private const string NameFieldName = "Name"; - - /// - /// Ctor using ImageMetadata lib as the image definition - /// - /// Image metadata - /// Name of the table - public ProJpgPluginTableTemplate(List ximgInfos, string tableName) - { - this._ximgInfos = ximgInfos; - this._tableName = tableName; - _spatialReference = SpatialReferences.WGS84; - CreateTable(this._tableName, this._ximgInfos); - } - - /// - /// Returns a list of PluginFields - in essence the attribute columns of the access database table - /// - /// list of PluginFields - public override IReadOnlyList GetFields() - { - if (_pluginFields == null) - { - _pluginFields = new List(); - foreach (var col in _dataTable.Columns.Cast()) - { - // TODO: process all field types here ... this list is not complete - var fieldType = FieldType.String; - System.Diagnostics.Debug.WriteLine($@"{col.ColumnName} {col.DataType}"); - if (col.ColumnName == ObjectIdFieldName || - col.ColumnName == GeometryFieldName) - { - fieldType = col.ColumnName == GeometryFieldName ? FieldType.Geometry : FieldType.OID; - } - else - { - switch (col.DataType.Name) - { - case nameof(DateTime): - fieldType = FieldType.Date; - break; - case nameof(Double): - fieldType = FieldType.Double; - break; - case nameof(Int16): - fieldType = FieldType.Integer; - break; - case nameof(Int32): - fieldType = FieldType.Integer; - break; - case nameof(Guid): - fieldType = FieldType.GUID; - break; - case nameof(String): - fieldType = FieldType.String; - break; - case nameof(Single): - fieldType = FieldType.Single; - break; - case nameof(System.Drawing.Image): - fieldType = FieldType.Blob; - break; - default: - System.Diagnostics.Debug.WriteLine($@"Unsupported datatype: {col.DataType.Name} not mapped"); - break; - } - } - _pluginFields.Add(new PluginField() - { - Name = col.ColumnName, - AliasName = col.ColumnName, - FieldType = fieldType - }); - } - } - return _pluginFields; - } - - /// - /// Get the name of the table - /// - /// Table name - public override string GetName() => _tableName; - - /// - /// Gets whether native row count is supported - /// - /// Return true if your table can get the row count without having - /// to enumerate through all the rows (and count them)....which will be - /// the default behavior if you return false - /// True or false - public override bool IsNativeRowCountSupported() => true; - - /// - /// Search data in this table (feature class) using a given QueryFilter - /// - /// QueryFilter to perform selection on table - /// returns a PluginCursorTemplate - public override PluginCursorTemplate Search(QueryFilter queryFilter) => - this.SearchInternal(queryFilter); - - /// - /// Search data in this table (feature class) using a given SpatialQueryFilter - /// - /// SpatialQueryFilter to perform selection on table - /// returns a PluginCursorTemplate - public override PluginCursorTemplate Search(SpatialQueryFilter spatialQueryFilter) => - this.SearchInternal(spatialQueryFilter); - - public override GeometryType GetShapeType() - { - return GeometryType.Point; - } - - /// - /// Get the extent for the dataset (if it has one) - /// - /// Ideally, your plugin table should return an extent even if it is - /// empty - /// - public override Envelope GetExtent() { return _gisExtent; } - - #region Internal Processing - - private void CreateTable(string tableName, List ximgInfos) - { - _dataTable.TableName = tableName; - var oidCol = new DataColumn(ObjectIdFieldName, typeof(Int32)) - { - AutoIncrement = true, - AutoIncrementSeed = 1 - }; - _dataTable.Columns.Add(oidCol); - _dataTable.PrimaryKey = new DataColumn[] { oidCol }; - _dataTable.Columns.Add(new DataColumn(GeometryFieldName, typeof(ArcGIS.Core.Geometry.Geometry))); - _dataTable.Columns.Add(new DataColumn(LongFieldName, typeof(Double))); - _dataTable.Columns.Add(new DataColumn(LatFieldName, typeof(Double))); - _dataTable.Columns.Add(new DataColumn(AltFieldName, typeof(Double))); - _dataTable.Columns.Add(new DataColumn(DirectionFieldName, typeof(Double))); - _dataTable.Columns.Add(new DataColumn(DateTimeFieldName, typeof(DateTime))); - //_dataTable.Columns.Add(new DataColumn(ImageFieldName, typeof(byte[]))); - _dataTable.Columns.Add(new DataColumn(PathFieldName, typeof(string))); - _dataTable.Columns.Add(new DataColumn(ContentTypeFieldName, typeof(string))); - _dataTable.Columns.Add(new DataColumn(NameFieldName, typeof(string))); - int objectId = 1; - foreach (var ximgInfo in ximgInfos) - { - var newRow = _dataTable.NewRow(); - newRow[ObjectIdFieldName] = objectId++; - // let's make a 3d shape - var coord = new Coordinate3D(ximgInfo.Longitude, ximgInfo.Latitude, ximgInfo.Altitude); - var mp = MapPointBuilder.CreateMapPoint(coord, _spatialReference); - newRow[GeometryFieldName] = mp; - newRow[LongFieldName] = ximgInfo.Longitude; - newRow[LatFieldName] = ximgInfo.Latitude; - newRow[AltFieldName] = ximgInfo.Altitude; - newRow[DirectionFieldName] = ximgInfo.ImageBearing; - newRow[DateTimeFieldName] = ximgInfo.DateTimeOriginal; - //newRow[ImageFieldName] = ximgInfo.Image; - - newRow[PathFieldName] = $@"file:///{ximgInfo.Path}"; - newRow[ContentTypeFieldName] = @"image/jpeg"; - newRow[NameFieldName] = ximgInfo.Name; - _dataTable.Rows.Add(newRow); - _gisExtent = _gisExtent == null - ? mp.Extent : _gisExtent.Union(mp.Extent); - } - } - - private PluginCursorTemplate SearchInternal(QueryFilter qf) - { - var oids = this.ExecuteQuery(qf); - var columns = this.GetQuerySubFields(qf); - - return new ProJpgPluginCursorTemplate(this, - oids, - columns, - qf.OutputSpatialReference); - } - - /// - /// Implement querying with a query filter - /// - /// - /// - private List ExecuteQuery(QueryFilter qf) - { - List result = new List(); - SpatialQueryFilter sqf = null; - if (qf is SpatialQueryFilter) - { - sqf = qf as SpatialQueryFilter; - } - var whereClause = string.Empty; - if (!string.IsNullOrEmpty(qf.WhereClause)) - { - whereClause = qf.WhereClause; - } - else - { - if (qf.ObjectIDs.Count() > 0) - { - whereClause = $@"{ObjectIdFieldName} in ({string.Join(",", qf.ObjectIDs)})"; - } - } - var subFields = string.IsNullOrEmpty(qf.SubFields) ? "*" : qf.SubFields; - var selectRows = _dataTable.Select(whereClause, qf.PostfixClause); - int recCount = selectRows.Length; - if (recCount == 0) return result; - if (sqf == null) - { - result = selectRows.Select(row => (int)row[ObjectIdFieldName]).ToList(); - } - else - { - result = selectRows.Where(Row => CheckSpatialQuery(sqf, Row[GeometryFieldName] as Geometry)).Select(row => (int)row[ObjectIdFieldName]).ToList(); - } - return result; - } - - private bool CheckSpatialQuery(SpatialQueryFilter sqf, Geometry geom) - { - if (geom == null) - { - return false; - } - return HasRelationship(GeometryEngine.Instance, - sqf.FilterGeometry, geom, sqf.SpatialRelationship); - } - internal static bool HasRelationship(IGeometryEngine engine, - Geometry geom1, - Geometry geom2, - SpatialRelationship relationship) - { - switch (relationship) - { - case SpatialRelationship.Intersects: - return engine.Intersects(geom1, geom2); - case SpatialRelationship.IndexIntersects: - return engine.Intersects(geom1, geom2); - case SpatialRelationship.EnvelopeIntersects: - return engine.Intersects(geom1.Extent, geom2.Extent); - case SpatialRelationship.Contains: - return engine.Contains(geom1, geom2); - case SpatialRelationship.Crosses: - return engine.Crosses(geom1, geom2); - case SpatialRelationship.Overlaps: - return engine.Overlaps(geom1, geom2); - case SpatialRelationship.Touches: - return engine.Touches(geom1, geom2); - case SpatialRelationship.Within: - return engine.Within(geom1, geom2); - } - return false;//unknown relationship - } - - private List GetQuerySubFields(QueryFilter qf) - { - //Honor Subfields in Query Filter - string columns = qf.SubFields ?? "*"; - List subFields; - if (columns == "*") - { - subFields = this.GetFields().Select(col => col.Name.ToUpper()).ToList(); - } - else - { - var names = columns.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); - subFields = names.Select(n => n.ToUpper()).ToList(); - } - - return subFields; - } - - #endregion Internal Processing - - #region IPluginRowProvider - - /// - /// Find a given row (using Object ID) and retrieve attributes using columnFilter and output spatial reference - /// - /// Search for this record using this Object ID - /// List of Column Names to be returned - /// project spatial data using this output spatial reference - /// PlugInRow - public PluginRow FindRow(int oid, IEnumerable columnFilter, SpatialReference srout) - { - Geometry shape = null; - List values = new List(); - var row = _dataTable.Rows.Find(oid); - //The order of the columns in the returned rows ~must~ match - //GetFields. If a column is filtered out, an empty placeholder must - //still be provided even though the actual value is skipped - var columnNames = this.GetFields().Select(col => col.Name.ToUpper()).ToList(); - foreach (var colName in columnNames) - { - if (columnFilter.Contains(colName)) - { - //special handling for shape - if (colName == GeometryFieldName) - { - shape = row[GeometryFieldName] as Geometry; - if (srout != null) - { - if (!srout.Equals(_spatialReference)) - shape = GeometryEngine.Instance.Project(shape, srout); - } - values.Add(shape); - } - else - { - values.Add(row[colName]); - } - } - else - { - values.Add(System.DBNull.Value);//place holder - } - } - return new PluginRow() { Values = values }; - } - - #endregion IPluginRowProvider - - #region IDisposable Support - - private bool disposedValue = false; // To detect redundant calls - - /// - /// Clean up resources - /// - /// - protected virtual void Dispose(bool disposing) - { - if (!disposedValue) - { - if (_dataTable == null) - return; - - if (disposing) - { - _dataTable?.Clear(); - _gisExtent = null; - } - disposedValue = true; - } - } - - // TODO: override a finalizer only if Dispose(bool disposing) above has code to free unmanaged resources. - // ~ProPluginTableTemplate() - // { - // // Do not change this code. Put cleanup code in Dispose(bool disposing) above. - // Dispose(false); - // } - - /// - /// This code added to correctly implement the disposable pattern. - /// - public void Dispose() - { - // Do not change this code. Put cleanup code in Dispose(bool disposing) above. - Dispose(true); - // TODO: uncomment the following line if the finalizer is overridden above. - // GC.SuppressFinalize(this); - } - - #endregion - - } -} diff --git a/Plugin/ProDataReader/ProJpgPluginDatasource/Properties/AssemblyInfo.cs b/Plugin/ProDataReader/ProJpgPluginDatasource/Properties/AssemblyInfo.cs deleted file mode 100644 index 772d9be7..00000000 --- a/Plugin/ProDataReader/ProJpgPluginDatasource/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,54 +0,0 @@ -/* - - Copyright 2017 Esri - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - - See the License for the specific language governing permissions and - limitations under the License. - -*/ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("ProJpgPluginDatasource")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Acme")] -[assembly: AssemblyProduct("ProJpgPluginDatasource")] -[assembly: AssemblyCopyright("Copyright © Acme 2019")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("3de57e08-5ef4-47e7-9c11-569061fda3d5")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Plugin/ProDataReader/ProMdbAccessDb/MdbAccessDb.csproj b/Plugin/ProDataReader/ProMdbAccessDb/MdbAccessDb.csproj deleted file mode 100644 index 52cef0b3..00000000 --- a/Plugin/ProDataReader/ProMdbAccessDb/MdbAccessDb.csproj +++ /dev/null @@ -1,52 +0,0 @@ - - - - - Debug - AnyCPU - {00B0AAC0-BF42-44D6-8638-15B563782CE2} - Library - Properties - ProMdbAccessDb - ProMdbAccessDb - v4.7.2 - 512 - true - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - 1591 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Plugin/ProDataReader/ProMdbAccessDb/ProMdbAccessDb.cs b/Plugin/ProDataReader/ProMdbAccessDb/ProMdbAccessDb.cs deleted file mode 100644 index 996ad63e..00000000 --- a/Plugin/ProDataReader/ProMdbAccessDb/ProMdbAccessDb.cs +++ /dev/null @@ -1,241 +0,0 @@ -/* - - Copyright 2017 Esri - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - - See the License for the specific language governing permissions and - limitations under the License. - -*/ -using System; -using System.Collections.Generic; -using System.Data; -using System.Data.OleDb; -using System.Runtime.InteropServices; - -namespace ProMdbAccessDb -{ - /// - /// Encapsulates feature allowing access to Microsoft Access database from within ArcGIS Pro - /// - public class ProMdbAccessDb : IDisposable - { - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - [DllImport("kernel32.dll")] - - internal static extern uint GetCurrentThreadId(); - - private OleDbConnection _connection = null; - private Dictionary _lstSpatialTables = new Dictionary(); - - private static Dictionary Connections = new Dictionary(); - - - public ProMdbAccessDb(string accessDbPath) - { - Open(accessDbPath); - } - - private void Open(string accessDbPath) - { - DbPath = accessDbPath; - if (Connections.ContainsKey(accessDbPath)) - { - _connection = Connections[accessDbPath].Connection; - Connections[accessDbPath].InstanceCount++; - } - else - { - _connection = new OleDbConnection($@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source={DbPath}"); - _connection.Open(); - Connections.Add(accessDbPath, new ConnectionStatus() { InstanceCount = 0, Connection = _connection }); - } - } - - public void Close () - { - // dispose managed state (managed objects). - if (!string.IsNullOrEmpty(DbPath)) - { - if (Connections.ContainsKey(DbPath)) - { - if (Connections[DbPath].InstanceCount == 0) - { - try - { - // all connection instances are closed this is the last one - if (Connections[DbPath].Connection.State == ConnectionState.Open) - Connections[DbPath].Connection.Close(); - Connections.Remove(DbPath); - } - catch (Exception ex) - { - System.Diagnostics.Debug.WriteLine($@"Can't close connection: {ex.Message}"); - } - } - else - { - // other instances are still using this connection - Connections[DbPath].InstanceCount--; - } - } - DbPath = string.Empty; - } - } - - public string DbPath { get; set; } - - #region Geodatabase Schema support - - public Dictionary GetSpatialTables() - { - if (_lstSpatialTables.Count != 0) return _lstSpatialTables; - - string[] sqlColumns = { "TableName", "FieldName", "ShapeType", "ExtentLeft", "ExtentBottom", "ExtentRight", "ExtentTop", "SRTEXT" }; - var order = @"order by TableName"; - var sqlGetGeomCols = $@"select {String.Join(", ", sqlColumns)} from GDB_GeomColumns LEFT JOIN GDB_SpatialRefs ON GDB_GeomColumns.srid = GDB_SpatialRefs.srid {order}"; - - OleDbCommand command = new OleDbCommand(sqlGetGeomCols, _connection); - // Open the connection and execute the select command. - try - { - // Execute command - using (OleDbDataReader reader = command.ExecuteReader()) - { - while (reader.Read()) - { - var tn = reader["TableName"].ToString(); - if (tn.Equals("GDB_Items")) continue; - var tbl = new ProMdbTableInfo - { - TableName = tn, - GeometryFieldName = reader["FieldName"].ToString(), - GeometryType = (int)reader["ShapeType"], - ExtentLeft = (double)reader["ExtentLeft"], - ExtentBottom = (double)reader["ExtentBottom"], - ExtentRight = (double)reader["ExtentRight"], - ExtentTop = (double)reader["ExtentTop"], - SpatialRefString = reader["SRTEXT"].ToString(), - FieldInfo = GetFieldInfo(tn) - }; - _lstSpatialTables.Add(tbl.TableName, tbl); - } - } - } - catch (Exception ex) - { - Console.WriteLine(ex.Message); - } - return _lstSpatialTables; - } - - #endregion Geodatabase Schema support - - #region Table Schema support - - private ProMdbFieldInfo GetFieldInfo(string tableName) - { - var fieldInfo = new ProMdbFieldInfo() - { - Columns = new List() - }; - //Retrieve schema information about the given table. - var dt = new DataTable(); - string tableSchemaClause = - $@"SELECT * FROM {tableName} WHERE 1=0;"; - OleDbDataAdapter adapter = new OleDbDataAdapter(tableSchemaClause, _connection); - adapter.Fill(dt); - - foreach (DataColumn col in dt.Columns) - { - fieldInfo.Columns.Add(new ProMdbColumnInfo { ColumnName = col.ColumnName, Alias = col.Caption, ColumnDataType = col.DataType }); - } - var keys = GetKeyNames(tableName, _connection); - fieldInfo.ObjectIdField = keys.Count > 0 ? keys[0] : string.Empty; - return fieldInfo; - } - - public static List GetKeyNames(String tableName, OleDbConnection conn) - { - var returnList = new List(); - DataTable mySchema = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Constraint_Column_Usage, - new Object[] { null, null, tableName }); - // following is a lengthy form of the number '3' :-) - int columnOrdinalForName = mySchema.Columns["COLUMN_NAME"].Ordinal; - foreach (DataRow r in mySchema.Rows) - { - returnList.Add(r.ItemArray[columnOrdinalForName].ToString()); - } - return returnList; - } - - #endregion Table Schema support - - #region Query Support - - public int QueryTable(string tableName, string selectClause, string whereClause, - string orderBy, DataTable outputDataTable) - { - string queryWhereClause = - $@"SELECT {selectClause} FROM {tableName} WHERE {(string.IsNullOrEmpty(whereClause) ? "1=1" : whereClause)};"; - if (!string.IsNullOrEmpty(orderBy)) queryWhereClause = $@"{queryWhereClause} ORDER BY {orderBy}"; - OleDbDataAdapter adapter = new OleDbDataAdapter(queryWhereClause, _connection); - //adapter.SelectCommand.Parameters.Add("@_param1", OleDbType.VarChar).Value = "parameter value"; - return adapter.Fill(outputDataTable); - } - - #endregion - - #region IDisposable Support - - private bool disposedValue = false; // To detect redundant calls - - protected virtual void Dispose(bool disposing) - { - if (!disposedValue) - { - if (disposing) - { - Close(); - } - // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below. - // TODO: set large fields to null. - _connection = null; - disposedValue = true; - } - } - - // TODO: override a finalizer only if Dispose(bool disposing) above has code to free unmanaged resources. - // ~AccessDb() - // { - // // Do not change this code. Put cleanup code in Dispose(bool disposing) above. - // Dispose(false); - // } - - // This code added to correctly implement the disposable pattern. - public void Dispose() - { - // Do not change this code. Put cleanup code in Dispose(bool disposing) above. - Dispose(true); - // TODO: uncomment the following line if the finalizer is overridden above. - // GC.SuppressFinalize(this); - } - #endregion - } - - internal class ConnectionStatus - { - internal int InstanceCount { get; set; } - internal OleDbConnection Connection { get; set; } - } - -} diff --git a/Plugin/ProDataReader/ProMdbAccessDb/ProMdbColumnInfo.cs b/Plugin/ProDataReader/ProMdbAccessDb/ProMdbColumnInfo.cs deleted file mode 100644 index d0614452..00000000 --- a/Plugin/ProDataReader/ProMdbAccessDb/ProMdbColumnInfo.cs +++ /dev/null @@ -1,46 +0,0 @@ -/* - - Copyright 2017 Esri - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - - See the License for the specific language governing permissions and - limitations under the License. - -*/ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ProMdbAccessDb -{ - - /// - /// Pro MDB attribute column information - /// - public class ProMdbColumnInfo - { - /// - /// name of the attribute column - /// - public string ColumnName { get; set; } - /// - /// Alias of the attribute column name - /// - public string Alias { get; set; } - /// - /// .Net datatype of the attribute column - /// - public Type ColumnDataType { get; set; } - } -} diff --git a/Plugin/ProDataReader/ProMdbAccessDb/ProMdbFieldInfo.cs b/Plugin/ProDataReader/ProMdbAccessDb/ProMdbFieldInfo.cs deleted file mode 100644 index 1be5abe9..00000000 --- a/Plugin/ProDataReader/ProMdbAccessDb/ProMdbFieldInfo.cs +++ /dev/null @@ -1,44 +0,0 @@ -/* - - Copyright 2017 Esri - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - - See the License for the specific language governing permissions and - limitations under the License. - -*/ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ProMdbAccessDb -{ - - - /// - /// Encapsulates information needed for table/featureclass attribute columns - /// - public class ProMdbFieldInfo - { - /// - /// List of table/feature class attribute columns - /// - public List Columns { get; set; } - /// - /// Name of the Object ID field: needs to be a primary key on the table ! - /// - public string ObjectIdField { get; set; } - } - -} diff --git a/Plugin/ProDataReader/ProMdbAccessDb/ProMdbTableInfo.cs b/Plugin/ProDataReader/ProMdbAccessDb/ProMdbTableInfo.cs deleted file mode 100644 index bc8aa1a6..00000000 --- a/Plugin/ProDataReader/ProMdbAccessDb/ProMdbTableInfo.cs +++ /dev/null @@ -1,71 +0,0 @@ -/* - - Copyright 2017 Esri - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - - See the License for the specific language governing permissions and - limitations under the License. - -*/ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ProMdbAccessDb -{ - - /// - /// tracks metadata needed to handle a Pro MDB table / feature class - /// - public class ProMdbTableInfo - { - /// - /// Name of the table/feature class - /// - public string TableName { get; set; } - /// - /// Name of the Geometry column - /// - public string GeometryFieldName { get; set; } - /// - /// Geometry Type: point/line/polygon - /// - public int GeometryType { get; set; } - /// - /// Layer extent - /// - public double ExtentLeft { get; set; } - /// - /// Layer extent - /// - public double ExtentBottom { get; set; } - /// - /// Layer extent - /// - public double ExtentRight { get; set; } - /// - /// Layer extent - /// - public double ExtentTop { get; set; } - /// - /// Spatial reference of feature class: this is a string ... we need to use CreateSpatialReference - /// - public string SpatialRefString { get; set; } - /// - /// Meta data for the table's attribute columns - /// - public ProMdbFieldInfo FieldInfo { get; set; } - } - -} diff --git a/Plugin/ProDataReader/ProMdbAccessDb/Properties/AssemblyInfo.cs b/Plugin/ProDataReader/ProMdbAccessDb/Properties/AssemblyInfo.cs deleted file mode 100644 index 0f6055e3..00000000 --- a/Plugin/ProDataReader/ProMdbAccessDb/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,54 +0,0 @@ -/* - - Copyright 2017 Esri - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - - See the License for the specific language governing permissions and - limitations under the License. - -*/ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("ProMdbAccessDb")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("ProMdbAccessDb")] -[assembly: AssemblyCopyright("Copyright © 2019")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("00b0aac0-bf42-44d6-8638-15b563782ce2")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Plugin/ProDataReader/ProMdbPluginDatasource/Config.xml b/Plugin/ProDataReader/ProMdbPluginDatasource/Config.xml deleted file mode 100644 index b4915281..00000000 --- a/Plugin/ProDataReader/ProMdbPluginDatasource/Config.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - ProMdbPluginDatasource - {6e6e1223-1fcc-45af-ab6f-aa65299ec84b} - ProMdb Plugin Datasource - 1.0 - ArcGIS Pro SDK Team, arcgisprosdk@esri.com - esri, http://www.esri.com - 4/26/2019 9:26:51 AM, 2019 - - - - - - - - - - - - \ No newline at end of file diff --git a/Plugin/ProDataReader/ProMdbPluginDatasource/ProMdbPluginCursorTemplate.cs b/Plugin/ProDataReader/ProMdbPluginDatasource/ProMdbPluginCursorTemplate.cs deleted file mode 100644 index 0f8b668f..00000000 --- a/Plugin/ProDataReader/ProMdbPluginDatasource/ProMdbPluginCursorTemplate.cs +++ /dev/null @@ -1,92 +0,0 @@ -/* - - Copyright 2019 Esri - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - - See the License for the specific language governing permissions and - limitations under the License. - -*/ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.InteropServices; -using System.Text; -using System.Threading.Tasks; -using ArcGIS.Core.Data; -using ArcGIS.Core.Data.PluginDatastore; -using ArcGIS.Core.Geometry; - -namespace ProMdbPluginDatasource -{ - /// - /// - /// - public class ProMdbPluginCursorTemplate : PluginCursorTemplate - { - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - [DllImport("kernel32.dll")] - - internal static extern uint GetCurrentThreadId(); - - private Queue _oids; - private IEnumerable _columns; - private SpatialReference _srout; - private IPluginRowProvider _provider; - private int CurrentId { get; set; } - private static readonly object _lock = new object(); - - internal ProMdbPluginCursorTemplate(IPluginRowProvider provider, IEnumerable oids, - IEnumerable columns, SpatialReference srout) - { - _provider = provider; - _oids = new Queue(oids); - _columns = columns; - _srout = srout; - CurrentId = -1; - } - - /// - /// Get the current row when using the MoveNext cursor method - /// - /// PluginRow holding the attributes of the current row - public override PluginRow GetCurrentRow() - { - int id = -1; - //The lock shouldn't be necessary if your cursor is a per thread instance - //(like the sample is) - lock (_lock) - { - id = CurrentId; - } - return _provider.FindRow(id, _columns, _srout); - } - - /// - /// Move cursor to the next record - /// - /// true if the oid list has another record - public override bool MoveNext() - { - if (_oids.Count == 0) - return false; - - //The lock shouldn't be necessary if your cursor is a per thread instance - //(like the sample is) - lock (_lock) - { - CurrentId = _oids.Dequeue(); - } - return true; - } - } -} diff --git a/Plugin/ProDataReader/ProMdbPluginDatasource/ProMdbPluginDatasource.csproj b/Plugin/ProDataReader/ProMdbPluginDatasource/ProMdbPluginDatasource.csproj deleted file mode 100644 index 68bc91bf..00000000 --- a/Plugin/ProDataReader/ProMdbPluginDatasource/ProMdbPluginDatasource.csproj +++ /dev/null @@ -1,108 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {6E6E1223-1FCC-45AF-AB6F-AA65299EC84B} - Library - Properties - ProMdbPluginDatasource - ProMdbPluginDatasource - v4.7.2 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - Program - C:\Program Files\ArcGIS\Pro\bin\ArcGISPro.exe - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - Program - C:\Program Files\ArcGIS\Pro\bin\ArcGISPro.exe - - - $([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\ESRI\ArcGISPro', 'InstallDir', null, RegistryView.Registry64)) - $(registry:HKEY_CURRENT_USER\SOFTWARE\ESRI\ArcGISPro@InstallDir) - - - - - - - - - - - C:\Program Files\ArcGIS\Pro\bin\ArcGIS.Core.dll - False - - - C:\Program Files\ArcGIS\Pro\bin\ArcGIS.CoreHost.dll - False - - - - - - - - - - - - - - - - - - {00b0aac0-bf42-44d6-8638-15b563782ce2} - MdbAccessDb - - - - - - BuildDefault - bin\Debug\ProMdbPluginDatasource.xml - 1591 - - - BuildDefault - - - Plugin - - - - - - \ No newline at end of file diff --git a/Plugin/ProDataReader/ProMdbPluginDatasource/ProMdbPluginDatasourceTemplate.cs b/Plugin/ProDataReader/ProMdbPluginDatasource/ProMdbPluginDatasourceTemplate.cs deleted file mode 100644 index 58ead5e4..00000000 --- a/Plugin/ProDataReader/ProMdbPluginDatasource/ProMdbPluginDatasourceTemplate.cs +++ /dev/null @@ -1,151 +0,0 @@ -/* - - Copyright 2019 Esri - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - - See the License for the specific language governing permissions and - limitations under the License. - -*/ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.InteropServices; -using System.Text; -using System.Threading.Tasks; -using ArcGIS.Core.Data; -using ArcGIS.Core.Data.PluginDatastore; -using ArcGIS.Core.Geometry; -using ProMdbAccessDb; - -namespace ProMdbPluginDatasource -{ - /// - /// Defines the data source to access Microsoft Access MDB personal geodatabases and - /// made available to ArcGIS Pro via a plug-in data source add-in. - /// - public class ProMdbPluginDatasourceTemplate : PluginDatasourceTemplate - { - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - [DllImport("kernel32.dll")] - - internal static extern uint GetCurrentThreadId(); - //private static int InstanceCount = 0; - - private string _filePath = ""; - private uint _threadId; - - private ProMdbAccessDb.ProMdbAccessDb _accessDb = null; - private string _accessError = "Access DB has not been opened"; - - private Dictionary _tables; - - /// - /// Opens the datasource allowing access to a Microsoft Access personal geodatabase - /// - /// path to the mdb file which has to be renamed to ArcGisMdb - public override void Open(Uri connectionPath) - { - //TODO Initialize your plugin instance. Individual instances - //of your plugin may be initialized on different threads - if (!System.IO.File.Exists(connectionPath.LocalPath)) - { - throw new System.IO.DirectoryNotFoundException(connectionPath.LocalPath); - } - //initialize - //Strictly speaking, tracking your thread id is only necessary if - //your implementation uses internals that have thread affinity. - _threadId = GetCurrentThreadId(); - _tables = new Dictionary(); - _filePath = connectionPath.LocalPath; - InitAccessDB(_filePath); - } - - private void InitAccessDB(string path) - { - if (_accessDb == null) - { - try - { - _accessDb = new ProMdbAccessDb.ProMdbAccessDb(path); - } - catch (Exception ex) - { - _accessError = ex.Message; - _accessDb = null; - } - } - } - - /// - /// Called when the datasource is closed ... free reference data - /// - public override void Close() - { - //Dispose of any cached table instances here - foreach (var table in _tables.Values) - { - ((ProMdbPluginTableTemplate)table).Dispose(); - } - _tables.Clear(); - if (_accessDb != null) - { - _accessDb.Close(); - _accessDb = null; - } - } - - /// - /// Implements the opening of a table using a given path. - /// - /// table name or 'Path' to the table which is comprised of the access database file followed by the tablename - /// Table template that matches the table name (cached) - public override PluginTableTemplate OpenTable(string tablePath) - { - var tableName = System.IO.Path.GetFileNameWithoutExtension(tablePath); - if (!this.GetTableNames().Contains(tableName)) - throw new GeodatabaseTableException($"The table {tableName} was not found"); - if (!_tables.Keys.Contains(tableName)) - { - _tables[tableName] = new ProMdbPluginTableTemplate(_accessDb, _tableInfos[tableName]); - } - return _tables[tableName]; - } - - private Dictionary _tableInfos = null; - - /// - /// returns a list of table names - /// - /// list of strings (table names) - public override IReadOnlyList GetTableNames() - { - if (_tableInfos != null) return _tableInfos.Keys.ToList(); - if (_accessDb == null) - { - throw new Exception(_accessError); - } - _tableInfos = _accessDb.GetSpatialTables(); - return _tableInfos.Keys.ToList(); - } - - /// - /// returns true if query language is supported (search using QueryFilter) - /// - /// true - public override bool IsQueryLanguageSupported() - { - //default is false - return true; - } - } -} diff --git a/Plugin/ProDataReader/ProMdbPluginDatasource/ProMdbPluginTableTemplate.cs b/Plugin/ProDataReader/ProMdbPluginDatasource/ProMdbPluginTableTemplate.cs deleted file mode 100644 index 0261a456..00000000 --- a/Plugin/ProDataReader/ProMdbPluginDatasource/ProMdbPluginTableTemplate.cs +++ /dev/null @@ -1,526 +0,0 @@ -/* - - Copyright 2019 Esri - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - - See the License for the specific language governing permissions and - limitations under the License. - -*/ -using System; -using System.Collections.Generic; -using System.Data; -using System.Linq; -using System.Runtime.InteropServices; -using System.Text; -using System.Threading.Tasks; -using ArcGIS.Core.Data; -using ArcGIS.Core.Data.PluginDatastore; -using ArcGIS.Core.Geometry; -using ProMdbAccessDb; - -namespace ProMdbPluginDatasource -{ - /// - /// (Custom) interface the sample uses to extract row information from the - /// plugin table - /// - internal interface IPluginRowProvider - { - PluginRow FindRow(int oid, IEnumerable columnFilter, SpatialReference sr); - } - - /// - /// Acts as a conduit between a data structure in a third-party data source (Microsoft Access DB) - /// and a ArcGIS.Core.Data.Table (or ArcGIS.Core.Data.FeatureClass) in ArcGIS Pro. - /// - public class ProMdbPluginTableTemplate : PluginTableTemplate, IDisposable, IPluginRowProvider - { - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - [DllImport("kernel32.dll")] - - internal static extern uint GetCurrentThreadId(); - - private readonly ProMdbAccessDb.ProMdbAccessDb _accessDb; - private readonly string _tableName; - private readonly DataTable _dataTable = new DataTable(); - private Envelope _gisExtent; - - private readonly SpatialReference _spatialReference; - private readonly ProMdbTableInfo _tableInfo; - - private List _pluginFields = null; - - /// - /// Ctor using ProMdbAccessDb from datasource as parameter - /// - /// ProMdbAccessDb from datasource - /// ProMdbTableInfo of table/feature class that has been opened - public ProMdbPluginTableTemplate(ProMdbAccessDb.ProMdbAccessDb proMdbAccessDb, ProMdbTableInfo tableInfo) - { - _accessDb = proMdbAccessDb; - _tableName = tableInfo.TableName; - _spatialReference = SpatialReferenceBuilder.CreateSpatialReference (tableInfo.SpatialRefString); - _tableInfo = tableInfo; - } - - /// - /// Returns a list of PluginFields - in essence the attribute columns of the access database table - /// - /// list of PluginFields - public override IReadOnlyList GetFields() - { - if (_pluginFields == null) - { - _pluginFields = new List(); - foreach (var col in _tableInfo.FieldInfo.Columns) - { - // TODO: process all field types here ... this list is not complete - var fieldType = FieldType.String; - System.Diagnostics.Debug.WriteLine($@"{col.ColumnName} {col.ColumnDataType}"); - if (col.ColumnName == _tableInfo.FieldInfo.ObjectIdField) - { - fieldType = FieldType.OID; - } - else - { - if (col.ColumnName.Equals(_tableInfo.GeometryFieldName, StringComparison.CurrentCultureIgnoreCase)) - { - fieldType = FieldType.Geometry; - } - else - { - switch (col.ColumnDataType.Name) - { - case nameof(DateTime): - fieldType = FieldType.Date; - break; - case nameof(Double): - fieldType = FieldType.Double; - break; - case nameof(Int16): - fieldType = FieldType.Integer; - break; - case nameof(Int32): - fieldType = FieldType.Integer; - break; - case nameof(Guid): - fieldType = FieldType.GUID; - break; - case nameof(String): - fieldType = FieldType.String; - break; - case nameof(Single): - fieldType = FieldType.Single; - break; - default: - System.Diagnostics.Debug.WriteLine($@"Unsupported datatype: {col.ColumnDataType.Name} not mapped"); - break; - } - } - } - _pluginFields.Add(new PluginField() - { - Name = col.ColumnName, - AliasName = col.Alias, - FieldType = fieldType - }); - } - } - return _pluginFields; - } - - /// - /// Get the name of the table - /// - /// Table name - public override string GetName() => _tableName; - - /// - /// Gets whether native row count is supported - /// - /// Return true if your table can get the row count without having - /// to enumerate through all the rows (and count them)....which will be - /// the default behavior if you return false - /// True or false - public override bool IsNativeRowCountSupported() => true; - - /// - /// Search data in this table (feature class) using a given QueryFilter - /// - /// QueryFilter to perform selection on table - /// returns a PluginCursorTemplate - public override PluginCursorTemplate Search(QueryFilter queryFilter) => - this.SearchInternal(queryFilter); - - /// - /// Search data in this table (feature class) using a given SpatialQueryFilter - /// - /// SpatialQueryFilter to perform selection on table - /// returns a PluginCursorTemplate - public override PluginCursorTemplate Search(SpatialQueryFilter spatialQueryFilter) => - this.SearchInternal(spatialQueryFilter); - - /// - /// Get the extent for the dataset (if it has one) - /// - /// Ideally, your plugin table should return an extent even if it is - /// empty - /// - public override Envelope GetExtent() - { - if (_gisExtent == null) - { - var builder = new EnvelopeBuilder(EnvelopeBuilder.CreateEnvelope( - _tableInfo.ExtentLeft, - _tableInfo.ExtentBottom, - _tableInfo.ExtentRight, - _tableInfo.ExtentTop, - _spatialReference)); - //Assume 0 for Z - { - builder.ZMin = 0; - builder.ZMax = 0; - } - builder.HasZ = false; - builder.HasM = false; - return builder.ToGeometry(); - } - return _gisExtent; - } - - /// - /// Returns geometry type supported by this feature class - /// - /// GeometryType of the feature class - public override GeometryType GetShapeType() - { - var geomType = GeometryType.Unknown; - switch (_tableInfo.GeometryType) - { - case 1: - geomType = GeometryType.Point; - break; - case 3: - geomType = GeometryType.Polyline; - break; - case 4: - geomType = GeometryType.Polygon; - break; - } - return geomType; - } - - #region Internal Processing - - private PluginCursorTemplate SearchInternal(QueryFilter qf) - { - var oids = this.ExecuteQuery(qf); - var columns = this.GetQuerySubFields(qf); - - return new ProMdbPluginCursorTemplate(this, - oids, - columns, - qf.OutputSpatialReference); - } - - /// - /// Implement querying with a query filter - /// - /// - /// - private List ExecuteQuery(QueryFilter qf) - { - List result = new List(); - SpatialQueryFilter sqf = null; - if (qf is SpatialQueryFilter) - { - sqf = qf as SpatialQueryFilter; - } - var whereClause = string.Empty; - if (!string.IsNullOrEmpty(qf.WhereClause)) - { - whereClause = qf.WhereClause; - } - else - { - if (qf.ObjectIDs.Count() > 0) - { - whereClause = $@"{_tableInfo.FieldInfo.ObjectIdField} in ({string.Join (",", qf.ObjectIDs)})"; - } - } - var subFields = string.IsNullOrEmpty (qf.SubFields) ? "*" : qf.SubFields; - _dataTable.Clear(); - int recCount = _accessDb.QueryTable(_tableName, subFields, whereClause, qf.PostfixClause, _dataTable); - _dataTable.PrimaryKey = new DataColumn[] { _dataTable.Columns[_tableInfo.FieldInfo.ObjectIdField] }; - if (recCount == 0) return result; - if (sqf == null) - { - result = _dataTable.AsEnumerable().Select(row => (int)row[_tableInfo.FieldInfo.ObjectIdField]).ToList(); - } - else - { - result = _dataTable.AsEnumerable().Where(Row => CheckSpatialQuery (sqf, Row[_tableInfo.GeometryFieldName])).Select(row => (int)row[_tableInfo.FieldInfo.ObjectIdField]).ToList(); - } - return result; - } - - private bool CheckSpatialQuery (SpatialQueryFilter sqf, object geomFromDb) - { - var geom = GetGeometryFromBuffer ((byte [])geomFromDb, _spatialReference); - if (geom == null) - { - return false; - } - return HasRelationship(GeometryEngine.Instance, - sqf.FilterGeometry, geom, sqf.SpatialRelationship); - } - - private static Geometry GetGeometryFromBuffer (byte[] geomBuffer, SpatialReference sr) - { - var geomType = GetGeometryType(geomBuffer); - switch (geomType) - { - case GeometryType.Point: - { - int offset = 4; - double x = DoubleWithNaN(BitConverter.ToDouble(geomBuffer, offset)); - offset += 8; - double y = DoubleWithNaN(BitConverter.ToDouble(geomBuffer, offset)); - - var mp = MapPointBuilder.FromEsriShape(geomBuffer, sr); - System.Diagnostics.Debug.WriteLine($@"x: {x} = {mp.X} y: {y} = {mp.Y}"); - return mp; - } - case GeometryType.Polyline: - { - var line = PolylineBuilder.FromEsriShape(geomBuffer, sr); - return line; - } - - case GeometryType.Polygon: - { - var poly = PolygonBuilder.FromEsriShape(geomBuffer, sr); - return poly; - } - } - return null; - } - - private static double DoubleWithNaN(double d) - { - return (d < -1.0e38) ? double.NaN : d; - } - - private static GeometryType GetGeometryType(byte[] buffer, int offset = 0) - { - // read the shape type - int typeInt = BitConverter.ToInt32(buffer, offset); - int type = (int)(typeInt & (int)0x000000FF); - - switch (type) - { - case 0: - return GeometryType.Unknown; - case 1: - // A point consists of a pair of double-precision coordinates. - case 21: - // A PointM consists of a pair of double-precision coordinates in the order X, Y, plus a measure M. - case 11: - // A PointZM consists of a triplet of double-precision coordinates plus a measure. - case 9: - // A PointZ consists of a triplet of double-precision coordinates in the order X, Y, Z where Z usually represents height. - return GeometryType.Point; - case 3: - // PolyLine is an ordered set of vertices that consists of one or more parts. A part is a - // connected sequence of two or more points. Parts may or may not be connected to one - // another. Parts may or may not intersect one another. - case 23: - // A shapefile PolyLineM consists of one or more parts. A part is a connected sequence of - // two or more points. Parts may or may not be connected to one another. Parts may or may - // not intersect one another. - case 13: - // A shapefile PolyLineZM consists of one or more parts. A part is a connected sequence of - // two or more points. Parts may or may not be connected to one another. Parts may or may - // not intersect one another. - case 10: - // A PolyLineZ consists of one or more parts. A part is a connected sequence of two or - // more points. Parts may or may not be connected to one another. Parts may or may not - // intersect one another. - return GeometryType.Polyline; - case 5: - // A polygon consists of one or more rings. A ring is a connected sequence of four or more - // points that form a closed, non-self-intersecting loop. A polygon may contain multiple - // outer rings. The order of vertices or orientation for a ring indicates which side of the ring - // is the interior of the polygon. The neighborhood to the right of an observer walking along - // the ring in vertex order is the neighborhood inside the polygon. Vertices of rings defining - // holes in polygons are in a counterclockwise direction. Vertices for a single, ringed - // polygon are, therefore, always in clockwise order. The rings of a polygon are referred to - // as its parts. - case 25: - // A PolygonM consists of a number of rings. A ring is a closed, non-self-intersecting loop. - case 15: - // A PolygonZM consists of a number of rings. A ring is a closed, non-self-intersecting loop. - case 19: - // A PolygonZ consists of a number of rings. A ring is a closed, non-self-intersecting loop. - // A PolygonZ may contain multiple outer rings. The rings of a PolygonZ are referred to as - // its parts. - return GeometryType.Polygon; - default: - throw new Exception($@"Unknown shape type {type}"); - } - } - - internal static bool HasRelationship(IGeometryEngine engine, - Geometry geom1, - Geometry geom2, - SpatialRelationship relationship) - { - switch (relationship) - { - case SpatialRelationship.Intersects: - return engine.Intersects(geom1, geom2); - case SpatialRelationship.IndexIntersects: - return engine.Intersects(geom1, geom2); - case SpatialRelationship.EnvelopeIntersects: - return engine.Intersects(geom1.Extent, geom2.Extent); - case SpatialRelationship.Contains: - return engine.Contains(geom1, geom2); - case SpatialRelationship.Crosses: - return engine.Crosses(geom1, geom2); - case SpatialRelationship.Overlaps: - return engine.Overlaps(geom1, geom2); - case SpatialRelationship.Touches: - return engine.Touches(geom1, geom2); - case SpatialRelationship.Within: - return engine.Within(geom1, geom2); - } - return false;//unknown relationship - } - - private List GetQuerySubFields(QueryFilter qf) - { - //Honor Subfields in Query Filter - string columns = qf.SubFields ?? "*"; - List subFields; - if (columns == "*") - { - subFields = this.GetFields().Select(col => col.Name.ToUpper()).ToList(); - } - else - { - var names = columns.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); - subFields = names.Select(n => n.ToUpper()).ToList(); - } - - return subFields; - } - - #endregion Internal Processing - - #region IPluginRowProvider - - /// - /// Find a given row (using Object ID) and retrieve attributes using columnFilter and output spatial reference - /// - /// Search for this record using this Object ID - /// List of Column Names to be returned - /// project spatial data using this output spatial reference - /// PlugInRow - public PluginRow FindRow(int oid, IEnumerable columnFilter, SpatialReference srout) - { - Geometry shape = null; - - List values = new List(); - // oid happens to be the primary key as well - var row = _dataTable.Rows.Find (oid); - //The order of the columns in the returned rows ~must~ match - //GetFields. If a column is filtered out, an empty placeholder must - //still be provided even though the actual value is skipped - var columnNames = this.GetFields().Select(col => col.Name.ToUpper()).ToList(); - foreach (var colName in columnNames) - { - if (columnFilter.Contains(colName)) - { - //special handling for shape - if (colName.Equals (_tableInfo.GeometryFieldName, StringComparison.CurrentCultureIgnoreCase)) - { - var geomBuffer = (byte [])row[_tableInfo.GeometryFieldName]; - shape = GetGeometryFromBuffer(geomBuffer, _spatialReference); - if (srout != null) - { - if (!srout.Equals(_spatialReference)) - shape = GeometryEngine.Instance.Project(shape, srout); - } - values.Add(shape); - } - else - { - values.Add(row[colName]); - } - } - else - { - values.Add(DBNull.Value);//place holder - } - } - return new PluginRow() { Values = values }; - } - - #endregion IPluginRowProvider - - #region IDisposable Support - - private bool disposedValue = false; // To detect redundant calls - - /// - /// Clean up resources - /// - /// - protected virtual void Dispose(bool disposing) - { - if (!disposedValue) - { - if (_dataTable == null) - return; - - if (disposing) - { - _dataTable?.Clear(); - _gisExtent = null; - } - disposedValue = true; - } - } - - // TODO: override a finalizer only if Dispose(bool disposing) above has code to free unmanaged resources. - // ~ProPluginTableTemplate() - // { - // // Do not change this code. Put cleanup code in Dispose(bool disposing) above. - // Dispose(false); - // } - - /// - /// This code added to correctly implement the disposable pattern. - /// - public void Dispose() - { - // Do not change this code. Put cleanup code in Dispose(bool disposing) above. - Dispose(true); - // TODO: uncomment the following line if the finalizer is overridden above. - // GC.SuppressFinalize(this); - } - - #endregion - - } -} diff --git a/Plugin/ProDataReader/ProMdbPluginDatasource/Properties/AssemblyInfo.cs b/Plugin/ProDataReader/ProMdbPluginDatasource/Properties/AssemblyInfo.cs deleted file mode 100644 index d1705e89..00000000 --- a/Plugin/ProDataReader/ProMdbPluginDatasource/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,54 +0,0 @@ -/* - - Copyright 2019 Esri - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - - See the License for the specific language governing permissions and - limitations under the License. - -*/ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("ProMdbPluginDatasource")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Acme")] -[assembly: AssemblyProduct("ProMdbPluginDatasource")] -[assembly: AssemblyCopyright("Copyright © Acme 2019")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("6e6e1223-1fcc-45af-ab6f-aa65299ec84b")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Plugin/ProDataReader/Properties/AssemblyInfo.cs b/Plugin/ProDataReader/Properties/AssemblyInfo.cs deleted file mode 100644 index 74b896ea..00000000 --- a/Plugin/ProDataReader/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,54 +0,0 @@ -/* - - Copyright 2017 Esri - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - - See the License for the specific language governing permissions and - limitations under the License. - -*/ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("ProDataReader")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Acme")] -[assembly: AssemblyProduct("ProDataReader")] -[assembly: AssemblyCopyright("Copyright © Acme 2019")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("e74a0802-c331-4183-806d-0757122d8733")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Plugin/ProDataReader/ReadMe.md b/Plugin/ProDataReader/ReadMe.md deleted file mode 100644 index 2e328ed5..00000000 --- a/Plugin/ProDataReader/ReadMe.md +++ /dev/null @@ -1,71 +0,0 @@ -## ProDataReader - - -ProDataReader implements a three plugin datasources to read the following: -- Classic ArcGIS Personal Geodatabase: A personal geodatabase is a Microsoft Access database that can store, query, and manage both spatial and nonspatial data. ProMdbPluginDatasource implements read-only access to personal geodatabase feature class data. -- Jpg photos with GPS metadata: smart phone and digital cameras have the option to capture GPS information when a photo is taken. ProJpgPluginDatasource allows to access these GPS enable photos as a read-only feature class. -- Gpx data: GPX (the GPS eXchange Format) is a data format for exchanging GPS data between programs and implemented by many GPS tracking devices. ProGpxPluginDatasource allows to access Gpx files as a read-only feature class. - - - -View it live - - -``` -Language: C# -Subject: Framework -Contributor: ArcGIS Pro SDK Team -Organization: Esri, http://www.esri.com -Date: 6/27/2019 -ArcGIS Pro: 2.4 -Visual Studio: 2019 -.NET Target Framework: 4.7.2 -``` - -## Resources - -* [API Reference online](https://pro.arcgis.com/en/pro-app/sdk/api-reference) -* ArcGIS Pro SDK for .NET (pro.arcgis.com) -* [arcgis-pro-sdk-community-samples](https://github.com/Esri/arcgis-pro-sdk-community-samples) -* [ArcGIS Pro DAML ID Reference](https://github.com/Esri/arcgis-pro-sdk/wiki/ArcGIS-Pro-DAML-ID-Reference) -* [FAQ](https://github.com/Esri/arcgis-pro-sdk/wiki/FAQ) -* [ArcGIS Pro SDK icons](https://github.com/Esri/arcgis-pro-sdk/releases/tag/2.4.0.19948) - -![ArcGIS Pro SDK for .NET Icons](https://Esri.github.io/arcgis-pro-sdk/images/Home/Image-of-icons.png "ArcGIS Pro SDK Icons") - -### Samples Data - -* Sample data for ArcGIS Pro SDK Community Samples can be downloaded from the [repo releases](https://github.com/Esri/arcgis-pro-sdk-community-samples/releases) page. - -## How to use the sample - -1. Download the Community Sample data (see under the 'Resources' section for downloading sample data) -1. Make sure that the Sample data is unzipped in c:\data -1. The data used in this sample is located in this folder 'C:\Data\TestPersonalGdb' -1. Also in order to access Microsoft Access database files you need to download a 64 bit driver which can be downloaded from Microsoft here: https://www.microsoft.com/en-us/download/details.aspx?id=13255 -1. In Visual Studio click the Build menu. Then select Build Solution. -1. Click Start button to open ArcGIS Pro. -1. In ArcGIS Pro create a new Map using the Empty Map Template. -1. Open the Catalog Dockpane and add new Folder Connection to connect this folder 'C:\Data\TestPersonalGdb' -![UI](Screenshots/Screen1.png) - -1. On the Catalog Dockpane open the TestPersonalGdg folder to explore the ProMdb Project Item which allows you to 'drill-down' to the feature class content of ArcGIS personal geodatabases. -1. Open the TestPersonalGdg folder to find the TestPGdb.arcgismdb personal geodatabase. The Personal Geodatabase file extension is usually .mdb, however, ArcGIS Pro doesn't allow project custom items with that extension, hence the renaming of the file extension to ArcGISMdb. -![UI](Screenshots/Screen2.png) - -1. In the source code look at the ProMdbProjectItem class, which is used to implement the TestPGdb.arcgismdb node. -![UI](Screenshots/Screen3.png) - -1. Under the TestPGdb.arcgismdb node you can see all point/line/polygon feature classes of the personal geodatabase. In source code, the ProMdbTable class is used to prepresent each table. -1. Right clicking on the TestPGdb.arcgismdb node allows to add TestPGdb.arcgismdb as a Project Item. In the source code this is done in AddToProject button class. -1. Right clicking on any of the feature classes allows the feature class to be added to the current map. In the source code this is done in the AddToCurrentMap button class. -1. After you add a ProMdbTable item to the current map, the ProMdbPluginDatasource plug-in is used to convert the MS access table content into a feature class that can be added to a map and displayed as an attribute table. -![UI](Screenshots/Screen5.png) - - - - - -      ArcGIS Pro SDK for Microsoft .NET Framework -             -[Home](https://github.com/Esri/arcgis-pro-sdk/wiki) | API Reference | [Requirements](https://github.com/Esri/arcgis-pro-sdk/wiki#requirements) | [Download](https://github.com/Esri/arcgis-pro-sdk/wiki#installing-arcgis-pro-sdk-for-net) | Samples diff --git a/Plugin/ProDataReader/RibbonUI.cs b/Plugin/ProDataReader/RibbonUI.cs deleted file mode 100644 index cfa41e61..00000000 --- a/Plugin/ProDataReader/RibbonUI.cs +++ /dev/null @@ -1,156 +0,0 @@ -/* - - Copyright 2017 Esri - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - - See the License for the specific language governing permissions and - limitations under the License. - -*/ -using ArcGIS.Core.Data; -using ArcGIS.Core.Data.PluginDatastore; -using ArcGIS.Desktop.Core; -using ArcGIS.Desktop.Framework.Contracts; -using ArcGIS.Desktop.Framework.Dialogs; -using ArcGIS.Desktop.Framework.Threading.Tasks; -using ArcGIS.Desktop.Mapping; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ProDataReader -{ - - internal class DelFromProject : Button - { - protected override void OnClick() - { - var catalog = Project.GetCatalogPane(); - var items = catalog.SelectedItems; - var item = items.OfType().FirstOrDefault(); - if (item == null) return; - try - { - QueuedTask.Run(() => Project.Current.RemoveItem(item)); - } - catch (Exception ex) - { - MessageBox.Show($@"Unable to remove from project: {ex.Message}"); - } - } - } - - internal class AddToProject : Button - { - protected override void OnClick() - { - var catalog = Project.GetCatalogPane(); - var items = catalog.SelectedItems; - var item = items.OfType().FirstOrDefault(); - if (item == null) return; - try - { - QueuedTask.Run(() => Project.Current.AddItem(item.Clone())); - } - catch (Exception ex) - { - MessageBox.Show($@"Unable to add to project: {ex.Message}"); - } - } - } - - - internal class AddToCurrentMap : Button - { - protected async override void OnClick() - { - var catalog = Project.GetCatalogPane(); - var items = catalog.SelectedItems; - var ProDataSubItems = items.OfType(); - foreach (var item in ProDataSubItems) - { - try - { - await QueuedTask.Run(() => - { - switch (item.SubItemType) - { - case ProDataSubItem.EnumSubItemType.DirType: - break; - case ProDataSubItem.EnumSubItemType.GpxType: - var conGpx = new PluginDatasourceConnectionPath("ProGpxPluginDatasource", - new Uri(item.Path, UriKind.Absolute)); - using (var pluginGpx = new PluginDatastore(conGpx)) - { - System.Diagnostics.Debug.Write($"Table: {item.Path}\r\n"); - foreach (var tn in pluginGpx.GetTableNames()) - { - using (var table = pluginGpx.OpenTable(tn)) - { - //Add as a layer to the active map or scene - LayerFactory.Instance.CreateFeatureLayer((FeatureClass)table, MapView.Active.Map); - } - } - } - break; - case ProDataSubItem.EnumSubItemType.ImgDirType: - case ProDataSubItem.EnumSubItemType.ImgType: - var conJpg = new PluginDatasourceConnectionPath("ProJpgPluginDatasource", - new Uri(item.Path, UriKind.Absolute)); - using (var pluginJpg = new PluginDatastore(conJpg)) - { - System.Diagnostics.Debug.Write($"Table: {item.Path}\r\n"); - //open each table....use the returned table name - //or just pass in the name of a csv file in the workspace folder - foreach (var tn in pluginJpg.GetTableNames()) - { - using (var table = pluginJpg.OpenTable(tn)) - { - //Add as a layer to the active map or scene - LayerFactory.Instance.CreateFeatureLayer((FeatureClass)table, MapView.Active.Map); - } - } - } - break; - case ProDataSubItem.EnumSubItemType.MdbType: - // path is comprised for access DB path followed by table name - var idxLast = item.Path.LastIndexOf(Path.DirectorySeparatorChar); - var path = item.Path.Substring(0, idxLast); - var tableName = item.Path.Substring(idxLast + 1); - var conMdb = new PluginDatasourceConnectionPath("ProMdbPluginDatasource", - new Uri(path, UriKind.Absolute)); - using (var pluginMdb = new PluginDatastore(conMdb)) - { - System.Diagnostics.Debug.Write($"Table: {tableName}\r\n"); - //open each table....use the returned table name - //or just pass in the name of a csv file in the workspace folder - using (var table = pluginMdb.OpenTable(tableName)) - { - //Add as a layer to the active map or scene - LayerFactory.Instance.CreateFeatureLayer((FeatureClass)table, MapView.Active.Map); - } - } - break; - } - }); - } - catch (Exception ex) - { - MessageBox.Show($@"Unable to add to map: {ex.Message}"); - } - } - } - } -} diff --git a/Plugin/ProDataReader/Screenshots/Screen1.png b/Plugin/ProDataReader/Screenshots/Screen1.png deleted file mode 100644 index b61ec760..00000000 Binary files a/Plugin/ProDataReader/Screenshots/Screen1.png and /dev/null differ diff --git a/Plugin/ProDataReader/Screenshots/Screen2.png b/Plugin/ProDataReader/Screenshots/Screen2.png deleted file mode 100644 index ba9fcfff..00000000 Binary files a/Plugin/ProDataReader/Screenshots/Screen2.png and /dev/null differ diff --git a/Plugin/ProDataReader/Screenshots/Screen3.png b/Plugin/ProDataReader/Screenshots/Screen3.png deleted file mode 100644 index e0e16e9f..00000000 Binary files a/Plugin/ProDataReader/Screenshots/Screen3.png and /dev/null differ diff --git a/Plugin/ProDataReader/Screenshots/Screen5.png b/Plugin/ProDataReader/Screenshots/Screen5.png deleted file mode 100644 index 7318d099..00000000 Binary files a/Plugin/ProDataReader/Screenshots/Screen5.png and /dev/null differ diff --git a/Plugin/ReadMe.md b/Plugin/ReadMe.md index 7c739d27..8abd7c13 100644 --- a/Plugin/ReadMe.md +++ b/Plugin/ReadMe.md @@ -13,7 +13,6 @@ This repository contains ArcGIS Pro Add-In Samples for the ArcGIS Pro 2.4 SDK fo This folder contains ArcGIS Pro Add-In Samples that fall under the 'Plugin' topic: -* [ProDataReader (c#)](../../../tree/master/Plugin/ProDataReader) * [SimplePointPluginTest (c#)](../../../tree/master/Plugin/SimplePointPluginTest) diff --git a/README.md b/README.md index 54e56826..ac2487b1 100644 --- a/README.md +++ b/README.md @@ -274,7 +274,6 @@ Below is the list of 165 ArcGIS Pro samples that are included in this repository #### Plugins -* [ProDataReader (c#)](../../tree/master/Plugin/ProDataReader) * [SimplePointPluginTest (c#)](../../tree/master/Plugin/SimplePointPluginTest) diff --git a/Samples.sln b/Samples.sln index dfbd9e63..c7ff6789 100644 --- a/Samples.sln +++ b/Samples.sln @@ -317,19 +317,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScreenCoordsToMapPoint", "M EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GetAddins", "Framework\GetAddins\GetAddins.csproj", "{78680B40-94CC-40E3-8F10-9CF962AD9AE2}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProJpgPluginDatasource", "Plugin\ProDataReader\ProJpgPluginDatasource\ProJpgPluginDatasource.csproj", "{3DE57E08-5EF4-47E7-9C11-569061FDA3D5}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProDataReader", "Plugin\ProDataReader\ProDataReader.csproj", "{E74A0802-C331-4183-806D-0757122D8733}" - ProjectSection(ProjectDependencies) = postProject - {3DE57E08-5EF4-47E7-9C11-569061FDA3D5} = {3DE57E08-5EF4-47E7-9C11-569061FDA3D5} - {6E6E1223-1FCC-45AF-AB6F-AA65299EC84B} = {6E6E1223-1FCC-45AF-AB6F-AA65299EC84B} - {98666CC8-996F-49CF-81F4-03EFB4C941FC} = {98666CC8-996F-49CF-81F4-03EFB4C941FC} - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MdbAccessDb", "Plugin\ProDataReader\ProMdbAccessDb\MdbAccessDb.csproj", "{00B0AAC0-BF42-44D6-8638-15B563782CE2}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImageMetadata", "Plugin\ProDataReader\ImageMetadata\ImageMetadata.csproj", "{270B962C-93E5-473F-B502-D05D639CC51D}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimplePointPlugin", "Plugin\SimplePointPluginTest\SimplePointPlugin\SimplePointPlugin.csproj", "{EB50B355-3CC8-4CAD-BA92-142FE4D9C783}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimplePointPluginTest", "Plugin\SimplePointPluginTest\SimplePointPluginTest.csproj", "{A42EEC68-8DA2-42AB-83E7-775F1B4BFBD7}" @@ -337,10 +324,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimplePointPluginTest", "Pl {EB50B355-3CC8-4CAD-BA92-142FE4D9C783} = {EB50B355-3CC8-4CAD-BA92-142FE4D9C783} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProGpxPluginDatasource", "Plugin\ProDataReader\ProGfxPluginDatasource\ProGpxPluginDatasource.csproj", "{98666CC8-996F-49CF-81F4-03EFB4C941FC}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProMdbPluginDatasource", "Plugin\ProDataReader\ProMdbPluginDatasource\ProMdbPluginDatasource.csproj", "{6E6E1223-1FCC-45AF-AB6F-AA65299EC84B}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SceneCalcTools", "SceneLayers\SceneCalcTools\SceneCalcTools.csproj", "{39250B85-F035-467D-A7FC-C2B072901A18}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SymbolLookup", "Map-Authoring\SymbolLookup\SymbolLookup.csproj", "{8A76CDC2-C4E1-4C72-ADE1-5542A7DB7573}"