@@ -798,8 +798,9 @@ namespace WorldBuilder
798798 WBAssertThrow (layer_type != LayerType::MAX_LAYERTYPE, " Could not find litho1.0 layer type " << rest_of_string);
799799 for (size_t index = 0 ; index < n_nodes; ++index )
800800 {
801+ const std::vector<Point<2 >> scaled_polygon = Utilities::get_scaled_polygon (addition_points,1.5 );
801802 // only add the point if it is actually in the feature
802- if (Utilities::polygon_contains_point (Utilities::get_scaled_polygon (addition_points, 1.5 ) , Point<2 >(Datasets::LITHO1_0::coordinates_lat_long[index*2 +1 ],Datasets::LITHO1_0::coordinates_lat_long[index*2 ],CoordinateSystem::spherical)))
803+ if (Utilities::polygon_contains_point (scaled_polygon , Point<2 >(Datasets::LITHO1_0::coordinates_lat_long[index*2 +1 ],Datasets::LITHO1_0::coordinates_lat_long[index*2 ],CoordinateSystem::spherical)))
803804 {
804805 const size_t global_index = index*n_layers+static_cast <size_t > (layer_type);
805806 result.first .emplace_back (Datasets::LITHO1_0::depths[global_index]);
@@ -1218,29 +1219,44 @@ namespace WorldBuilder
12181219
12191220 Value *array1 = Pointer ((strict_base + " /" + name).c_str ()).Get (parameters);
12201221
1221- for (size_t i = 0 ; i < array1->Size (); ++i )
1222+ for (unsigned int i = 0 ; i < array1->Size (); ++i )
12221223 {
12231224 const std::string base = (strict_base + " /" ).append (name).append (" /" ).append (std::to_string (i));
1224- Value *array2 = Pointer ((base).c_str ()).Get (parameters);
1225+ // Value *array2 = Pointer((base).c_str()).Get(parameters);
12251226
12261227 // Not sure why cppcheck it is generating the warning
12271228 // Filed a question at: https://sourceforge.net/p/cppcheck/discussion/general/thread/429759f85e/
12281229 // cppcheck-suppress constStatement
1229- std::vector<Point<2 > > sub_vector (array2->Size (),Point<2 >(NaN::DSNAN,NaN::DSNAN,coordinate_system->natural_coordinate_system ()));
1230- for (size_t j = 0 ; j < array2->Size (); ++j )
1230+ // std::vector<Point<2> > sub_vector(array2->Size(),Point<2>(NaN::DSNAN,NaN::DSNAN,coordinate_system->natural_coordinate_system()));
1231+ // std::cout << "Flag 1" << std::endl << std::endl;
1232+ // auto array2 = array1->FindMember(name.c_str());
1233+ // std::cout << "Flag 1.2" << std::endl << std::endl;
1234+ auto array2 = array1->GetArray ();// FindMember(std::to_string(i).c_str());
1235+ // std::cout << "Flag 2" << std::endl;
1236+ // std::vector<Point<2> > sub_vector(array1->FindMember(name.c_str())->value.FindMember(std::to_string(i).c_str())->value.Size(),Point<2>(NaN::DSNAN,NaN::DSNAN,coordinate_system->natural_coordinate_system()));
1237+ std::vector<Point<2 > > sub_vector (array2[i].Size (),Point<2 >(NaN::DSNAN,NaN::DSNAN,coordinate_system->natural_coordinate_system ()));
1238+ // std::cout << "Flag 3" << std::endl;
1239+ // for (size_t j = 0; j < array1->FindMember(name.c_str())->value.FindMember(std::to_string(i).c_str())->value.Size(); ++j )
1240+ for (unsigned int j = 0 ; j < array2[i].Size (); ++j )
12311241 {
1232- const std::string base_extended = base + " /" + std::to_string (j);
1242+ // const std::string base_extended = base + "/" + std::to_string(j);
12331243
1234- WBAssertThrow (Pointer ((base_extended).c_str ()).Get (parameters)->Size () == 2 ,
1244+ auto array3 = array2[i].GetArray ();// FindMember(std::to_string(j).c_str());
1245+ // WBAssertThrow(Pointer((base_extended).c_str()).Get(parameters)->Size() == 2,
1246+ // "Array " << i << " is supposed to be a 2d point, but the inner array dimensions of "
1247+ // << j << " is " << Pointer((base_extended).c_str()).Get(parameters)->Size() << '.');
1248+ WBAssertThrow (array3[j].Size () == 2 ,
12351249 " Array " << i << " is supposed to be a 2d point, but the inner array dimensions of "
1236- << j << " is " << Pointer ((base_extended). c_str ()). Get (parameters)-> Size () << ' .' );
1250+ << j << " is " << array3[j]. Size () << ' .' );
12371251 double value1;
12381252 double value2;
12391253
12401254 try
12411255 {
1242- value1 = Pointer ((base_extended + " /0" ).c_str ()).Get (parameters)->GetDouble ();
1243- value2 = Pointer ((base_extended + " /1" ).c_str ()).Get (parameters)->GetDouble ();
1256+ // value1 = Pointer((base_extended + "/0").c_str()).Get(parameters)->GetDouble();
1257+ // value2 = Pointer((base_extended + "/1").c_str()).Get(parameters)->GetDouble();
1258+ value1 = array3[j].GetArray ()[0 ].GetDouble ();// Pointer((base_extended + "/0").c_str()).Get(parameters)->GetDouble();
1259+ value2 = array3[j].GetArray ()[1 ].GetDouble ();// Pointer((base_extended + "/1").c_str()).Get(parameters)->GetDouble();
12441260 }
12451261 catch (...)
12461262 {
0 commit comments