Beispiel #1
0
        public XLSType createXlsRequestTest(string number, string street1, string street2, string city, string requestID)
        {
            XlsDocument xLSDocument = XlsDocument.CreateDocument();
            XLSType     xLSType     = xLSDocument.XLS.Append();

            xLSType.lang.Value = ServiceConfigProperties.Language;
            // should be added one only
            RequestUtil.addXlsHeader(ref xLSType);
            addGeocodeRequest(ref xLSType, number, street1, street2, city, requestID);
            return(xLSType);
        }
        private XLSType createRouteServiceRequest(double VDStart, double KDStart, double VDEnd, double KDEnd)
        {
            XlsDocument xLSDocument    = XlsDocument.CreateDocument();
            XLSType     xLSTypeRequest = xLSDocument.XLS.Append();

            // should be added one only
            RequestUtil.addXlsHeader(ref xLSTypeRequest);

            RequestType requestType = xLSTypeRequest.Request.Append();

            requestType.methodName.Value = "DetermineRouteRequest";

            DetermineRouteRequestType determineRouteRequest = requestType.DetermineRouteRequest.Append();

            RoutePlanType           routePlanType           = determineRouteRequest.RoutePlan.Append();
            RoutePreferenceTypeType routePreferenceTypeType = routePlanType.RoutePreference.Append();

            routePreferenceTypeType.Value = "Shortest";
            WayPointListType wayPointListType = routePlanType.WayPointList.Append();

            // start
            WayPointType       wayPointTypeStartPoint       = wayPointListType.StartPoint.Append();
            PositionType       positionTypeStartPoint       = wayPointTypeStartPoint.Position.Append();
            PointType          pointTypeStartPoint          = positionTypeStartPoint.Point.Append();
            DirectPositionType directPositionTypeStartPoint = pointTypeStartPoint.pos.Append();

            directPositionTypeStartPoint.Value = VDStart.ToString() + " " + KDStart.ToString();

            // end
            WayPointType       wayPointTypeEndPoint       = wayPointListType.EndPoint.Append();
            PositionType       positionTypeEndPoint       = wayPointTypeEndPoint.Position.Append();
            PointType          pointTypeEndPoint          = positionTypeEndPoint.Point.Append();
            DirectPositionType directPositionTypeEndPoint = pointTypeEndPoint.pos.Append();

            directPositionTypeEndPoint.Value = VDEnd.ToString() + " " + KDEnd.ToString();
            determineRouteRequest.RouteGeometryRequest.Append();
            // add this if need the text instructions
            RouteInstructionsRequestType routeInstructionsRequestType = determineRouteRequest.RouteInstructionsRequest.Append();

            routeInstructionsRequestType.format.Value = "text/plain";
            return(xLSTypeRequest);
        }
Beispiel #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="DuLieu"></param>
        /// <returns></returns>
        public XLSType CreateRequest(List <PointF> DuLieu)
        {
            XlsDocument xLSDocument = XlsDocument.CreateDocument();
            XLSType     xLSType     = xLSDocument.XLS.Append();

            xLSType.lang.Value = ServiceConfigProperties.Language;

            if (DuLieu.Count == 0)
            {
                return(xLSType);
            }
            RequestUtil.addXlsHeader(ref xLSType);

            for (int i = 0; i < DuLieu.Count; i++)
            {
                string strPoint  = DuLieu[i].X + " " + DuLieu[i].Y;
                string requestId = "request_" + i.ToString();
                addReverseGeocodeRequest(ref xLSType, strPoint, requestId);
            }

            return(xLSType);
        }
Beispiel #4
0
        public XLSType createXlsRequestTest(double x, double y)
        {
            XlsDocument xLSDocument = XlsDocument.CreateDocument();
            XLSType     xLSType     = xLSDocument.XLS.Append();

            xLSType.lang.Value = ServiceConfigProperties.Language;
            // should be added one only
            RequestUtil.addXlsHeader(ref xLSType);

            // can be added more than one
            //double x = 105.81783721316403;
            //double y = 21.028330217040492;
            //Random random = new Random();
            //for (int i = 0; i < 100; i++)
            //{
            //    double x1 = x + random.NextDouble() / 100;
            //    double y1 = y + random.NextDouble() / 100;
            //string strPoint = y1 + " " + x1;
            //string requestId = "request_" + i;
            addReverseGeocodeRequest(ref xLSType, y + " " + x, "request_0");
            //}

            return(xLSType);
        }
Beispiel #5
0
        public static XLSType perform(XLSType xLSTypeRequest)
        {
            XLSType xLSTypeResponse = null;

            WebClient webClient = new WebClient();

            //webClient.Headers.Add("Content-Type", "text/xml");
            //webClient.Encoding = Encoding.UTF8;
            webClient.Headers.Add("SOAPAction", "http://www.opengis.net/xls");
            webClient.Encoding = System.Text.Encoding.UTF8;
            XlsDocument xLSDocument = XlsDocument.CreateDocument();
            //xLSDocument.XLS.
            //xLSDocument.setXLS(xLSTypeRequest);

            string strRequest  = getStringSoapMessage(xLSTypeRequest.Node.OuterXml);
            string strResponse = webClient.UploadString(ServiceConfigProperties.EndPointURL, "POST", strRequest);

            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.LoadXml(strResponse);



            XmlNodeList xlsNodeList = xmlDoc.GetElementsByTagName("XLS", "http://www.opengis.net/xls");

            if (xlsNodeList.Count > 0)
            {
                XmlNode xlsNode = xlsNodeList.Item(0);
                xLSDocument = XlsDocument.LoadFromString(xlsNode.OuterXml);
                //xLSTypeResponse = XLSType.Factory.parse(xlsNode.OuterXml);

                xLSTypeResponse = xLSDocument.XLS.First;
            }

            return(xLSTypeResponse);
        }