Exemple #1
0
        public void OnAdvanceQuery(string sourceTable, string targetTable, string definitionQuery,
                                   int opCode, double additionalParam)
        {
            System.Data.DataSet ds = new System.Data.DataSet();

            PostGISCustom pgs = new PostGISCustom(Constants.connStr, Constants.geomName);

            pgs.BuildRelationQuery(sourceTable, targetTable, definitionQuery, opCode, additionalParam);
            IList <IGeometry> geoms = pgs.ExecuteCustomQuery(ds);


            VectorLayer queryLayer = new VectorLayer(Constants.queryLayerName)
            {
                DataSource = new SharpMap.Data.Providers.GeometryProvider(geoms),
                SRID       = 4326
            };

            if (ds.Tables[0].Rows.Count > 0)
            {
                OnRemoveLayer(Constants.queryLayerName);
                OnRemoveLayer(Constants.queryLabelName);

                _view.DataGridView = ds.Tables[0];
                _view.AddLayer(queryLayer);
            }
        }
Exemple #2
0
        public void OnFindRoute(int source, int target)
        {
            System.Data.DataSet ds = new System.Data.DataSet();

            PostGISCustom pgs = new PostGISCustom(Constants.connStr, Constants.geomName);

            pgs.BuildDijkstraQuery(source, target, Constants.roadsTable, Constants.idName);
            IList <IGeometry> geoms = pgs.ExecuteCustomQuery(ds);

            VectorLayer queryLayer = new VectorLayer(Constants.queryLayerName)
            {
                DataSource = new SharpMap.Data.Providers.GeometryProvider(geoms),
                SRID       = 4326
            };

            if (ds.Tables[0].Rows.Count > 0)
            {
                OnRemoveLayer(Constants.queryLayerName);
                OnRemoveLayer(Constants.queryLabelName);

                _view.DataGridView = ds.Tables[0];
                _view.AddLayer(queryLayer);
            }
        }