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; } }
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(); }
static void TestWorld(bool useLabels = false, bool useIndents = false) { SpatialTrace.Enable(); SpatialTrace.Clear(); List <Country> v_countries = GetCountries(); SpatialTrace.Enable(); foreach (var countryByContinent in v_countries.GroupBy(p => p.Continent)) { if (useIndents) { SpatialTrace.Indent(countryByContinent.Key); } foreach (var country in countryByContinent) { SpatialTrace.TraceGeometry(country.Geometry, country.Name, country.Name); } if (useIndents) { SpatialTrace.Unindent(); } } //SpatialTrace.ShowDialog(); }
private static void SpatialTraceLine(List <GeoPoint> lineElevationData, string message) { const int DEFAULT_HEIGHT = 300; // Say that 1 sample is one pixel and a graph is usually 300px tall // So 300px = 300 samples = max height (H) // So for numSamples, (H * numSamples / 300) = height of 1px double minH = lineElevationData.Min(p => p.Elevation.GetValueOrDefault(0)); double maxH = lineElevationData.Max(p => p.Elevation.GetValueOrDefault(0)); double H = maxH - minH; double ratio_11 = lineElevationData.Last().DistanceFromOriginMeters / H; double ratio = ratio_11 / 4; double tolerance = H / DEFAULT_HEIGHT; // Make 4:1 geom SqlGeometryBuilder gb = new SqlGeometryBuilder(); gb.SetSrid(0); // custom SRID gb.BeginGeometry(OpenGisGeometryType.LineString); gb.BeginFigure(lineElevationData[0].DistanceFromOriginMeters / ratio, lineElevationData[0].Elevation.GetValueOrDefault(0)); for (int i = 1; i < lineElevationData.Count; i++) { gb.AddLine(lineElevationData[i].DistanceFromOriginMeters / ratio, lineElevationData[i].Elevation.GetValueOrDefault(0)); } gb.EndFigure(); gb.EndGeometry(); SqlGeometry geom = gb.ConstructedGeometry; SpatialTrace.Enable(); SpatialTrace.TraceGeometry(geom, message); SpatialTrace.Disable(); }
private void TestTrace() { SpatialTrace.Enable(); SpatialTrace.TraceText("Simple geometries"); SpatialTrace.Indent(); SqlGeometry points = Sample_Points(4326); SpatialTrace.TraceGeometry(points, "Points"); SqlGeometry poly = Sample_Polygon(4326); SpatialTrace.TraceGeometry(poly, "Polygon"); SqlGeography geog = Sample_PolygonGeography(); SpatialTrace.TraceGeometry(geog, "Polygon (geography)"); SpatialTrace.Unindent(); SpatialTrace.TraceText("Composite geometries"); SpatialTrace.Indent(); SpatialTrace.TraceGeometry(poly.STUnion(points), "poly.STUnion(points)"); SpatialTrace.TraceGeometry(poly.STUnion(points).STConvexHull(), "poly.STUnion(points).STConvexHull()"); SpatialTrace.Unindent(); SpatialTrace.Disable(); }
public void VisuPoints(Dictionary <string, List <BeanPoint_internal> > p_pointsParClasse, Dictionary <string, Color> p_tableCouleurs) { try { int param_taillePoint = 2; SpatialTrace.Enable(); Color v_couleurCourante; string v_message; SqlGeometry v_pointGeom; foreach (KeyValuePair <string, List <BeanPoint_internal> > v_classe in p_pointsParClasse) { v_couleurCourante = p_tableCouleurs[v_classe.Key]; SpatialTrace.SetFillColor(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 = SqlGeometry.Point(v_point.p10_coord[0], v_point.p10_coord[1], v_point.p11_srid).STBuffer(param_taillePoint); SpatialTrace.TraceGeometry(v_pointGeom, v_message, v_message); } } SpatialTrace.Disable(); } catch (Exception) { throw; } }
// 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 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 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(); }
private void SpatialTrace_Connexions(List <Troncon> connectedTroncons, KeyValuePair <int, TopoNode> topoNode) { SpatialTrace.Enable(); SpatialTrace.Indent(connectedTroncons.Count.ToString() + " connections - node " + topoNode.Key.ToString()); foreach (var trn in connectedTroncons) { SpatialTrace.TraceGeometry(trn.Geometry, trn.Id.ToString(), trn.Id.ToString()); } foreach (var troncon in connectedTroncons) { foreach (var tronconOther in connectedTroncons.Where(t => t.Id != troncon.Id)) { var angle = Geometry.AngleBetweenLines(troncon.Geometry, tronconOther.Geometry); SqlGeometry connectionPoint = troncon.Geometry.STIntersection(tronconOther.Geometry); SqlGeometry segment1 = Geometry.FirstSegmentFrom(troncon.Geometry, connectionPoint); SqlGeometry segment2 = Geometry.FirstSegmentFrom(tronconOther.Geometry, connectionPoint); SpatialTrace.TraceGeometry(segment1.STUnion(segment2), $"{troncon.Id}<->{tronconOther.Id} - angle: {angle * 180 / Math.PI}", $"angle: {angle}"); } } SpatialTrace.TraceGeometry(topoNode.Value.Geometry.STBuffer(50), "node " + topoNode.Value.Id.ToString(), "node " + topoNode.Value.Id.ToString()); SpatialTrace.Unindent(); SpatialTrace.Disable(); }
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 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")); }
static void TestVariousGeometries() { WKTReader _wktReader = new WKTReader(); _wktReader.DefaultSRID = 4326; IGeometry simplePoint = new Geometries.Point(1, 47) { SRID = 4326 }; IGeometry multiPoint = _wktReader.Read("MULTIPOINT((1 47),(1 46),(0 46),(0 47),(1 47))"); IGeometry lineString = _wktReader.Read("LINESTRING(1 47,1 46,0 46,0 47,1 47)"); IGeometry multiLineString = _wktReader.Read("MULTILINESTRING((0.516357421875 47.6415668949958,0.516357421875 47.34463879017405,0.977783203125 47.22539733216678,1.175537109375 47.463611506072866,0.516357421875 47.6415668949958),(0.764923095703125 47.86549372980948,0.951690673828125 47.82309640371982,1.220855712890625 47.79911736820551,1.089019775390625 47.69015026565801,1.256561279296875 47.656860648589))"); IGeometry simplePoly = _wktReader.Read("POLYGON((1 47,1 46,0 46,0 47,1 47))"); IGeometry polyWithHole = _wktReader.Read(@" POLYGON( (0.516357421875 47.6415668949958,0.516357421875 47.34463879017405,0.977783203125 47.22539733216678,1.175537109375 47.463611506072866,0.516357421875 47.6415668949958), (0.630340576171875 47.54944962456812,0.630340576171875 47.49380564962583,0.729217529296875 47.482669772098674,0.731964111328125 47.53276262898896,0.630340576171875 47.54944962456812) )"); IGeometry multiPolygon = _wktReader.Read(@" MULTIPOLYGON ( ((40 40, 20 45, 45 30, 40 40)), ((20 35, 45 20, 30 5, 10 10, 10 30, 20 35), (30 20, 20 25, 20 15, 30 20)), ((0.516357421875 47.6415668949958,0.516357421875 47.34463879017405,0.977783203125 47.22539733216678,1.175537109375 47.463611506072866,0.516357421875 47.6415668949958),(0.630340576171875 47.54944962456812,0.630340576171875 47.49380564962583,0.729217529296875 47.482669772098674,0.731964111328125 47.53276262898896,0.630340576171875 47.54944962456812)) )"); IGeometry geomCol = _wktReader.Read(@" GEOMETRYCOLLECTION ( POLYGON((0.516357421875 47.6415668949958,0.516357421875 47.34463879017405,0.977783203125 47.22539733216678,1.175537109375 47.463611506072866,0.516357421875 47.6415668949958),(0.630340576171875 47.54944962456812,0.630340576171875 47.49380564962583,0.729217529296875 47.482669772098674,0.731964111328125 47.53276262898896,0.630340576171875 47.54944962456812)), LINESTRING(0.764923095703125 47.86549372980948,0.951690673828125 47.82309640371982,1.220855712890625 47.79911736820551,1.089019775390625 47.69015026565801,1.256561279296875 47.656860648589), POINT(0.767669677734375 47.817563762851776) )"); SpatialTrace.Enable(); SpatialTrace.SetFillColor(Color.FromArgb(128, 0, 0, 255)); // Fill with blue SpatialTrace.TraceGeometry(simplePoint, "simplePoint"); SpatialTrace.SetFillColor(Color.FromArgb(128, 255, 0, 0)); // Fill with red SpatialTrace.TraceGeometry(multiPoint, "multiPoint"); SpatialTrace.ResetStyle(); SpatialTrace.TraceGeometry(lineString, "lineString"); SpatialTrace.TraceGeometry(multiLineString, "multiLineString"); SpatialTrace.TraceGeometry(simplePoly, "simplePoly"); SpatialTrace.TraceGeometry(polyWithHole, "polyWithHole"); SpatialTrace.TraceGeometry(multiPolygon, "multiPolygon"); SpatialTrace.TraceGeometry(geomCol, "geomCol"); //SpatialTrace.ShowDialog(); //SpatialTrace.Clear(); }
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 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 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(); }
private void btn_testCH_Click(object sender, EventArgs e) { List <BeanPoint_internal> v_pointConvexHull; v_pointConvexHull = FLabServices.createCalculMedium().GetConvexHull2D(_dataPointsTests); // string v_message = "ConvexHull calculé"; v_message += " (" + v_pointConvexHull.Count + " pts sur " + _dataPointsTests.Count + ")."; v_message += ". Affichez dans SpatialTrace ?"; if (MessageBox.Show(v_message, "Calcul convexHull", MessageBoxButtons.OKCancel) == DialogResult.Cancel) { return; } string v_label = ""; Color v_couleurBase = Color.FromArgb(255, 0, 255, 255); FServicesApplicatifs.createVisuSpatialTrace().GetVisuPoints2D(_dataPointsTests, v_label, v_couleurBase, -1); v_label = "CH"; FServicesApplicatifs.createVisuSpatialTrace().GetVisuPoints2D(v_pointConvexHull, v_label, 10); SpatialTrace.Enable(); IGeometry v_ligneCh; for (int v_indexPt = 0; v_indexPt < v_pointConvexHull.Count - 1; v_indexPt++) { v_ligneCh = FLabServices.createUtilitaires().GetGeometryLine(v_pointConvexHull[v_indexPt].p10_coord, v_pointConvexHull[v_indexPt + 1].p10_coord, 2154, true); SpatialTrace.TraceGeometry(v_ligneCh, "CH arc: " + v_indexPt, "CH arc: " + v_indexPt); } v_ligneCh = FLabServices.createUtilitaires().GetGeometryLine(v_pointConvexHull[v_pointConvexHull.Count - 1].p10_coord, v_pointConvexHull[0].p10_coord, 2154, true); SpatialTrace.TraceGeometry(v_ligneCh, "CH arc: " + (v_pointConvexHull.Count - 1), "CH arc: " + (v_pointConvexHull.Count - 1)); SpatialTrace.Disable(); FVisualisationServices.createVisualisationSpatialTraceServices().AfficheVisu(); // MessageBox.Show("Traitement terminé."); }
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(); }