コード例 #1
0
    // Use this for initialization
    void Start()
    {
        ServiceGapslabsClient client = ServicePropertiesClass.GetGapslabsService(ServicePropertiesClass.ServiceUri);
        var go            = GameObject.Find("AramGISBoundaries");
        var mapboundaries = go.GetComponent <MapBoundaries>();

        CoordinateConvertor.Initialize(client, mapboundaries);
    }
コード例 #2
0
    /// <summary>
    /// Initializes the convertor.
    /// </summary>
    public static void Initialize()
    {
        ServiceGapslabsClient client = ServicePropertiesClass.GetGapslabsService(ServicePropertiesClass.ServiceUri);
        var go            = GameObject.Find("AramGISBoundaries");
        var mapboundaries = go.GetComponent <MapBoundaries>();

        Initialize(client, mapboundaries);
    }
コード例 #3
0
    /// <summary>
    /// Starts the script.
    /// </summary>
    void Start()
    {
        log.Info("Map boundaries : MaxLat " + maxLat + ", MinLat " + minLat + ", MaxLon " + maxLon + ", MinLon " + minLon);

        //Initialize the coordinate convertor (need it for running the game!)
        ServiceGapslabsClient client = ServicePropertiesClass.GetGapslabsService(ServicePropertiesClass.ServiceUri);

        CoordinateConvertor.Initialize(client, this);
    }
コード例 #4
0
    void Start()
    {
        client  = ServicePropertiesClass.GetGapslabsService(ServicePropertiesClass.ServiceUri);
        geoinfo = transform.GetComponent <GeoInfo>();

        var go = GameObject.Find("AramGISBoundaries");

        mapBoundaries = go.GetComponent <MapBoundaries>();
        wcfCon        = mapBoundaries.OverrideDatabaseConnection ? mapBoundaries.GetOverridenConnectionString() : ServicePropertiesClass.ConnectionPostgreDatabase;

        boundsTemp = client.GetBounds(wcfCon);
        // Temporary - it appears the data for sweden includes some data that go to the north pole and it ruins all interpolations.
        boundsTemp.maxlon = 32;

        MinMaxLat = new float[2];
        MinMaxLon = new float[2];
        // Setting local values for target boundaries (Openstreetmap database). Used in interpolation as destination boundary.
        MinMaxLat[0] = (float)boundsTemp.minlat;
        MinMaxLat[1] = (float)boundsTemp.maxlat;
        MinMaxLon[0] = (float)boundsTemp.minlon;
        MinMaxLon[1] = (float)boundsTemp.maxlon;



        // Setting local values for 3d world boundaries. Used in interpolation as source boundary
        GameBoundaries        = new BoundsWCF();
        GameBoundaries.minlat = mapBoundaries.minMaxX[0];
        GameBoundaries.maxlat = mapBoundaries.minMaxX[1];
        GameBoundaries.minlon = mapBoundaries.minMaxY[0];
        GameBoundaries.maxlon = mapBoundaries.minMaxY[1];
        GameBoundLat          = new float[2];
        GameBoundLat[0]       = (float)GameBoundaries.minlat;
        GameBoundLat[1]       = (float)GameBoundaries.maxlat;
        GameBoundLon          = new float[2];
        GameBoundLon[0]       = (float)GameBoundaries.minlon;
        GameBoundLon[1]       = (float)GameBoundaries.maxlon;



        float[] MinPointOnArea =
            Interpolations.SimpleInterpolation(
                (float)mapBoundaries.minLat,
                (float)mapBoundaries.minLon,
                boundsTemp,
                GameBoundLat, GameBoundLon);
        MinPointOnMap = new Vector3(MinPointOnArea[0], 0, MinPointOnArea[1]);
    }
コード例 #5
0
    /// <summary>
    /// Initializes and returns an instance of <see cref="ServiceGapslabsClient"/> given the Endpoint service uri.
    /// </summary>
    /// <returns>returns an instance of <see cref="ServiceGapslabsClient"/>.</returns>
    /// <seealso cref="GetGapslabsService()"/>
    public static ServiceGapslabsClient GetGapslabsService(string ServiceUri)
    {
        ServiceGapslabsClient client;

        try
        {
            client = new ServiceGapslabsClient(GetBinding(), new EndpointAddress(ServiceUri));
        }
        catch (System.Exception e)
        {
            Debug.LogError(e);
            client = new ServiceGapslabsClient(GetBinding(), new EndpointAddress(ServiceUri));
            return(client);
        }

        //ServiceGapslabsClient client = new ServiceGapslabsClient(GetTCPBinding(), new EndpointAddress(ServiceUri));
        return(client);
    }
コード例 #6
0
    /// <summary>
    /// Initializes the convertor using the WCF service and the mapboundaries object.
    /// </summary>
    /// <param name="client">The GaPSLabs WCF webservice</param>
    /// <param name="mapboundaries">The AramGISBoundaries component.</param>
    public static void Initialize(ServiceGapslabsClient client, MapBoundaries mapboundaries)
    {
        BoundsWCF SelectedArea = new BoundsWCF();

        mapboundary         = mapboundaries;
        SelectedArea.minlat = mapboundaries.minLat;
        SelectedArea.maxlat = mapboundaries.maxLat;
        SelectedArea.minlon = mapboundaries.minLon;
        SelectedArea.maxlon = mapboundaries.maxLon;
        minmaxX             = mapboundaries.minMaxX;
        minmaxY             = mapboundaries.minMaxY;

        //if (mapboundaries.CorrectAspectRatio)
        //{
        //    var aspectRatio = System.Math.Abs(SelectedArea.maxlat - SelectedArea.minlat) / System.Math.Abs(SelectedArea.maxlon - SelectedArea.minlon);
        //    minmaxY[1] = (float)(minmaxX[1] / aspectRatio);
        //}

        var go         = GameObject.Find("AramGISBoundaries");
        var connection = go.GetComponent <MapBoundaries>();

        wcfCon = connection.OverrideDatabaseConnection ? connection.GetOverridenConnectionString() : ServicePropertiesClass.ConnectionPostgreDatabase;

        //If UseLocalDatabaseBounds, WCF won't be used (for portability) -- Miguel R. C.
        if (mapboundaries.UseLocalDatabaseBounds)
        {
            databaseBounds = new BoundsWCF()
            {
                minlat = mapboundaries.dbBoundMinLat,
                maxlat = mapboundaries.dbBoundMaxLat,
                minlon = mapboundaries.dbBoundMinLon,
                maxlon = mapboundaries.dbBoundMaxLon
            };
        }
        else
        {
            databaseBounds = client.GetBounds(wcfCon);
        }

        float[] MinPointOnArea = SimpleInterpolation((float)SelectedArea.minlat, (float)SelectedArea.minlon, databaseBounds, minmaxX, minmaxY);
        MinPointOnMap = new Vector3(direction * MinPointOnArea[0], 0, MinPointOnArea[1]);
        isInitialized = true;
    }
コード例 #7
0
    /// <summary>
    /// Coroutine for drawing the points in the map.
    /// </summary>
    IEnumerator DrawPoints()
    {
        while (!pointsReadyToBeDrawn)
        {
            yield return(new WaitForSeconds(0.1f));
        }

        ServiceGapslabsClient client = ServicePropertiesClass.GetGapslabsService(ServicePropertiesClass.ServiceUri);

        CoordinateConvertor.Initialize(client, FindObjectOfType <MapBoundaries>());

        for (int i = 0; i < points.Count; i++)
        {
            Vector3 V        = points[i];
            Vector3 position = CoordinateConvertor.LatLonToVector3(V.x, V.y);

            var newPoint = Instantiate(pointObject, position, Quaternion.identity) as GameObject;

            newPoint.name             = "fixPoint" + i;
            newPoint.transform.parent = pointHolder.transform;

            var pointInfo = newPoint.GetComponent <VVisFixPointInfo>();

            if (pointInfo != null)
            {
                List <string> info = new List <string>();
                info.Add("count: " + V.z.ToString());
                pointInfo.StorePointInfo(info);
            }

            newPoint.SetActive(true);
        }

        if (hidePointsAfterLoading)
        {
            HideLoadedPoints();
        }

        pointsReadyToBeDrawn = false;
    }
コード例 #8
0
ファイル: GeoInfo.cs プロジェクト: nopponaim603/ProtoWorld
    string wcfCon = ServicePropertiesClass.ConnectionPostgreDatabase; // .ConnectionDatabase;
    // Use this for initialization
    void Start()
    {
        locatorArrowA = GameObject.CreatePrimitive(PrimitiveType.Cube);
        locatorArrowA.transform.localScale = new Vector3(0.5f, 100, 0.5f);
        locatorArrowA.transform.position   = Vector3.zero;
        locatorArrowA.GetComponent <Renderer>().material = Resources.Load("A") as Material;
        locatorArrowA.name = "A";
        Object.DestroyImmediate(locatorArrowA.GetComponent <BoxCollider>());
        previousPositionA = Vector3.zero;

        locatorArrowB = GameObject.CreatePrimitive(PrimitiveType.Cube);
        locatorArrowB.transform.localScale = new Vector3(0.5f, 100, 0.5f);
        locatorArrowB.transform.position   = Vector3.zero;
        locatorArrowB.GetComponent <Renderer>().material = Resources.Load("B") as Material;
        Object.DestroyImmediate(locatorArrowB.GetComponent <BoxCollider>());
        locatorArrowB.name = "B";
        previousPositionB  = Vector3.zero;

        var go         = GameObject.Find("AramGISBoundaries");
        var connection = go.GetComponent <MapBoundaries>();

        wcfCon = connection.OverrideDatabaseConnection ? connection.GetOverridenConnectionString() : ServicePropertiesClass.ConnectionPostgreDatabase;

        client = ServicePropertiesClass.GetGapslabsService(ServicePropertiesClass.ServiceUri);

        Interpolations.MyLog("init Router");
        try
        {
            client.InitializeRouter(wcfCon);
        }
        catch (System.TimeoutException timeout)
        {
            Debug.LogException(timeout);
        }
        Interpolations.MyLog("Router initialized successfully.");
    }
コード例 #9
0
    static string wcfCon = ServicePropertiesClass.ConnectionPostgreDatabase;     //.ConnectionDatabase;

    //[MenuItem("Gapslabs GIS Package/Get More Info from database %#i")]
    static void OSMMoreInfoFromDatabaseMenu()
    {
        var go         = GameObject.Find("AramGISBoundaries");
        var connection = go.GetComponent <MapBoundaries>();

        wcfCon = connection.OverrideDatabaseConnection ? connection.GetOverridenConnectionString() : ServicePropertiesClass.ConnectionPostgreDatabase;

        if (Selection.activeTransform == null)
        {
            EditorUtility.DisplayDialog("No objects selected", "Please select an object from hierarchy tab.", "Ok");
        }
        else
        {
            var name = Selection.activeTransform.name;
            ServiceGapslabsClient client = ServicePropertiesClass.GetGapslabsService(ServicePropertiesClass.ServiceUri);

            var ret = "";
            if (!name.Contains("|"))
            {
                DisplayInfo("Not an OpenStreetMap object.");
                return;
            }
            var o = name.Split(new char[] { '|' }, System.StringSplitOptions.RemoveEmptyEntries);
            ret += "Type: " + o[0] + "\n";
            ret += "id: " + o[2] + "\n";
            switch (o[1])
            {
            case "0":                     // Node
            {
                var selectedNode = client.GetNodeInfo(o[2], wcfCon);
                var nodeTags     = client.GetNodeTags(o[2], wcfCon);
                ret += "Position: " + "Lat=" + selectedNode.lat + " Lon=" + selectedNode.lon + "\n";
                foreach (var tag in nodeTags)
                {
                    ret += "Tag info: " + tag.KeyValue[0] + "=" + tag.KeyValue[1] + "\n";
                }
                break;
            }

            case "1":                     // Line
            case "2":                     // Polygon
            {
                var WayTags = client.GetWayTags(o[2], wcfCon);
                foreach (var tag in WayTags)
                {
                    ret += "Tag info: " + tag.KeyValue[0] + "=" + tag.KeyValue[1] + "\n";
                }
                //					foreach (var node in way.Nodes)
                //					{
                //						ret += "Node: "+"ID="+node.id+" Lat="+ node.Position.Lat+" Lon=" + node.Position.Lon+"\n";
                //					}

                break;
            }

            case "3":
            {
                // TODO
                //var selectedPolygon = source.Nodes.Where(i => i.Attribute("id").Value == o[2]).Single();
                ret += "Relations have not been implemented yet.";
                break;
            }
            }
            DisplayInfo(ret);
        }
    }
コード例 #10
0
ファイル: Program.cs プロジェクト: fieldsofview/ProtoWorld
        static void MainTemp(string[] args)
        {
            NpgsqlConnection schemaConnection = new NpgsqlConnection(connPostGreSql);

            schemaConnection.Open();
            var       databaseName = "GIS";
            DataTable dataTables   = schemaConnection.GetSchema("Tables", new string[] { databaseName, "public", null, null });

            foreach (DataRow rowTable in dataTables.Rows)
            {
                string tableName = rowTable["table_name"].ToString();
                if (tableName != "geometry_collection")
                {
                    continue;
                }
                DataTable     dataColumns = schemaConnection.GetSchema("Columns", new string[] { databaseName, "public", tableName });
                StringBuilder sb          = new StringBuilder();
                sb.AppendLine("public class " + tableName);
                sb.AppendLine("{");
                sb.AppendLine("\tpublic " + tableName + "(){}");

                foreach (DataRow rowColumn in dataColumns.Rows)
                {
                    string columnName = rowColumn["column_name"].ToString();
                    string type       = rowColumn["data_type"].ToString();
                    sb.AppendLine("\tpublic " + type + " " + columnName + " {get;set;}");
                }
                sb.AppendLine("}");
                sb.Replace("int8", "long");
                sb.Replace("int4", "int");
                sb.Replace("text", "string");
                sb.Replace("oid", "long");
                sb.Replace("numeric", "float");
                sb.Replace("timestamp", "DateTime");
                var def = sb.ToString();
            }

            schemaConnection.Close();
            return;

            var geometryRetrieval = geometryCollection.GetSingleObjectWithId("8", true, connPostGreSql);

            // testing GeometryCollection
            Aram.OSMParser.geometryCollection col = new Aram.OSMParser.geometryCollection();

            // col.gisId =
            col.gisType     = "dummy";
            col.format      = "txt";
            col.largeObject = null;
            col.lastUpdate  = DateTime.Now;
            col.latitude    = 563213212;
            col.longitude   = 171231231;
            col.name        = "Test2";
            col.pivot       = new Aram.OSMParser.Vector3GaPS()
            {
                x = 1f, y = 2f, z = 3f
            };
            col.version = new Aram.OSMParser.GaPSlabsVersion()
            {
                versionTitle = "development", major = 0, minor = 1
            };

            col.AddGeometryCollectionToDatabase(connPostGreSql, false);
            var bytes = File.ReadAllBytes(@"C:\Users\admgaming\Documents\Visual Studio 2012\Projects\GaPSLabs\AramOSMParser\OsmParserTestApplication\bin\Debug\Npgsql.xml");

            col.largeObject = bytes;
            col.UpdateThisGeometryOnDatabase(connPostGreSql, true);
            var resultBytes = geometryCollection.GetLargeObject(col.largeObjectReference, connPostGreSql);

            File.WriteAllBytes("c:\\dummy", resultBytes);

            return;

            // ERROR: 42704: invalid large-object descriptor: 0 ??
            // largeobject only works within a transaction. Use bytea as an alternative to large objects.
            // http://www.postgresql.org/message-id/002701c49d7e$0f059240$d604460a@zaphod
            NpgsqlConnection testConnection = new NpgsqlConnection(connPostGreSql);

            testConnection.Open();

            NpgsqlTypes.LargeObjectManager lm = new NpgsqlTypes.LargeObjectManager(testConnection);

            var generatedLO = lm.Create(NpgsqlTypes.LargeObjectManager.READWRITE);

            // It must be within a transaction
            var         TransWrite = testConnection.BeginTransaction();
            LargeObject lo         = lm.Open(generatedLO, LargeObjectManager.READWRITE);

            lo.Write(new byte[] { 0, 10, 50, 24 });
            lo.Close();
            TransWrite.Commit();

            var TransRead = testConnection.BeginTransaction();
            var loOid     = lo.GetOID();
            var readlo    = lm.Open(loOid, LargeObjectManager.READWRITE);
            var resultLo  = readlo.Read(readlo.Size());

            lm.Delete(generatedLO);
            TransRead.Commit();

            testConnection.Close();
            return;

            OSMPostgresqlSource sourceVisTest = new OSMPostgresqlSource(connPostGreSql);
            var bounds = sourceVisTest.Bounds;



            return;

            GaPSlabsSimulationLibrary.SUMOSimulationFCD df = new GaPSlabsSimulationLibrary.SUMOSimulationFCD();
            //df.LoadFromXML(@"C:\Users\admgaming\Desktop\Dropbox\GaPSLabs\SUMO Packet Tester\Pedestrians.xml");
            //df.LoadFromXML(@"C:\Users\admgaming\Desktop\Dropbox\GaPSLabs\SUMO Packet Tester\bufferoutput - 500.xml");

            ServiceGapslabsClient client2 = ServicePropertiesClass.GetGapslabsService(ServicePropertiesClass.ServiceUri);
            int id = client2.LoadSUMOFCDSimulationList(@"C:\Users\admgaming\Desktop\Dropbox\GaPSLabs\SUMO Packet Tester\bufferoutput - 500.xml", "__POSTFIX");

            //client.LoadSUMOFCDSimulation(@"C:\Users\admgaming\Desktop\Dropbox\GaPSLabs\SUMO Packet Tester\bufferoutput - 500.xml");
            while (!client2.IsSimulationLoadedList(id))
            {
            }
            var vvvv  = client2.GetTimestepAtList(6, id);
            var vvvv2 = client2.GetTimestepAtList(7, id);


            return;


            int size = 16777216;

            int[] aa   = new int[size];
            int[] bbb  = new int[size];
            int[] cccc = new int[size];
            for (int i = 0; i < size; i++)
            {
                aa[i]  = i;
                bbb[i] = i;
            }
            var apointer = aa.ToIntPtr <int[]>();
            var bpointer = bbb.ToIntPtr <int[]>();
            var cpointer = cccc.ToIntPtr <int[]>();

            long      MinGPU         = 1000000;
            long      MinCPU         = 1000000;
            long      MinCPUParallel = 100000;
            Stopwatch watch          = new Stopwatch();

            bool SkipCpu = false;

            GPU_WarmUp();
            int TestCounter = 0;
            int blockSize   = 16;

            while (TestCounter++ < 7)
            {
                watch.Restart();
                GPU_Add(apointer, bpointer, cpointer, size, blockSize);
                watch.Stop();
                Console.WriteLine("Total GPU" + "(" + blockSize + ")" + ": " + watch.ElapsedMilliseconds);
                if (watch.ElapsedMilliseconds < MinGPU)
                {
                    MinGPU = watch.ElapsedMilliseconds;
                }
                blockSize *= 2;
            }
            Console.WriteLine("Minimum GPU was " + MinGPU);

            if (!SkipCpu)
            {
                TestCounter = 0;
                while (TestCounter++ < 10)
                {
                    watch.Restart();
                    CPU_AddParallel(apointer, bpointer, cpointer, size);
                    watch.Stop();
                    Console.WriteLine("Total CPU Parallel: " + watch.ElapsedMilliseconds);
                    if (watch.ElapsedMilliseconds < MinCPUParallel)
                    {
                        MinCPUParallel = watch.ElapsedMilliseconds;
                    }
                }
                Console.WriteLine("Minimum CPU was " + MinCPU);

                TestCounter = 0;
                while (TestCounter++ < 10)
                {
                    watch.Restart();
                    CPU_Add(apointer, bpointer, cpointer, size);
                    watch.Stop();
                    Console.WriteLine("Total CPU: " + watch.ElapsedMilliseconds);
                    if (watch.ElapsedMilliseconds < MinCPU)
                    {
                        MinCPU = watch.ElapsedMilliseconds;
                    }
                }
                Console.WriteLine("Minimum CPU was " + MinCPU);
            }
            //apointer.Free();
            //bpointer.Free();
            //cpointer.Free();
            Console.ReadLine();
            return;

            //GaPSlabsSimulationLibrary.SUMOSimulationFCD simulation = new GaPSlabsSimulationLibrary.SUMOSimulationFCD();
            //simulation.LoadFromXML(@"C:\Users\admgaming\Desktop\Dropbox\GaPSLabs\SUMOData\fcdoutput.xml");
            //simulation.LoadFromCSV(@"C:\Users\admgaming\Desktop\Notable Software\iMobility\stkhlm-taxi.csv");

            ServiceGapslabsClient client = ServicePropertiesClass.GetGapslabsService(ServicePropertiesClass.ServiceUri);
            //client.LoadSUMOFCDSimulation(@"C:\Users\admgaming\Desktop\Dropbox\GaPSLabs\SUMO Packet Tester\bufferoutput - 500.xml");
            //while (!client.IsSimulationLoaded())
            //    Console.WriteLine("Loading...");
            //Console.WriteLine("Load finished");
            //Console.ReadLine();
            //return;



            OSMPostgresqlSource sour = new OSMPostgresqlSource(connPostGreSql);
            // var TrafficNodes = sour.GetNodeIdsInBoundWithInfo(sour.Bounds, "traffic_signals");



            var result = client.GetWayTags("134972364", connPostGreSql);



            BoundsWCF b = new BoundsWCF();

            b.minlat = 59.32973;
            b.maxlat = 59.34481;
            b.minlon = 18.07556;
            b.maxlon = 18.1062;
            client.GetWayExtIdsInBound(connPostGreSql, b);

            client.InitializeRouter(connPostGreSql);

            OsmNodeWCF n1 = new OsmNodeWCF();

            n1.id    = "none";
            n1.order = -1;
            n1.lat   = 59.330957;
            n1.lon   = 18.059285;
            //n1.lat = 59.374563;
            //n1.lon = 18.0135727;
            OsmNodeWCF n2 = new OsmNodeWCF();

            n2.id    = "none";
            n2.order = -1;
            n2.lat   = 59.33784;
            n2.lon   = 18.088558;
            //n2.lat = 59.37225;
            //n2.lon = 18.00733;


            var RouterResult = client.RouteUsingDykstra(VehicleEnum.Car, n1, n2);

            OsmGeo.ShapeInterperter = new SimpleShapeInterpreter();
            PostgreSQLSimpleSchemaSource source = new PostgreSQLSimpleSchemaSource(connPostGreSql);

            // keeps a memory-efficient version of the osm-tags.
            OsmTagsIndex tags_index = new OsmTagsIndex();

            // creates a routing interpreter. (used to translate osm-tags into a routable network)
            OsmRoutingInterpreter interpreter = new OsmRoutingInterpreter();

            // create routing inter
            OsmSourceRouterDataSource routing_data = new OsmSourceRouterDataSource(
                interpreter, tags_index, source);

            // create the router object.
            //IRouter<RouterPoint> router = new Router<PreProcessedEdge>(routing_data, interpreter,
            //    new DykstraRoutingPreProcessed(routing_data.TagsIndex));
            IRouter <RouterPoint> router = new Router <PreProcessedEdge>(routing_data, interpreter
                                                                         , new DykstraRoutingPreProcessed(routing_data.TagsIndex));


            // resolve both points; find the closest routable road.

            //RouterPoint point1 = router.Resolve(VehicleEnum.Car, new GeoCoordinate(60.1674654,18.454302));
            // RouterPoint point2 = router.Resolve(VehicleEnum.Car, new GeoCoordinate(60.1673373,18.4541732));

            // Working
            //RouterPoint point1 = router.Resolve(VehicleEnum.Car, new GeoCoordinate(59.3863281, 18.0176665));
            //RouterPoint point2 = router.Resolve(VehicleEnum.Car, new GeoCoordinate(59.3675634, 18.0140447));

            // Working
            RouterPoint point1 = router.Resolve(VehicleEnum.Car, new GeoCoordinate(59.374563, 18.0135727));
            RouterPoint point2 = router.Resolve(VehicleEnum.Car, new GeoCoordinate(59.37225, 18.00733));

            //ArrayList al=new ArrayList();
            //foreach (var en in Enum.GetValues(typeof(VehicleEnum)))
            //{
            //    al.Add(Enum.GetName(typeof(VehicleEnum), (VehicleEnum)en) + "=" + router.SupportsVehicle((VehicleEnum)en));
            //}

            // calculate route.
            OsmSharpRoute route = router.Calculate(VehicleEnum.Car, point1, point2);

            route.SaveAsGpx(new FileInfo("route.gpx"));



            Console.ReadLine();
        }
コード例 #11
0
ファイル: Program.cs プロジェクト: fieldsofview/ProtoWorld
        static void Main(string[] args)
        {
            ServiceGapslabsClient client = ServicePropertiesClass.GetGapslabsService();
            BoundsWCF             b      = new BoundsWCF();

            b.minlat = 59.32973;
            b.maxlat = 59.34481;
            b.minlon = 18.07556;
            b.maxlon = 18.1062;
            //client.GetWayIdsWithTags(connPostGreSql, b, new string[][] { new string[] { "type", "multipolygon" } });
            var relationbuildings = client.GetRelationBuildingsInBound(connPostGreSql, b);

            return;



            TestStruct ts1 = new TestStruct();

            ts1.ids = 5;
            ts1.s   = new string[] { "abc", "DEF" };



            ProtoBuf.Serializer.PrepareSerializer <TestStruct>();
            using (StreamWriter writer = new StreamWriter("c:\\test.txt"))
            {
                Serializer.Serialize <TestStruct>(writer.BaseStream, ts1);
            }
            return;



            var       testData = new string[] { "Testing", "Gintset" };
            TestClass tc       = new TestClass();

            tc.content = testData;
            var ptr1 = Marshal.AllocHGlobal(Marshal.SizeOf(tc));


            Marshal.StructureToPtr(tc, ptr1, false);
            byte[] buffered = new byte[Marshal.SizeOf(tc)];

            Marshal.Copy(ptr1, buffered, 0, buffered.Length);
            var ptr2 = Marshal.AllocHGlobal(Marshal.SizeOf(tc));

            Marshal.Copy(buffered, 0, ptr2, buffered.Length);
            TestClass ds = new TestClass();

            Marshal.PtrToStructure(ptr2, ds);



            IntPtr ts1ptr = Marshal.AllocHGlobal(Marshal.SizeOf(ts1));

            try
            {
                // SERVER
                // A pointer to the content of a class
                Marshal.StructureToPtr(ts1, ts1ptr, false);
                // Allocating the buffer to hold that content
                byte[] buffer = new byte[Marshal.SizeOf(ts1)];
                // copying the class content to a buffer array
                Marshal.Copy(ts1ptr, buffer, 0, buffer.Length);

                // CLIENT
                IntPtr ts2ptr = Marshal.AllocHGlobal(Marshal.SizeOf(buffer.Length));
                Marshal.Copy(buffer, 0, ts2ptr, buffer.Length);

                var check = Marshal.PtrToStructure <TestStruct2>(ts2ptr);
            }
            finally
            {
                Marshal.FreeHGlobal(ts1ptr);
            }

            var error = client.InitializeRouter(connPostGreSql);
            //var membersWCF = client.GetRoutePath("1246645", 1, connPostGreSqlParis);
            //var membersWCF = client.GetRoutePath("2370570", 1, connPostGreSql);
            var members = Aram.OSMParser.Relation.GetRoutePathExperimental("2370570", 1, connPostGreSql);

            // Fix the line reverse problems.

            return;

            //var result = client.GetRelationsContainingMembers(connPostGreSql, new string[] { "1344331354" }, 0, "");

            //OSMPostgresqlSource sourcePostgre = new OSMPostgresqlSource(connPostGreSql);
            //Aram.OSMParser.Relation.GetRelationsPostgreSQL(new string[] { "1344331354" }, 0, "", connPostGreSql);



            //var connectionString = "mongodb://localhost";
            //var client = new MongoClient(connectionString);
            //var server = client.GetServer();
            //var trafiklab = server.GetDatabase("trafiklab");
            //var trafficdata = trafiklab.GetCollection<Trafiklab.MongodbBusses>("trafficdatatest");
            //var q = Query<Trafiklab.MongodbBusses>.EQ(i => i.LatestUpdate, "2014-05-07T11:26:41.7801525+02:00");
            //var result = trafficdata.Find(q);
            //var f = result.First();
        }
コード例 #12
0
    /// <summary>
    /// Initializes and returns an instance of <see cref="ServiceGapslabsClient"/>.
    /// </summary>
    /// <returns>returns an instance of <see cref="ServiceGapslabsClient"/>.</returns>
    /// <seealso cref="GetGapslabsService(string ServiceUri)"/>
    public static ServiceGapslabsClient GetGapslabsService()
    {
        ServiceGapslabsClient client = new ServiceGapslabsClient(GetBinding(), new EndpointAddress(ServiceUri));

        return(client);
    }