예제 #1
0
 /// <summary>
 /// Copy constructor
 /// </summary>
 public CoordinateSystem(CoordinateSystem hCS)
 {
     szProjection = hCS.Projection;
     szDatum = hCS.Datum;
     szMethod = hCS.Method;
     szUnits = hCS.Units;
     szLocalDatum = hCS.LocalDatum;
     szEsri = hCS.Esri;
     m_eProjectionType = hCS.ProjectionType;
 }
예제 #2
0
        /// <summary>
        /// Default construtor
        /// </summary>
        public BoundingBox()
        {
            m_dMaxX = DOUBLE_DUMMY;
            m_dMaxY = DOUBLE_DUMMY;
            m_dMinX = DOUBLE_DUMMY;
            m_dMinY = DOUBLE_DUMMY;
            m_dMinZ = DOUBLE_DUMMY;
            m_dMaxZ = DOUBLE_DUMMY;

            // --- set the default coordinate system to WGS 84 ---
            m_hCoordinateSystem = new CoordinateSystem();
            m_hCoordinateSystem.Datum = "WGS 84";
        }
예제 #3
0
 /// <summary>
 /// Encode the request to translate a bounding box from one coordinate system to another
 /// </summary>
 /// <param name="szHandle">The handle which uniquly identifies this request/response pair</param>
 /// <param name="hBoundingBox">The bounding box to translate</param>
 /// <param name="hOutputCoordinateSystem">The destination coordinate system</param>
 /// <returns>The GeosoftXML request</returns>
 public System.Xml.XmlDocument TranslateBoundingBox(string szHandle,
     BoundingBox hBoundingBox,
     CoordinateSystem hOutputCoordinateSystem)
 {
     return TranslateBoundingBox(szHandle, hBoundingBox, hOutputCoordinateSystem, 0);
 }
예제 #4
0
        /// <summary>
        /// Encode COORDINATE_SYSTEM element
        /// </summary>
        /// <param name="oParent">The parent node</param>
        /// <param name="oCoordinateSystem">The coordinate system to encode</param>
        /// <returns>COORDINATE_SYSTEM element</returns>
        private System.Xml.XmlNode AddCoordinateSystem(System.Xml.XmlNode oParent,
            CoordinateSystem oCoordinateSystem)
        {
            System.Xml.XmlElement hNode = oParent.OwnerDocument.CreateElement(Constant.Tag.COORDINATE_SYSTEM_TAG);

            if (oCoordinateSystem.ProjectionType == CoordinateSystem.ProjectionTypes.STANDARD)
            {
                if (oCoordinateSystem.Datum != null && oCoordinateSystem.Datum.Length != 0)
                {
                    System.Xml.XmlAttribute dataSetAttr = oParent.OwnerDocument.CreateAttribute(Geosoft.Dap.Xml.Common.Constant.Attribute.DATUM_ATTR);
                    dataSetAttr.Value = oCoordinateSystem.Datum;
                    hNode.SetAttributeNode(dataSetAttr);
                }

                if (oCoordinateSystem.Method != null && oCoordinateSystem.Method.Length != 0)
                {
                    System.Xml.XmlAttribute dataSetAttr = oParent.OwnerDocument.CreateAttribute(Geosoft.Dap.Xml.Common.Constant.Attribute.PROJECTION_ATTR);
                    dataSetAttr.Value = oCoordinateSystem.Method;
                    hNode.SetAttributeNode(dataSetAttr);
                }

                if (oCoordinateSystem.Units != null && oCoordinateSystem.Units.Length != 0)
                {
                    System.Xml.XmlAttribute dataSetAttr = oParent.OwnerDocument.CreateAttribute(Geosoft.Dap.Xml.Common.Constant.Attribute.UNITS_ATTR);
                    dataSetAttr.Value = oCoordinateSystem.Units;
                    hNode.SetAttributeNode(dataSetAttr);
                }

                if (oCoordinateSystem.LocalDatum != null && oCoordinateSystem.LocalDatum.Length != 0)
                {
                    System.Xml.XmlAttribute dataSetAttr = oParent.OwnerDocument.CreateAttribute(Geosoft.Dap.Xml.Common.Constant.Attribute.LOCAL_DATUM_ATTR);
                    dataSetAttr.Value = oCoordinateSystem.LocalDatum;
                    hNode.SetAttributeNode(dataSetAttr);
                }
            }
            else if (oCoordinateSystem.ProjectionType == CoordinateSystem.ProjectionTypes.ESRI)
            {
                if (oCoordinateSystem.Esri != null && oCoordinateSystem.Esri.Length != 0)
                {
                    System.Xml.XmlAttribute dataSetAttr = oParent.OwnerDocument.CreateAttribute(Geosoft.Dap.Xml.Common.Constant.Attribute.ESRI_ATTR);
                    dataSetAttr.Value = oCoordinateSystem.Esri;
                    hNode.SetAttributeNode(dataSetAttr);
                }
            }
            oParent.AppendChild(hNode);

            return hNode;
        }
예제 #5
0
파일: Command.cs 프로젝트: paladin74/Dapple
        /// <summary>
        /// Translate a series of coordinates to the new projection
        /// </summary>      
        /// <param name="hInputCoordinateSystem">The input coordinate system</param>
        /// <param name="hOutputCoordinateSystem">The output coordinate system</param>
        /// <param name="hItems">The list of points to translate</param>
        /// <param name="progressCallBack">Progress handler (may be null)</param>
        /// <returns>The translated coordinates response in GeosoftXML</returns>
        public System.Xml.XmlDocument TranslateCoordinates(CoordinateSystem hInputCoordinateSystem,
            CoordinateSystem hOutputCoordinateSystem,
            System.Collections.ArrayList hItems,
            UpdateProgessCallback progressCallBack)
        {
            string szUrl;
            System.Xml.XmlDocument hRequestDocument;
            System.Xml.XmlDocument hResponseDocument;

            try
            {
                m_oLock.AcquireReaderLock(-1);
                szUrl = CreateUrl(Constant.Request.TRANSLATE);

                hRequestDocument = m_hEncodeRequest.TranslateCoordinates(null, hInputCoordinateSystem, hOutputCoordinateSystem, hItems);
                hResponseDocument = m_oCommunication.Send(szUrl, hRequestDocument, progressCallBack);
            }
            finally
            {
                m_oLock.ReleaseReaderLock();
            }
            return hResponseDocument;
        }
예제 #6
0
파일: Command.cs 프로젝트: paladin74/Dapple
 /// <summary>
 /// Translate a series of coordinates to the new projection
 /// </summary>      
 /// <param name="hInputCoordinateSystem">The input coordinate system</param>
 /// <param name="hOutputCoordinateSystem">The output coordinate system</param>
 /// <param name="hItems">The list of points to translate</param>
 /// <returns>The translated coordinates response in GeosoftXML</returns>
 public System.Xml.XmlDocument TranslateCoordinates(CoordinateSystem hInputCoordinateSystem,
     CoordinateSystem hOutputCoordinateSystem,
     System.Collections.ArrayList hItems)
 {
     return TranslateCoordinates(hInputCoordinateSystem, hOutputCoordinateSystem, hItems, (UpdateProgessCallback)null);
 }
예제 #7
0
파일: Command.cs 프로젝트: paladin74/Dapple
        /// <summary>
        /// Get the list of supported coordinate systems
        /// </summary>
        /// <param name="eType">The list type. Must be one of DATUM, PROJECTION, UNITS, LOCAL_DATUM_NAME or LOCAL_DATUM_DESCRIPTION</param>
        /// <param name="szDatum">The datum to filter the results</param>
        /// <param name="progressCallBack">Progress handler (may be null)</param>
        /// <returns>The list response in GeosoftXML</returns>
        public System.Xml.XmlDocument GetSupportedCoordinateSystems(CoordinateSystem.Types eType, string szDatum, UpdateProgessCallback progressCallBack)
        {
            string szUrl;
            System.Xml.XmlDocument hRequestDocument;
            System.Xml.XmlDocument hResponseDocument;

            try
            {
                m_oLock.AcquireReaderLock(-1);
                szUrl = CreateUrl(Constant.Request.SUPPORTED_COORDINATE_SYSTEMS);

                hRequestDocument = m_hEncodeRequest.CoordinateSystemList(null, CoordinateSystem.TYPES[Convert.ToInt32(eType)], szDatum);
                hResponseDocument = m_oCommunication.Send(szUrl, hRequestDocument, progressCallBack);
            }
            finally
            {
                m_oLock.ReleaseReaderLock();
            }
            return hResponseDocument;
        }
예제 #8
0
        /// <summary>
        /// Extended constructor
        /// </summary>
        /// <param name="dMaxX">The maximum x coordinate</param>
        /// <param name="dMaxY">The maximum y coordinate</param>
        /// <param name="dMaxZ">The maximum z coordinate</param>
        /// <param name="dMinX">The minimum x coordiante</param>
        /// <param name="dMinY">The minimum y coordinate</param>
        /// <param name="dMinZ">The minimum z coordinate</param>
        public BoundingBox(double dMaxX, double dMaxY, double dMaxZ, double dMinX, double dMinY, double dMinZ)
        {
            m_dMaxX = dMaxX;
            m_dMaxY = dMaxY;
            m_dMaxZ = dMaxZ;
            m_dMinX = dMinX;
            m_dMinY = dMinY;
            m_dMinZ = dMinZ;

            // --- set the default coordinate system to WGS 84 ---
            m_hCoordinateSystem = new CoordinateSystem();
            m_hCoordinateSystem.Datum = "WGS 84";
        }
예제 #9
0
파일: Command.cs 프로젝트: paladin74/Dapple
 /// <summary>
 /// Translate a bounding box into a new projection
 /// </summary>
 /// <param name="hBoundingBox">The bounding box to translate</param>      
 /// <param name="dResolution">The extraction resolution</param>
 /// <param name="hOCS">The output coordinate system</param>
 /// <returns>The translated bounding box in GeosoftXML</returns>
 public System.Xml.XmlDocument TranslateBoundingBox(BoundingBox hBoundingBox, Double dResolution, CoordinateSystem hOCS)
 {
     return TranslateBoundingBox(hBoundingBox, dResolution, hOCS, null);
 }
예제 #10
0
파일: Command.cs 프로젝트: paladin74/Dapple
        /// <summary>
        /// Translate a bounding box into a new projection
        /// </summary>
        /// <param name="hBoundingBox">The bounding box to translate</param>
        /// <param name="hOCS">The output coordinate system</param>
        /// <param name="progressCallBack">Progress handler (may be null)</param>
        /// <returns>The translated bounding box response in GeosoftXML</returns>
        public System.Xml.XmlDocument TranslateBoundingBox(BoundingBox hBoundingBox, CoordinateSystem hOCS, UpdateProgessCallback progressCallBack)
        {
            System.Xml.XmlDocument hResponseDocument;

            hResponseDocument = TranslateBoundingBox(hBoundingBox, 0, hOCS, progressCallBack);
            return hResponseDocument;
        }
예제 #11
0
파일: Command.cs 프로젝트: paladin74/Dapple
 /// <summary>
 /// Translate a bounding box into a new projection
 /// </summary>
 /// <param name="hBoundingBox">The bounding box to translate</param>
 /// <param name="hOCS">The output coordinate system</param>
 /// <returns>The translated bounding box response in GeosoftXML</returns>
 public System.Xml.XmlDocument TranslateBoundingBox(BoundingBox hBoundingBox, CoordinateSystem hOCS)
 {
     return TranslateBoundingBox(hBoundingBox, hOCS, null);
 }
예제 #12
0
파일: Command.cs 프로젝트: paladin74/Dapple
        /// <summary>
        /// Translate a bounding box into a new projection
        /// </summary>
        /// <param name="hBoundingBox">The bounding box to translate</param>
        /// <param name="hOCS">The output coordinate system</param>
        /// <param name="hOutBoundingBox">The translated bounding box</param>
        /// <param name="progressCallBack">Progress handler (may be null)</param>
        /// <returns>The translated bounding box response in GeosoftXML</returns>
        public void TranslateBoundingBox(BoundingBox hBoundingBox, CoordinateSystem hOCS, out BoundingBox hOutBoundingBox, UpdateProgessCallback progressCallBack)
        {
            System.Xml.XmlDocument hResponseDocument;
            Double dResolution;

            hResponseDocument = TranslateBoundingBox(hBoundingBox, 0, hOCS, progressCallBack);
            m_hParse.TranslateBoundingBox(hResponseDocument, out hOutBoundingBox, out dResolution);
        }
예제 #13
0
파일: Command.cs 프로젝트: paladin74/Dapple
 /// <summary>
 /// Translate a bounding box into a new projection
 /// </summary>
 /// <param name="hBoundingBox">The bounding box to translate</param>
 /// <param name="hOCS">The output coordinate system</param>
 /// <param name="hOutBoundingBox">The translated bounding box</param>
 /// <returns>The translated bounding box response in GeosoftXML</returns>
 public void TranslateBoundingBox(BoundingBox hBoundingBox, CoordinateSystem hOCS, out BoundingBox hOutBoundingBox)
 {
     TranslateBoundingBox(hBoundingBox, hOCS, out hOutBoundingBox, null);
 }
예제 #14
0
파일: Command.cs 프로젝트: paladin74/Dapple
 /// <summary>
 /// Translate a bounding box into a new projection
 /// </summary>
 /// <param name="hBoundingBox">The bounding box to translate</param>
 /// <param name="hOCS">The output coordinate system</param>
 /// <param name="dResolution">The extraction resolution</param>
 /// <param name="hOutBoundingBox">The translated bounding box</param>
 public void TranslateBoundingBox(BoundingBox hBoundingBox, CoordinateSystem hOCS, ref Double dResolution, out BoundingBox hOutBoundingBox)
 {
     TranslateBoundingBox(hBoundingBox, hOCS, ref dResolution, out hOutBoundingBox, (UpdateProgessCallback)null);
 }
예제 #15
0
        /// <summary>
        /// Encode the request to translate a bounding box from one coordinate system to another
        /// </summary>
        /// <param name="szHandle">The handle which uniquly identifies this request/response pair</param>
        /// <param name="hBoundingBox">The bounding box to translate</param>
        /// <param name="hOutputCoordinateSystem">The destination coordinate system</param>
        /// <param name="dResolution">The current resolution that you wish to have translated to the new coordinate system</param>
        /// <returns>The GeosoftXML request</returns>
        public System.Xml.XmlDocument TranslateBoundingBox(string szHandle,
            BoundingBox hBoundingBox,
            CoordinateSystem hOutputCoordinateSystem,
            double dResolution)
        {
            // --- Create required Nodes ---

            System.Xml.XmlAttribute hAttr;
            System.Xml.XmlElement hTranslateBoundingBoxNode = CreateRequest(szHandle, Constant.Tag.TRANSLATE_BOUNDING_BOX_TAG);
            System.Xml.XmlNode hBoundingBoxNode;

            // --- Setup hierchy ---

            hBoundingBoxNode = AddBoundingBox(hTranslateBoundingBoxNode, hBoundingBox);
            AddCoordinateSystem(hBoundingBoxNode, hBoundingBox.CoordinateSystem);
            AddCoordinateSystem(hTranslateBoundingBoxNode, hOutputCoordinateSystem);

            // --- Add attributes ---

            if (dResolution != 0)
            {
                System.Xml.XmlElement hResolutionNode = hTranslateBoundingBoxNode.OwnerDocument.CreateElement(Constant.Tag.RESOLUTION_TAG);

                hAttr = hTranslateBoundingBoxNode.OwnerDocument.CreateAttribute(Constant.Attribute.VALUE_ATTR);
                hAttr.Value = dResolution.ToString(System.Globalization.CultureInfo.InvariantCulture);
                hResolutionNode.SetAttributeNode(hAttr);
                hTranslateBoundingBoxNode.AppendChild(hResolutionNode);
            }

            return hTranslateBoundingBoxNode.OwnerDocument;
        }
예제 #16
0
        /// <summary>
        /// Encode the request to translate a list of coordinates from one coordinate system to another
        /// </summary>
        /// <param name="szHandle">The handle which uniquly identifies this request/response pair</param>
        /// <param name="hInputCoordinateSystem">The current coordinate system the points are in</param>
        /// <param name="hOutputCoordinateSystem">The destination coordiante system you wish the points to be translated to</param>
        /// <param name="hItems">The list of points</param>
        /// <returns>The GeosoftXML request</returns>
        public System.Xml.XmlDocument TranslateCoordinates(string szHandle,
            CoordinateSystem hInputCoordinateSystem,
            CoordinateSystem hOutputCoordinateSystem,
            System.Collections.ArrayList hItems)
        {
            // --- Create required Nodes ---

            System.Xml.XmlAttribute hAttr;
            System.Xml.XmlElement hTranslateCoordinatesNode = CreateRequest(szHandle, Constant.Tag.TRANSLATE_COORDINATES_TAG);
            System.Xml.XmlElement hInputNode = hTranslateCoordinatesNode.OwnerDocument.CreateElement(Constant.Tag.INPUT_TAG);
            System.Xml.XmlElement hOutputNode = hTranslateCoordinatesNode.OwnerDocument.CreateElement(Constant.Tag.OUTPUT_TAG);

            // --- Setup hierchy ---

            hTranslateCoordinatesNode.AppendChild(hInputNode);
            hTranslateCoordinatesNode.AppendChild(hOutputNode);

            AddCoordinateSystem(hInputNode, hInputCoordinateSystem);
            AddCoordinateSystem(hOutputNode, hOutputCoordinateSystem);

            foreach (Point item in hItems)
            {
                System.Xml.XmlElement hPointElement = hTranslateCoordinatesNode.OwnerDocument.CreateElement(Constant.Tag.POINT_TAG);

                hAttr = hTranslateCoordinatesNode.OwnerDocument.CreateAttribute(Constant.Attribute.X_ATTR);
                hAttr.Value = item.X.ToString(System.Globalization.CultureInfo.InvariantCulture);
                hPointElement.SetAttributeNode(hAttr);

                hAttr = hTranslateCoordinatesNode.OwnerDocument.CreateAttribute(Constant.Attribute.Y_ATTR);
                hAttr.Value = item.Y.ToString(System.Globalization.CultureInfo.InvariantCulture);
                hPointElement.SetAttributeNode(hAttr);

                hAttr = hTranslateCoordinatesNode.OwnerDocument.CreateAttribute(Constant.Attribute.Z_ATTR);
                hAttr.Value = item.Z.ToString(System.Globalization.CultureInfo.InvariantCulture);
                hPointElement.SetAttributeNode(hAttr);

                hTranslateCoordinatesNode.AppendChild(hPointElement);
            }
            return hTranslateCoordinatesNode.OwnerDocument;
        }
예제 #17
0
파일: Command.cs 프로젝트: paladin74/Dapple
        /// <summary>
        /// Translate a bounding box into a new projection
        /// </summary>
        /// <param name="hBoundingBox">The bounding box to translate</param>      
        /// <param name="dResolution">The extraction resolution</param>
        /// <param name="hOCS">The output coordinate system</param>
        /// <param name="progressCallBack">Progress handler (may be null)</param>
        /// <returns>The translated bounding box in GeosoftXML</returns>
        public System.Xml.XmlDocument TranslateBoundingBox(BoundingBox hBoundingBox, Double dResolution, CoordinateSystem hOCS, UpdateProgessCallback progressCallBack)
        {
            string szUrl;
            System.Xml.XmlDocument hRequestDocument;
            System.Xml.XmlDocument hResponseDocument;

            try
            {
                m_oLock.AcquireReaderLock(-1);
                szUrl = CreateUrl(Constant.Request.TRANSLATE);

                hRequestDocument = m_hEncodeRequest.TranslateBoundingBox(null, hBoundingBox, hOCS, dResolution);
                hResponseDocument = m_oCommunication.Send(szUrl, hRequestDocument, progressCallBack);
            }
            finally
            {
                m_oLock.ReleaseReaderLock();
            }
            return hResponseDocument;
        }
예제 #18
0
        /// <summary>
        /// Extended constructor
        /// </summary>
        /// <param name="hBox">Bounding Box to copy</param>
        public BoundingBox(BoundingBox hBox)
        {
            m_dMaxX = hBox.m_dMaxX;
            m_dMaxY = hBox.m_dMaxY;
            m_dMaxZ = hBox.m_dMaxZ;
            m_dMinX = hBox.m_dMinX;
            m_dMinY = hBox.m_dMinY;
            m_dMinZ = hBox.m_dMinZ;

            // --- set the default coordinate system to WGS 84 ---
            m_hCoordinateSystem = new CoordinateSystem(hBox.CoordinateSystem);
        }
예제 #19
0
파일: Command.cs 프로젝트: paladin74/Dapple
 /// <summary>
 /// Translate a series of coordinates into a new projection
 /// </summary>
 /// <param name="hICS">The input coordinate system</param>
 /// <param name="hOCS">The output coordinate system</param>
 /// <param name="hItems">The list of points to translate</param>
 /// <param name="hOutItems">The translate points</param>
 public void TranslateCoordinates(CoordinateSystem hICS,
     CoordinateSystem hOCS,
     System.Collections.ArrayList hItems,
     out System.Collections.ArrayList hOutItems)
 {
     TranslateCoordinates(hICS, hOCS, hItems, out hOutItems, null);
 }
예제 #20
0
파일: Command.cs 프로젝트: paladin74/Dapple
        /// <summary>
        /// Translate a series of coordinates into a new projection
        /// </summary>
        /// <param name="hICS">The input coordinate system</param>
        /// <param name="hOCS">The output coordinate system</param>
        /// <param name="hItems">The list of points to translate</param>
        /// <param name="hOutItems">The translate points</param>
        /// <param name="progressCallBack">Progress handler (may be null)</param>
        public void TranslateCoordinates(CoordinateSystem hICS,
            CoordinateSystem hOCS,
            System.Collections.ArrayList hItems,
            out System.Collections.ArrayList hOutItems,
            UpdateProgessCallback progressCallBack)
        {
            System.Xml.XmlDocument hResponseDocument;

            hResponseDocument = TranslateCoordinates(hICS, hOCS, hItems, progressCallBack);
            m_hParse.TranslateCoordinates(hResponseDocument, out hOutItems);
        }
예제 #21
0
파일: Command.cs 프로젝트: paladin74/Dapple
 /// <summary>
 /// Get the list of supported coordinate systems
 /// </summary>
 /// <param name="eType">The list type. Must be one of DATUM, PROJECTION, UNITS, LOCAL_DATUM_NAME or LOCAL_DATUM_DESCRIPTION</param>
 /// <param name="szDatum">The datum to filter the results</param>
 /// <returns>The list response in GeosoftXML</returns>
 public System.Xml.XmlDocument GetSupportedCoordinateSystems(CoordinateSystem.Types eType, string szDatum)
 {
     return GetSupportedCoordinateSystems(eType, szDatum, null);
 }