Esempio n. 1
0
        // =========================================================================
        // Functions
        // =========================================================================
        /// <summary>
        /// xml parsing
        /// </summary>
        /// <param name="mappedFeatureElement">xml</param>
        public void Update(XElement mappedFeatureElement)
        {
            if (mappedFeatureElement != null)
            {
                XElement imageIdElement      = mappedFeatureElement.Element(Namespaces.AtlasNs + "imageId");
                XElement locationElement     = mappedFeatureElement.Element(Namespaces.AtlasNs + "location");
                XElement heightElement       = mappedFeatureElement.Element(Namespaces.AtlasNs + "height");
                XElement latStDevElement     = mappedFeatureElement.Element(Namespaces.AtlasNs + "latitudeStDev");
                XElement lonStDevElement     = mappedFeatureElement.Element(Namespaces.AtlasNs + "longitudeStDev");
                XElement heighStDevElement   = mappedFeatureElement.Element(Namespaces.AtlasNs + "heightStDev");
                XElement yawElement          = mappedFeatureElement.Element(Namespaces.AtlasNs + "yaw");
                XElement yawStDevElement     = mappedFeatureElement.Element(Namespaces.AtlasNs + "yawStDev");
                XElement pitchElement        = mappedFeatureElement.Element(Namespaces.AtlasNs + "pitch");
                XElement pitchStDevElement   = mappedFeatureElement.Element(Namespaces.AtlasNs + "pitchStDev");
                XElement rollElement         = mappedFeatureElement.Element(Namespaces.AtlasNs + "roll");
                XElement rollStDevElement    = mappedFeatureElement.Element(Namespaces.AtlasNs + "rollStDev");
                XElement focalLengthElement  = mappedFeatureElement.Element(Namespaces.AtlasNs + "focalLength");
                XElement priPointXElement    = mappedFeatureElement.Element(Namespaces.AtlasNs + "principalPointX");
                XElement priPointYElement    = mappedFeatureElement.Element(Namespaces.AtlasNs + "principalPointY");
                XElement imageTypeElement    = mappedFeatureElement.Element(Namespaces.AtlasNs + "imageType");
                XElement imageHeightElement  = mappedFeatureElement.Element(Namespaces.AtlasNs + "imageHeight");
                XElement imageWidthElement   = mappedFeatureElement.Element(Namespaces.AtlasNs + "imageWidth");
                XElement isAuthorizedElement = mappedFeatureElement.Element(Namespaces.AtlasNs + "isAuthorized");

                ImageId         = (imageIdElement == null) ? null : imageIdElement.Value.Trim();
                Height          = (heightElement == null) ? null : new Height(heightElement);
                LatitudeStDev   = (latStDevElement == null) ? (double?)null : double.Parse(latStDevElement.Value.Trim(), _ci);
                LongitudeStDev  = (lonStDevElement == null) ? (double?)null : double.Parse(lonStDevElement.Value.Trim(), _ci);
                HeightStDev     = (heighStDevElement == null) ? (double?)null : double.Parse(heighStDevElement.Value.Trim(), _ci);
                Yaw             = (yawElement == null) ? (double?)null : double.Parse(yawElement.Value.Trim(), _ci);
                YawStDev        = (yawStDevElement == null) ? (double?)null : double.Parse(yawStDevElement.Value.Trim(), _ci);
                Pitch           = (pitchElement == null) ? (double?)null : double.Parse(pitchElement.Value.Trim(), _ci);
                PitchStDev      = (pitchStDevElement == null) ? (double?)null : double.Parse(pitchStDevElement.Value.Trim(), _ci);
                Roll            = (rollElement == null) ? (double?)null : double.Parse(rollElement.Value.Trim(), _ci);
                RollStDev       = (rollStDevElement == null) ? (double?)null : double.Parse(rollStDevElement.Value.Trim(), _ci);
                FocalLength     = (focalLengthElement == null) ? (double?)null : double.Parse(focalLengthElement.Value.Trim(), _ci);
                PrincipalPointX = (priPointXElement == null) ? (double?)null : double.Parse(priPointXElement.Value.Trim(), _ci);
                PrincipalPointY = (priPointYElement == null) ? (double?)null : double.Parse(priPointYElement.Value.Trim(), _ci);
                ImageType       = (imageTypeElement == null) ? null : imageTypeElement.Value.Trim();
                ImageHeight     = (imageHeightElement == null) ? (double?)null : double.Parse(imageHeightElement.Value.Trim(), _ci);
                ImageWidth      = (imageWidthElement == null) ? (double?)null : double.Parse(imageWidthElement.Value.Trim(), _ci);
                IsAuthorized    = (isAuthorizedElement == null) ? (bool?)null : bool.Parse(isAuthorizedElement.Value.Trim());

                if (locationElement != null)
                {
                    if (locationElement.Element(Namespaces.GmlNs + "Point") != null)
                    {
                        Shape = new Point(locationElement);
                    }
                }
            }
        }
Esempio n. 2
0
        // =========================================================================
        // Functions
        // =========================================================================
        /// <summary>
        /// xml parsing
        /// </summary>
        /// <param name="mappedFeatureElement">xml</param>
        public void Update(XElement mappedFeatureElement)
        {
            if (mappedFeatureElement != null)
            {
                XAttribute mappedFeatureAttribute = mappedFeatureElement.Attribute(Namespaces.GmlNs + "id");
                XElement   imageIdElement         = mappedFeatureElement.Element(Namespaces.AtlasNs + "imageId");
                XElement   recordedAtElement      = mappedFeatureElement.Element(Namespaces.AtlasNs + "recordedAt");
                XElement   locationElement        = mappedFeatureElement.Element(Namespaces.AtlasNs + "location");
                XElement   heightElement          = mappedFeatureElement.Element(Namespaces.AtlasNs + "height");
                XElement   latPrecElement         = mappedFeatureElement.Element(Namespaces.AtlasNs + "latitudePrecision");
                XElement   lonPrecElement         = mappedFeatureElement.Element(Namespaces.AtlasNs + "longitudePrecision");
                XElement   heigPrecElement        = mappedFeatureElement.Element(Namespaces.AtlasNs + "heightPrecision");
                XElement   orientElement          = mappedFeatureElement.Element(Namespaces.AtlasNs + "orientation");
                XElement   orPrecElement          = mappedFeatureElement.Element(Namespaces.AtlasNs + "orientationPrecision");
                XElement   grLevOffElement        = mappedFeatureElement.Element(Namespaces.AtlasNs + "groundLevelOffset");
                XElement   recDirElement          = mappedFeatureElement.Element(Namespaces.AtlasNs + "recorderDirection");
                XElement   prodTypeElement        = mappedFeatureElement.Element(Namespaces.AtlasNs + "productType");
                XElement   imagesElement          = mappedFeatureElement.Element(Namespaces.AtlasNs + "Images");
                XElement   isAuthorizedElement    = mappedFeatureElement.Element(Namespaces.AtlasNs + "isAuthorized");
                XElement   expiredAtElement       = mappedFeatureElement.Element(Namespaces.AtlasNs + "expiredAt");

                ExpiredAt            = (expiredAtElement == null) ? (DateTime?)null : DateTime.Parse(expiredAtElement.Value.Trim());
                Id                   = (mappedFeatureAttribute == null) ? null : mappedFeatureAttribute.Value.Trim();
                ImageId              = (imageIdElement == null) ? null : imageIdElement.Value.Trim();
                RecordedAt           = (recordedAtElement == null) ? (DateTime?)null : DateTimeOffset.Parse(recordedAtElement.Value.Trim(), null).DateTime;
                Height               = (heightElement == null) ? null : new Height(heightElement);
                LatitudePrecision    = (latPrecElement == null) ? (double?)null : double.Parse(latPrecElement.Value.Trim(), _ci);
                LongitudePrecision   = (lonPrecElement == null) ? (double?)null : double.Parse(lonPrecElement.Value.Trim(), _ci);
                HeightPrecision      = (heigPrecElement == null) ? (double?)null : double.Parse(heigPrecElement.Value.Trim(), _ci);
                Orientation          = (orientElement == null) ? (double?)null : double.Parse(orientElement.Value.Trim(), _ci);
                OrientationPrecision = (orPrecElement == null) ? (double?)null : double.Parse(orPrecElement.Value.Trim(), _ci);
                GroundLevelOffset    = (grLevOffElement == null) ? (double?)null : double.Parse(grLevOffElement.Value.Trim(), _ci);
                RecorderDirection    = (recDirElement == null) ? (double?)null : double.Parse(recDirElement.Value.Trim(), _ci);
                Images               = (imagesElement == null) ? new Images() : new Images(imagesElement);
                IsAuthorized         = (isAuthorizedElement == null) ? (bool?)null : bool.Parse(isAuthorizedElement.Value.Trim());

                ProductType = (prodTypeElement == null)
                        ? ProductType.None
                        : (ProductType)Enum.Parse(typeof(ProductType), prodTypeElement.Value.Trim());

                if (locationElement != null)
                {
                    if (locationElement.Element(Namespaces.GmlNs + "Point") != null)
                    {
                        Shape = new Point(locationElement);
                    }
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// This function updates the value of a field.
        /// </summary>
        /// <param name="name">The name of the field</param>
        /// <param name="item">The item of the field</param>
        public void UpdateItem(string name, object item)
        {
            if (item != null)
            {
                switch (name)
                {
                case "Id":
                    Id = (string)item;
                    break;

                case "ImageId":
                    ImageId = (string)item;
                    break;

                case "RecordedAt":
                    RecordedAt = (DateTime?)item;
                    break;

                case "Height":
                    Height = new Height {
                        Value = (double)item
                    };
                    break;

                case "LatitudePrecision":
                    LatitudePrecision = (double?)item;
                    break;

                case "LongitudePrecision":
                    LongitudePrecision = (double?)item;
                    break;

                case "HeightPrecision":
                    HeightPrecision = (double?)item;
                    break;

                case "Orientation":
                    Orientation = (double?)item;
                    break;

                case "OrientationPrecision":
                    OrientationPrecision = (double?)item;
                    break;

                case "GroundLevelOffset":
                    GroundLevelOffset = (double?)item;
                    break;

                case "RecorderDirection":
                    RecorderDirection = (double?)item;
                    break;

                case "ProductType":
                    ProductType = (ProductType)Enum.Parse(typeof(ProductType), (string)item);
                    break;

                case "IsAuthorized":
                    IsAuthorized = bool.Parse((string)item);
                    break;

                case "ExpiredAt":
                    ExpiredAt = (DateTime?)item;
                    break;

                case "Year":
                    // empty
                    break;

                case "PIP":
                    // empty
                    break;

                case "PIP1Yaw":
                    // empty
                    break;

                case "PIP2Yaw":
                    // empty
                    break;

                case "Location":
                    var point = item as IPoint;

                    if (point != null)
                    {
                        Shape = new Point
                        {
                            X       = point.X,
                            Y       = point.Y,
                            Z       = point.Z,
                            Type    = ShapeType.Point,
                            SrsName = (point.SpatialReference == null) ? string.Empty : point.SpatialReference.Name
                        };
                    }
                    break;
                }
            }
        }