// public void GetVisuArc2D(BeanArc_internal p_arc, string p_label, Color p_couleurCourante) { SpatialTrace.Enable(); string v_message; SpatialTrace.SetFillColor(p_couleurCourante); SpatialTrace.SetLineColor(p_couleurCourante); v_message = "arc " + p_arc.p00_idArc + " (" + p_arc.p01_hcodeArc + ")"; if (p_label != "") { v_message += " " + p_label; } bool v_generePointSiConfondus_vf = true; IGeometry v_lineGeom; v_lineGeom = FLabServices.createUtilitaires().GetGeometryArc(p_arc, v_generePointSiConfondus_vf); if (v_lineGeom.OgcGeometryType != OgcGeometryType.LineString) { v_message += " PB GEOM (Arc est: " + v_lineGeom.OgcGeometryType + ")"; } SpatialTrace.TraceGeometry(v_lineGeom, v_message, v_message); // //GetVisuPoint2D(p_arc.p11_pointDbt, " =>Dbt>", p_couleurCourante, 10); //GetVisuPoint2D(p_arc.p12_pointFin, " =>Fin>", p_couleurCourante, 10); SpatialTrace.Disable(); }
public void GetVisuFacette(BeanFacette_internal p_facette, string p_label, Color p_couleurCourante, bool p_visualiserPointsInclus_vf, bool p_afficherMemeSiInvalide_vf) { Color param_couleurContour = Color.FromArgb(125, 125, 125); Color param_couleurPoint = Color.FromArgb(200, 200, 200); SpatialTrace.Enable(); SpatialTrace.SetFillColor(p_couleurCourante); SpatialTrace.SetLineColor(param_couleurContour); // List <double[]> v_coord = p_facette.p01_pointsDeFacette.Select(c => c.p10_coord).ToList(); IGeometry v_polygone; v_polygone = FLabServices.createUtilitaires().GetGeometryPolygon(v_coord, p_facette.p01_pointsDeFacette.First().p11_srid); if (!p_afficherMemeSiInvalide_vf && !v_polygone.IsValid) { return; } string v_label = p_label + " fac: " + p_facette.p00_idFacette; SpatialTrace.TraceGeometry(v_polygone, v_label, v_label); // if (p_visualiserPointsInclus_vf) { foreach (BeanPoint_internal v_point in p_facette.p10_pointsInclus) { GetVisuPoint2D(v_point, "=>Fac " + p_facette.p00_idFacette, param_couleurPoint, 5); } } SpatialTrace.Disable(); }
// public void GetVisuVecteur2D(double[] p_vecteur, double[] p_origine, int p_srid, string p_label, Color p_couleurCourante, double p_coeff = 1) { try { string v_message = p_label; double[] v_coordPoint2 = new double[2] { p_origine[0], p_origine[1] }; v_coordPoint2[0] += (p_vecteur[0] * p_coeff); v_coordPoint2[1] += (p_vecteur[1] * p_coeff); bool ifPt1AndPt2IqualReturnPointElseNull = true; IGeometry v_lineGeom = FLabServices.createUtilitaires().GetGeometryLine(p_origine, v_coordPoint2, p_srid, ifPt1AndPt2IqualReturnPointElseNull); if (v_lineGeom.OgcGeometryType != OgcGeometryType.LineString) { v_message += " PB GEOM (Arc est: " + v_lineGeom.OgcGeometryType + ")"; } // SpatialTrace.Enable(); //SpatialTrace.SetFillColor(p_couleurCourante); SpatialTrace.SetLineColor(p_couleurCourante); SpatialTrace.TraceGeometry(v_lineGeom, p_label, p_label); SpatialTrace.Disable(); } catch (Exception) { throw; } }
public void GetVisuPoint2D(BeanPoint_internal p_point, string p_label, Color p_couleurCourante, int p_taillePoint) { Color param_couleurContour = Color.FromArgb(125, 125, 125); if (p_taillePoint <= 0) { p_taillePoint = 1; } // SpatialTrace.Enable(); string v_message = ""; IGeometry v_pointGeom; SpatialTrace.SetFillColor(p_couleurCourante); SpatialTrace.SetLineColor(param_couleurContour); v_message = "Pt " + p_point.p00_id + " (" + p_point.p10_coord[2] + " m)"; if (p_label != "") { v_message += " " + p_label; } v_pointGeom = FLabServices.createUtilitaires().ConstructPoint(p_point.p10_coord[0], p_point.p10_coord[1], p_point.p11_srid).Buffer(p_taillePoint); SpatialTrace.TraceGeometry(v_pointGeom, v_message, v_message); SpatialTrace.Disable(); }
public void GetVisuPointsAlti(Dictionary <string, List <BeanPoint_internal> > p_pointsParClasse, Dictionary <string, Color> p_tableCouleurs, int p_taillePoint) { try { SpatialTrace.Enable(); Color v_couleurCourante; string v_message; IGeometry v_pointGeom; foreach (KeyValuePair <string, List <BeanPoint_internal> > v_classe in p_pointsParClasse) { v_couleurCourante = p_tableCouleurs[v_classe.Key]; SpatialTrace.SetFillColor(v_couleurCourante); SpatialTrace.SetLineColor(v_couleurCourante); foreach (BeanPoint_internal v_point in v_classe.Value) { v_message = "Pt " + v_point.p00_id + " (" + v_point.p10_coord[2] + " m)"; v_pointGeom = FLabServices.createUtilitaires().ConstructPoint(v_point.p10_coord[0], v_point.p10_coord[1], v_point.p11_srid).Buffer(p_taillePoint); SpatialTrace.TraceGeometry(v_pointGeom, v_message, v_message); } } SpatialTrace.Disable(); } catch (Exception) { throw; } }
private void TestCommunes() { List <SqlGeometry> geom = new List <SqlGeometry>(); SpatialTrace.Enable(); SpatialTrace.TraceText("Open DB connection"); SpatialTrace.Indent(); using (SqlConnection con = new SqlConnection(@"Data Source=.;Initial Catalog=SampleSpatialData;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False")) { con.Open(); using (SqlCommand com = new SqlCommand("SELECT geom, INSEE_COM + ' ' + NOM_COM FROM dbo.COMMUNE --WHERE geom2154.STNumInteriorRing() > 0", con)) { int i = 0; using (SqlDataReader reader = com.ExecuteReader()) { SpatialTrace.TraceText("Reading results DB\t\t connection"); SpatialTrace.Indent(); while (reader.Read()) { i++; // workaround https://msdn.microsoft.com/fr-fr/library/ms143179(v=sql.120).aspx // In version 11.0 only SqlGeometry curGeom = SqlGeometry.Deserialize(reader.GetSqlBytes(0)); //// In version 10.0 or 11.0 //curGeom = new SqlGeometry(); //curGeom.Read(new BinaryReader(reader.GetSqlBytes(0).Stream)); geom.Add(curGeom); SpatialTrace.SetFillColor(GetRandomColor()); SpatialTrace.SetLineColor(GetRandomColor()); SpatialTrace.SetLineWidth(GetRandomStrokeWidth()); SpatialTrace.TraceGeometry(curGeom, reader[1].ToString()); } SpatialTrace.Unindent(); } } } SpatialTrace.Unindent(); ((ISpatialViewer)viewer).SetGeometry(SqlGeomStyledFactory.Create(geom, null, null, null, "Sample")); }
private void VisuCercleCirconscritAuTriangle(double[] v_pointA, double[] v_pointB, double[] v_pointC, string p_message) { List <double[]> v_pointsTriangle; v_pointsTriangle = new List <double[]>(); v_pointsTriangle.Add(v_pointA); v_pointsTriangle.Add(v_pointB); v_pointsTriangle.Add(v_pointC); // SpatialTrace.Enable(); SpatialTrace.TraceText(p_message); Color param_couleurContour = Color.FromArgb(125, 125, 125); SpatialTrace.SetLineColor(param_couleurContour); Color p_couleurCourante; int p_taillePoint; IGeometry v_pointGeom; double[] v_pointCentre; double v_rayon; v_pointCentre = FServicesApplicatifs.createCalculServicesLow_testDivers().GetCoordonneesCercleCirconscritAuTriangle(v_pointsTriangle); v_rayon = Math.Sqrt(Math.Pow((v_pointA[0] - v_pointCentre[0]), 2) + Math.Pow((v_pointA[1] - v_pointCentre[1]), 2)); //Cercle p_couleurCourante = Color.FromArgb(50, 50, 50); v_pointGeom = FLabServices.createUtilitaires().ConstructPoint(v_pointCentre[0], v_pointCentre[1], 2154).Buffer(v_rayon); SpatialTrace.TraceGeometry(v_pointGeom, "Cercle", "Cercle"); //Points du triangle p_taillePoint = 5; p_couleurCourante = Color.FromArgb(255, 0, 0); SpatialTrace.SetFillColor(p_couleurCourante); v_pointGeom = FLabServices.createUtilitaires().ConstructPoint(v_pointA[0], v_pointA[1], 2154).Buffer(p_taillePoint); SpatialTrace.TraceGeometry(v_pointGeom, "Pt A", "Pt A"); v_pointGeom = FLabServices.createUtilitaires().ConstructPoint(v_pointB[0], v_pointB[1], 2154).Buffer(p_taillePoint); SpatialTrace.TraceGeometry(v_pointGeom, "Pt B", "Pt B"); v_pointGeom = FLabServices.createUtilitaires().ConstructPoint(v_pointC[0], v_pointC[1], 2154).Buffer(p_taillePoint); SpatialTrace.TraceGeometry(v_pointGeom, "Pt C", "Pt C"); //Cercle p_taillePoint = 8; p_couleurCourante = Color.FromArgb(0, 255, 0); SpatialTrace.SetFillColor(p_couleurCourante); v_pointGeom = FLabServices.createUtilitaires().ConstructPoint(v_pointCentre[0], v_pointCentre[1], 2154).Buffer(p_taillePoint); SpatialTrace.TraceGeometry(v_pointGeom, "Centre", "Centre"); SpatialTrace.Disable(); // }
private void VisuPointSuppl(double[] p_point, string p_message, int p_tailleDuPoint) { SpatialTrace.Enable(); Color param_couleurContour = Color.FromArgb(125, 125, 125); SpatialTrace.SetLineColor(param_couleurContour); Color p_couleurCourante; IGeometry v_pointGeom; p_couleurCourante = Color.FromArgb(50, 50, 50); SpatialTrace.SetFillColor(p_couleurCourante); v_pointGeom = FLabServices.createUtilitaires().ConstructPoint(p_point[0], p_point[1], 2154).Buffer(p_tailleDuPoint); SpatialTrace.TraceGeometry(v_pointGeom, p_message, p_message); SpatialTrace.Disable(); }
static void SpatialTrace_GeometryWithDEMGrid(ElevationService elevationService, IGeoTiffService geoTiffService, string wktBbox, DEMDataSet dataSet) { SpatialTrace.Enable(); DEM.Net.Lib.BoundingBox bbox = null; if (wktBbox != null) { SqlGeometry geom = GeometryService.ParseWKTAsGeometry(wktBbox); SpatialTrace.TraceGeometry(geom, "Bbox"); bbox = geom.ToGeography().STBuffer(60).GetBoundingBox(); //SpatialTrace.Indent("Line Segments"); //int i = 0; //foreach (var seg in geom.Segments()) //{ // i++; // Color color = (i % 2 == 0) ? Colors.Blue : Colors.Red; // SpatialTrace.SetLineColor(color); // SpatialTrace.TraceGeometry(seg, "Seg" + i, "Seg" + i); //} SpatialTrace.Unindent(); } Dictionary <string, DemFileReport> tiles = geoTiffService.GenerateReport(dataSet, bbox); SpatialTrace.Indent("DEM tiles"); SpatialTrace.SetLineColor(Colors.Black); foreach (var tile in tiles) { SpatialTrace.SetFillColor(tile.Value.IsExistingLocally ? Color.FromArgb(128, 0, 255, 0) : Color.FromArgb(128, 255, 0, 0)); SqlGeometry tileBbox = tile.Value.Source.BBox.AsGeomety(); SpatialTrace.TraceGeometry(tileBbox, $"{tile.ToString()}"); } SpatialTrace.Unindent(); // View spatial trace in bin\debug with spatial trace viewer SpatialTrace.ShowDialog(); SpatialTrace.Disable(); }
public void GetVisuPoints(List <BeanPoint_internal> p_points, Color p_couleur, int p_taillePoint, string p_prefixeLabel) { if (p_points == null && p_points.Count == 0) { return; } IGeometry v_pointGeom; string v_label; int v_srid = p_points.First().p11_srid; SpatialTrace.Enable(); SpatialTrace.SetLineColor(p_couleur); foreach (BeanPoint_internal v_point in p_points) { v_label = p_prefixeLabel + " " + v_point.p00_id + "\\" + v_point.p00_id; v_pointGeom = FLabServices.createUtilitaires().ConstructPoint(v_point.p10_coord[0], v_point.p10_coord[1], v_srid); SpatialTrace.TraceGeometry(v_pointGeom, v_label, v_label); } SpatialTrace.Disable(); }
public void GetVisuArcsTopologie(BeanTopologieFacettes p_topologie, Color p_couleur, string p_prefixeLabel) { if (p_topologie.p12_arcsByCode == null || p_topologie.p12_arcsByCode.Count == 0) { return; } IGeometry v_arcGeom; string v_label; int v_srid = p_topologie.p11_pointsFacettesByIdPoint.First().Value.p11_srid; SpatialTrace.Enable(); SpatialTrace.SetLineColor(p_couleur); foreach (KeyValuePair <string, BeanArc_internal> v_arc in p_topologie.p12_arcsByCode) { v_label = p_prefixeLabel + " " + v_arc.Value.p00_idArc + "\\" + v_arc.Value.p01_hcodeArc; v_arcGeom = FLabServices.createUtilitaires().GetGeometryLine(v_arc.Value.p11_pointDbt.p10_coord, v_arc.Value.p12_pointFin.p10_coord, v_srid, false); SpatialTrace.TraceGeometry(v_arcGeom, v_label, v_label); } SpatialTrace.Disable(); }
public void GetVisuIlots(BeanTopologieFacettes p_topologie, Color p_couleur, string p_prefixeLabel) { SpatialTrace.Enable(); SpatialTrace.SetFillColor(p_couleur); SpatialTrace.SetLineColor(Color.Blue); SpatialTrace.SetLineWidth(1); string v_label; foreach (KeyValuePair <int, BeanFacette_internal> v_facette in p_topologie.p13_facettesById) { if (v_facette.Value.p04_geomFacette != null) { v_label = p_prefixeLabel + " Fac " + v_facette.Key; SpatialTrace.TraceGeometry(v_facette.Value.p04_geomFacette, v_label, v_label); } else { if (v_facette.Value.p02_arcs != null && v_facette.Value.p02_arcs.Count > 0) { SpatialTrace.SetLineColor(Color.Red); SpatialTrace.SetLineWidth(3); IGeometry v_arcGeom; foreach (BeanArc_internal v_arcPolyg in v_facette.Value.p02_arcs) { v_label = "PB FAC " + v_facette.Key + "_" + p_prefixeLabel + "=> Arc: " + v_arcPolyg.p00_idArc + "\\" + v_arcPolyg.p01_hcodeArc; int v_srid = v_arcPolyg.p11_pointDbt.p11_srid; v_arcGeom = FLabServices.createUtilitaires().GetGeometryLine(v_arcPolyg.p11_pointDbt.p10_coord, v_arcPolyg.p12_pointFin.p10_coord, v_srid, false); SpatialTrace.TraceGeometry(v_arcGeom, v_label, v_label); } SpatialTrace.SetLineWidth(1); SpatialTrace.SetLineColor(Color.Blue); } } } SpatialTrace.Disable(); }
// public void GetVisuPoints2D(List <BeanPoint_internal> p_points, string p_label, Color p_couleurCourante, int p_taillePointAutoSi0OuMoins) { try { int param_ratioTaillePoint = 100; int v_taillePoints = p_taillePointAutoSi0OuMoins; if (p_taillePointAutoSi0OuMoins <= 0) { v_taillePoints = GetTailleAffichageDuPoint(p_points, param_ratioTaillePoint); } SpatialTrace.Enable(); string v_message; IGeometry v_pointGeom; //SpatialTrace.SetFillColor(param_couleurCourante); SpatialTrace.SetLineColor(p_couleurCourante); foreach (BeanPoint_internal v_point in p_points) { v_message = "Pt " + v_point.p00_id + " (" + v_point.p10_coord[2] + " m)"; if (p_label != "") { v_message = p_label + "/" + v_message; } v_pointGeom = FLabServices.createUtilitaires().ConstructPoint(v_point.p10_coord[0], v_point.p10_coord[1], v_point.p11_srid).Buffer(v_taillePoints); SpatialTrace.TraceGeometry(v_pointGeom, v_message, v_message); } SpatialTrace.Disable(); } catch (Exception) { throw; } }
public void ShowStopAreasOnMap(SncfRepository _sncfRepo, IGNRepository _ignRepo, string wkt = null) { SqlGeography polyQuery = wkt == null ? null : SqlGeography.STGeomFromText(new SqlChars(new SqlString(wkt)), 4326); Dictionary <int, Noeud> noeuds = _ignRepo.GetAllNoeuds_LatLon(polyQuery); Dictionary <string, SqlGeography> geogListStopAreas = new Dictionary <string, SqlGeography>(); IEnumerable <StopArea> stopAreas = _sncfRepo.StopAreas; if (polyQuery != null) { stopAreas = stopAreas.Where(s => FromCoordToGeography(s.Coord).STIntersects(polyQuery).IsTrue); } foreach (var sp in stopAreas) { geogListStopAreas.Add(sp.Name + " " + sp.Id, FromCoordToGeography(sp.Coord)); } Dictionary <string, SqlGeography> geogListStopPoints = new Dictionary <string, SqlGeography>(); IEnumerable <StopPoint> stopPoints = _sncfRepo.StopPoints; if (polyQuery != null) { stopPoints = stopPoints.Where(s => FromCoordToGeography(s.Coord).STIntersects(polyQuery).IsTrue); } foreach (var sp in stopPoints) { geogListStopPoints.Add(sp.Name + " " + sp.Id, FromCoordToGeography(sp.Coord)); } SpatialTrace.Enable(); int i = 0; foreach (var g in noeuds) { if (i % 2 == 0) { SpatialTrace.SetLineColor(Colors.Blue); } else { SpatialTrace.SetLineColor(Colors.Red); } SpatialTrace.TraceGeometry(g.Value.Geometry, $"{g.Value.Id}: {g.Value.Toponyme}", $"{g.Value.Id}: {g.Value.Toponyme}"); i++; } //SpatialTrace.SetLineColor(Colors.Red); //SpatialTrace.TraceGeometry(geogList120, "Lignes 120", "Lignes 120"); SpatialTrace.Indent("Stop areas"); SpatialTrace.SetFillColor(Colors.Green); foreach (var kvp in geogListStopAreas) { SpatialTrace.TraceGeometry(kvp.Value, kvp.Key, kvp.Key); } SpatialTrace.Unindent(); SpatialTrace.Indent("Stop points"); SpatialTrace.SetFillColor(Colors.Violet); foreach (var kvp in geogListStopPoints) { SpatialTrace.TraceGeometry(kvp.Value, kvp.Key, kvp.Key); } SpatialTrace.Unindent(); SpatialTrace.ShowDialog(); SpatialTrace.Disable(); }