コード例 #1
0
        private void btnTestFacettes_Click(object sender, EventArgs e)
        {
            BeanFacettesToVisu3D v_beanToVisu3d;

            v_beanToVisu3d = new BeanFacettesToVisu3D();

            Dictionary <int, int> v_indiceParIdPoint = new Dictionary <int, int>();
            int      v_indice = 0;
            GeoPoint v_geoPoint;

            foreach (BeanPoint_internal v_point in _topolFacettes.p11_pointsFacettesByIdPoint.Values)
            {
                v_geoPoint = new GeoPoint(v_point.p10_coord[1], v_point.p10_coord[0], (float)v_point.p10_coord[2]);
                v_beanToVisu3d.p00_geoPoint.Add(v_geoPoint);
                v_indiceParIdPoint.Add(v_point.p00_id, v_indice);
                v_indice++;
            }
            //Création des listes d'indices et normalisation du sens des points favettes
            List <int> v_listeIndices;
            bool       v_renvoyerNullSiPointsColineaires_vf       = true;
            bool       v_normalisationSensHoraireSinonAntihoraire = false;

            foreach (BeanFacette_internal v_facette in _topolFacettes.p13_facettesById.Values)
            {
                List <BeanPoint_internal> v_normalisationDuSens = FLabServices.createCalculMedium().GetOrdonnancementPointsFacette(v_facette.p01_pointsDeFacette, v_renvoyerNullSiPointsColineaires_vf, v_normalisationSensHoraireSinonAntihoraire);
                if (v_normalisationDuSens != null)
                {
                    v_listeIndices = new List <int>();
                    foreach (BeanPoint_internal v_ptFacette in v_normalisationDuSens)
                    {
                        v_listeIndices.Add(v_indiceParIdPoint[v_ptFacette.p00_id]);
                    }
                    v_beanToVisu3d.p01_listeIndexPointsfacettes.Add(v_listeIndices);
                }
            }
            //
            SharpGltfService glTFService = new SharpGltfService(new MeshService());
            var model = glTFService.GenerateTriangleMesh(v_beanToVisu3d.p00_geoPoint, v_beanToVisu3d.p01_listeIndexPointsfacettes.SelectMany(c => c).ToList(), null);


            string v_nomFichierOut = "TIN_";

            if (rdSRTMGL3.Checked)
            {
                v_nomFichierOut += "SRTM_GL3";
            }
            else if (rdSRTMGL1.Checked)
            {
                v_nomFichierOut += "SRTM_GL1";
            }
            else
            {
                v_nomFichierOut += "AW3D30";
            }
            v_nomFichierOut += "_p" + tb_precisionEnM.Text;
            model.SaveGLB(Path.Combine("Test3D", v_nomFichierOut + ".glb"));
            MessageBox.Show("Traitement terminé =>" + v_nomFichierOut);
        }